diff --git a/Rakefile b/Rakefile index a1af58dab..965b4bf26 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,7 @@ desc 'Run all style checks' task style: ['style:chef', 'style:ruby'] # Rspec and ChefSpec -desc "Run ChefSpec examples" +desc 'Run ChefSpec examples' RSpec::Core::RakeTask.new(:spec) # Integration tests. Kitchen.ci @@ -33,21 +33,21 @@ namespace :integration do instance.test(:always) end end - + desc 'Run Test Kitchen with cloud plugins' task :cloud do run_kitchen = true if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false' run_kitchen = false end - + if run_kitchen Kitchen.logger = Kitchen.default_file_logger @loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml') - config = Kitchen::Config.new( loader: @loader) + config = Kitchen::Config.new(loader: @loader) config.instances.each do |instance| - instance.test(:always) - end + instance.test(:always) + end end end end diff --git a/attributes/default.rb b/attributes/default.rb index 7eb6fb6a4..f2d03577d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -35,9 +35,9 @@ default['php']['fpm_group'] = 'nobody' default['php']['ext_dir'] = "/usr/#{lib_dir}/php/modules" if node['platform_version'].to_f < 6 - default['php']['packages'] = %w{ php53 php53-devel php53-cli php-pear } + default['php']['packages'] = %w(php53 php53-devel php53-cli php-pear) else - default['php']['packages'] = %w{ php php-devel php-cli php-pear } + default['php']['packages'] = %w(php php-devel php-cli php-pear) default['php']['fpm_package'] = 'php-fpm' default['php']['fpm_pooldir'] = '/etc/php-fpm.d' default['php']['fpm_default_conf'] = '/etc/php-fpm.d/www.conf' @@ -59,7 +59,7 @@ else default['php']['ext_conf_dir'] = '/etc/php5/conf.d' end - default['php']['packages'] = %w{ php5-cgi php5 php5-dev php5-cli php-pear } + default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear) default['php']['fpm_package'] = 'php5-fpm' default['php']['fpm_pooldir'] = '/etc/php5/fpm/pool.d' default['php']['fpm_user'] = 'www-data' @@ -71,7 +71,7 @@ default['php']['ext_conf_dir'] = '/etc/php5/conf.d' default['php']['fpm_user'] = 'wwwrun' default['php']['fpm_group'] = 'www' - default['php']['packages'] = %w{ apache2-mod_php5 php5-pear } + default['php']['packages'] = %w(apache2-mod_php5 php5-pear) lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib' when 'windows' default['php']['windows']['msi_name'] = 'PHP 5.3.28' @@ -80,16 +80,16 @@ default['php']['conf_dir'] = 'C:\Program Files (x86)\PHP' default['php']['ext_conf_dir'] = node['php']['conf_dir'] # These extensions are installed by default by the GUI MSI - default['php']['packages'] = %w{ cgi ScriptExecutable PEAR - iis4FastCGI ext_php_bz2 ext_php_curl - ext_php_exif ext_php_gd2 ext_php_gettext - ext_php_gmp ext_php_imap ext_php_mbstring - ext_php_mysql ext_php_mysqli ext_php_openssl - ext_php_pdo_mysql ext_php_pdo_odbc ext_php_pdo_sqlite - 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']['packages'] = %w(cgi ScriptExecutable PEAR + iis4FastCGI ext_php_bz2 ext_php_curl + ext_php_exif ext_php_gd2 ext_php_gettext + ext_php_gmp ext_php_imap ext_php_mbstring + ext_php_mysql ext_php_mysqli ext_php_openssl + ext_php_pdo_mysql ext_php_pdo_odbc ext_php_pdo_sqlite + 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']['pear'] = 'pear.bat' default['php']['pecl'] = 'pecl.bat' when 'freebsd' @@ -103,7 +103,7 @@ default['php']['ext_conf_dir'] = '/etc/php5/conf.d' default['php']['fpm_user'] = 'www-data' default['php']['fpm_group'] = 'www-data' - default['php']['packages'] = %w{ php5-cgi php5 php5-dev php5-cli php-pear } + default['php']['packages'] = %w(php5-cgi php5 php5-dev php5-cli php-pear) end default['php']['url'] = 'http://us1.php.net/get' @@ -111,7 +111,7 @@ default['php']['checksum'] = '378de162efdaeeb725ed38d7fe956c9f0b9084ff' default['php']['prefix_dir'] = '/usr/local' -default['php']['configure_options'] = %W{--prefix=#{php['prefix_dir']} +default['php']['configure_options'] = %W(--prefix=#{php['prefix_dir']} --with-libdir=#{lib_dir} --with-config-file-path=#{php['conf_dir']} --with-config-file-scan-dir=#{php['ext_conf_dir']} @@ -147,7 +147,7 @@ --with-mysql-sock --with-sqlite3 --with-pdo-mysql - --with-pdo-sqlite} + --with-pdo-sqlite) -default['php']['ini']['template'] = "php.ini.erb" -default['php']['ini']['cookbook'] = "php" +default['php']['ini']['template'] = 'php.ini.erb' +default['php']['ini']['cookbook'] = 'php' diff --git a/metadata.rb b/metadata.rb index 8735a3a50..76003735a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -12,7 +12,7 @@ depends 'windows' depends 'iis' -%w{ debian ubuntu centos redhat fedora scientific amazon windows oracle }.each do |os| +%w(debian ubuntu centos redhat fedora scientific amazon windows oracle).each do |os| supports os end diff --git a/providers/pear.rb b/providers/pear.rb index 26e788e46..fe0c80249 100644 --- a/providers/pear.rb +++ b/providers/pear.rb @@ -119,8 +119,8 @@ def current_installed_version @current_installed_version ||= begin v = nil version_check_cmd = "#{@bin} -d " - version_check_cmd << " preferred_state=#{can_haz(@new_resource, "preferred_state")}" - version_check_cmd << " list#{expand_channel(can_haz(@new_resource, "channel"))}" + version_check_cmd << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}" + version_check_cmd << " list#{expand_channel(can_haz(@new_resource, 'channel'))}" p = shell_out(version_check_cmd) response = nil response = grep_for_version(p.stdout, @new_resource.package_name) if p.stdout =~ /\.?Installed packages/i @@ -131,8 +131,8 @@ def current_installed_version def candidate_version @candidate_version ||= begin candidate_version_cmd = "#{@bin} -d " - candidate_version_cmd << "preferred_state=#{can_haz(@new_resource, "preferred_state")}" - candidate_version_cmd << " search#{expand_channel(can_haz(@new_resource, "channel"))}" + candidate_version_cmd << "preferred_state=#{can_haz(@new_resource, 'preferred_state')}" + candidate_version_cmd << " search#{expand_channel(can_haz(@new_resource, 'channel'))}" candidate_version_cmd << "#{@new_resource.package_name}" p = shell_out(candidate_version_cmd) response = nil @@ -143,9 +143,9 @@ def candidate_version def install_package(name, version) command = "echo \"\r\" | #{@bin} -d" - command << " preferred_state=#{can_haz(@new_resource, "preferred_state")}" + command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}" command << " install -a#{expand_options(@new_resource.options)}" - command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}" + command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}" command << "-#{version}" if version && !version.empty? pear_shell_out(command) manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl? @@ -154,9 +154,9 @@ def install_package(name, version) def upgrade_package(name, version) command = "echo \"\r\" | #{@bin} -d" - command << " preferred_state=#{can_haz(@new_resource, "preferred_state")}" + command << " preferred_state=#{can_haz(@new_resource, 'preferred_state')}" command << " upgrade -a#{expand_options(@new_resource.options)}" - command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}" + command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}" command << "-#{version}" if version && !version.empty? pear_shell_out(command) manage_pecl_ini(name, :create, can_haz(@new_resource, 'directives'), can_haz(@new_resource, 'zend_extensions')) if pecl? @@ -166,7 +166,7 @@ def upgrade_package(name, version) def remove_package(name, version) command = "#{@bin} uninstall" command << " #{expand_options(@new_resource.options)}" - command << " #{prefix_channel(can_haz(@new_resource, "channel"))}#{name}" + command << " #{prefix_channel(can_haz(@new_resource, 'channel'))}#{name}" command << "-#{version}" if version && !version.empty? pear_shell_out(command) disable_package(name) @@ -231,12 +231,12 @@ def manage_pecl_ini(name, action, directives, zend_extensions) files = get_extension_files(name) extensions = Hash[ - files.map do |filepath| - rel_file = filepath.clone - rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix - zend = zend_extensions.include?(rel_file) - [(zend ? filepath : rel_file) , zend] - end + files.map do |filepath| + rel_file = filepath.clone + rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix + zend = zend_extensions.include?(rel_file) + [(zend ? filepath : rel_file), zend] + end ] template "#{node['php']['ext_conf_dir']}/#{name}.ini" do @@ -274,9 +274,9 @@ def pecl? @pecl ||= begin # search as a pear first since most 3rd party channels will report pears as pecls! - search_args = String.new - search_args << " -d preferred_state=#{can_haz(@new_resource, "preferred_state")}" - search_args << " search#{expand_channel(can_haz(@new_resource, "channel"))} #{@new_resource.package_name}" + search_args = '' + search_args << " -d preferred_state=#{can_haz(@new_resource, 'preferred_state')}" + search_args << " search#{expand_channel(can_haz(@new_resource, 'channel'))} #{@new_resource.package_name}" if grep_for_version(shell_out(node['php']['pear'] + search_args).stdout, @new_resource.package_name) false diff --git a/providers/pear_channel.rb b/providers/pear_channel.rb index 56d18f14b..daa4f48d6 100644 --- a/providers/pear_channel.rb +++ b/providers/pear_channel.rb @@ -84,10 +84,8 @@ def load_current_resource private def exists? - begin - shell_out!("#{node['php']['pear']} channel-info #{@current_resource.channel_name}") - true - rescue Mixlib::ShellOut::ShellCommandFailed - false - end + shell_out!("#{node['php']['pear']} channel-info #{@current_resource.channel_name}") + true +rescue Mixlib::ShellOut::ShellCommandFailed + false end diff --git a/recipes/default.rb b/recipes/default.rb index cfacbc410..e94b6c4ea 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -30,4 +30,4 @@ action :update end -include_recipe "php::ini" +include_recipe 'php::ini' diff --git a/recipes/ini.rb b/recipes/ini.rb index 096c7b378..ee0f15ecb 100644 --- a/recipes/ini.rb +++ b/recipes/ini.rb @@ -19,12 +19,12 @@ # template "#{node['php']['conf_dir']}/php.ini" do - source node['php']['ini']['template'] - cookbook node['php']['ini']['cookbook'] - unless platform?('windows') + source node['php']['ini']['template'] + cookbook node['php']['ini']['cookbook'] + unless platform?('windows') owner 'root' group node['root_group'] mode '0644' - end - variables(:directives => node['php']['directives']) + end + variables(:directives => node['php']['directives']) end diff --git a/recipes/module_apc.rb b/recipes/module_apc.rb index 08ff84e2b..a3b69abad 100644 --- a/recipes/module_apc.rb +++ b/recipes/module_apc.rb @@ -21,7 +21,7 @@ case node['platform_family'] when 'rhel', 'fedora' - %w{ httpd-devel pcre pcre-devel }.each do |pkg| + %w(httpd-devel pcre pcre-devel).each do |pkg| package pkg do action :install end diff --git a/recipes/module_memcache.rb b/recipes/module_memcache.rb index 117ca3970..4c05266c9 100644 --- a/recipes/module_memcache.rb +++ b/recipes/module_memcache.rb @@ -21,7 +21,7 @@ case node['platform_family'] when 'rhel', 'fedora' - %w{ zlib-devel }.each do |pkg| + %w(zlib-devel).each do |pkg| package pkg do action :install end diff --git a/recipes/package.rb b/recipes/package.rb index 4f322fd0c..06799efb1 100644 --- a/recipes/package.rb +++ b/recipes/package.rb @@ -28,11 +28,11 @@ source node['php']['windows']['msi_source'] installer_type :msi - options %W[ - /quiet - INSTALLDIR="#{install_dir}" - ADDLOCAL=#{node['php']['packages'].join(',')} - ].join(' ') + options %W( + /quiet + INSTALLDIR="#{install_dir}" + ADDLOCAL=#{node['php']['packages'].join(',')} + ).join(' ') end # WARNING: This is not the out-of-the-box go-pear.phar. It's been modified to patch this bug: @@ -63,4 +63,4 @@ end end -include_recipe "php::ini" +include_recipe 'php::ini' diff --git a/recipes/source.rb b/recipes/source.rb index 186ba0f7a..c58ae0724 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -30,9 +30,9 @@ end pkgs = value_for_platform_family( - %w{ rhel fedora } => %w{ bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel mhash-devel }, - %w{ debian ubuntu } => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev }, - 'default' => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev } + %w(rhel fedora) => %w(bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel mhash-devel), + %w(debian ubuntu) => %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev), + 'default' => %w(libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev) ) pkgs.each do |pkg| @@ -86,4 +86,4 @@ recursive true end -include_recipe "php::ini" +include_recipe 'php::ini'