Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FreeBSD #119

Merged
merged 9 commits into from Jul 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ platforms:
- name: centos-6.5
- name: fedora-19
- name: fedora-20
- name: freebsd-10.1

suites:
- name: default
Expand Down
3 changes: 1 addition & 2 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
site :opscode
source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'apt', '~> 2.0'
end

8 changes: 7 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@
ext_php_pgsql ext_php_soap ext_php_sockets
ext_php_sqlite3 ext_php_tidy ext_php_xmlrpc
}
default['php']['package_options'] = "" # Use this to customise your yum or apt command
default['php']['package_options'] = "" # Use this to customise your yum or apt command
default['php']['pear'] = 'pear.bat'
default['php']['pecl'] = 'pecl.bat'
when 'freebsd'
default['php']['conf_dir'] = '/usr/local/etc'
default['php']['ext_conf_dir'] = '/usr/local/etc/php'
default['php']['fpm_user'] = 'www'
default['php']['fpm_group'] = 'www'
default['php']['packages'] = %w( php56 pear )
else
default['php']['conf_dir'] = '/etc/php5/cli'
default['php']['ext_conf_dir'] = '/etc/php5/conf.d'
Expand Down
6 changes: 3 additions & 3 deletions recipes/ini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
source node['php']['ini']['template']
cookbook node['php']['ini']['cookbook']
unless platform?('windows')
owner 'root'
group 'root'
mode '0644'
owner 'root'
group node['root_group']
mode '0644'
end
variables(:directives => node['php']['directives'])
end
3 changes: 3 additions & 0 deletions recipes/module_gd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
el5_range => 'php53-gd',
'default' => 'php-gd'
},
'freebsd' => {
'default' => 'php56-gd'
},
'default' => 'php5-gd'
)

Expand Down
34 changes: 34 additions & 0 deletions spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require_relative '../spec_helper'

describe 'php::default' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }

context 'on freebsd' do
let(:chef_run) {
ChefSpec::SoloRunner.new(platform: 'freebsd', version: '10.0')
.converge(described_recipe)
}

it 'installs php' do
expect(chef_run).to install_package('php56')
expect(chef_run).not_to install_package('php5-cgi')
end

it 'installs pear' do
expect(chef_run).to install_package('pear')
end

it 'creates /usr/local/etc/php.ini' do
expect(chef_run).to create_template('/usr/local/etc/php.ini').with(
source: 'php.ini.erb',
cookbook: 'php',
owner: 'root',
mode: '0644',
variables: {
directives: {}
}
)
end
end

end
20 changes: 20 additions & 0 deletions test/integration/default/serverspec/php_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'serverspec'

# Required by serverspec
set :backend, :exec

describe 'PHP' do

it 'has php' do
expect(command('php -v').exit_status).to eq(0)
end

it 'has the pear.php.net channel' do
expect(command('pear list-channels').stdout).to include('pear.php.net')
end

it 'has the pecl.php.net channel' do
expect(command('pear list-channels').stdout).to include('pecl.php.net')
end

end