Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: RiotGames/chef-php-fpm
base: 78ad7940d1
...
head fork: RiotGames/chef-php-fpm
compare: fef2ef4564
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 2 commit comments
  • 1 contributor
Showing with 33 additions and 10 deletions.
  1. +33 −10 recipes/default.rb
View
43 recipes/default.rb
@@ -18,9 +18,11 @@
# limitations under the License.
#
+centos6 = (node['platform'] == 'centos' && Chef::VersionConstraint.new("~> 6.0").include?(node['platform_version']))
+
case node['platform']
when 'ubuntu'
- if node['platform_version'].to_f <= 10.04
+ if Chef::VersionConstraint.new("<= 10.04").include?(node['platform_version'])
# Configure Nginx PPA
# We'll install php5-fpm from the Nginx PPA backports
apt_repository "nginx-php" do
@@ -36,7 +38,7 @@
# Configure Dotdeb repos
# TODO: move this to it's own 'dotdeb' cookbook?
# http://www.dotdeb.org/instructions/
- if node.platform_version.to_f >= 5.0
+ if Chef::VersionConstraint.new(">= 5.0").include?(node['platform_version'])
apt_repository "dotdeb" do
uri "http://packages.dotdeb.org"
distribution "stable"
@@ -61,18 +63,37 @@
end
end
when 'centos', 'redhat', 'fedora'
- # Configure IUS repo
- # http://rob.olmos.name/2010/08/centos-5-5-php-5-3-3-php-fpm-nginx-rpms/
- # TODO: verify this is the best repo
- yum_repository "ius" do
- url "http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch"
- action :add
+ if centos6
+ # Configure REMI and EPEL
+ # http://www.lifelinux.com/how-to-install-nginx-and-php-fpm-on-centos-6-via-yum/
+ include_recipe "yum::epel"
+
+ yum_key "RPM-GPG-KEY-remi" do
+ url "http://rpms.famillecollet.com/RPM-GPG-KEY-remi"
+ action :add
+ end
+
+ yum_repository "remi" do
+ name "Les RPM de remi pour Enterprise Linux $releasever - $basearch"
+ url "http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror"
+ mirrorlist true
+ key "RPM-GPG-KEY-remi"
+ action :add
+ end
+ else
+ # Configure IUS repo
+ # http://rob.olmos.name/2010/08/centos-5-5-php-5-3-3-php-fpm-nginx-rpms/
+ # TODO: verify this is the best repo
+ yum_repository "ius" do
+ url "http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/$basearch"
+ action :add
+ end
end
end
pkgs = value_for_platform(
%w{ centos redhat fedora } => {
- "default" => %w{ php53u-fpm and php53u-pecl-apc }
+ "default" => %w{ php53u-fpm php53u-pecl-apc }
},
%w{ debian ubuntu } => {
"default" => %w{ php5-cgi php5-fpm }
@@ -80,6 +101,8 @@
"default" => %w{ php5-cgi php5-fpm }
)
+pkgs = %w{php php-fpm php-common php-cli php-pear} if centos6
+
unless platform?(%w{ centos redhat fedora })
# TODO: look into the php53u-*/php53-* conflict
require_recipe 'php::default'
@@ -89,4 +112,4 @@
package pkg do
action :upgrade
end
-end
+end

Showing you all comments on commits in this comparison.

@patcon

nice! was unaware of Chef::VersionConstraint... live and learn :)

@patcon

Not sure if I think it's the best way myself, but just a heads up that libraries are sometimes used for little helper functions like `centos6?:

https://github.com/opscode-cookbooks/mysql/blob/master/recipes/client.rb#L22
https://github.com/opscode-cookbooks/mysql/blob/master/libraries/helpers.rb

Seems like it might be a layer of indirection, but to each their own :)

Something went wrong with that request. Please try again.