Browse files

Use Chef::VersionConstraint instead of string compares

  • Loading branch information...
1 parent 78ad794 commit 0c0bacf70a960bd383ab5d9c8d2509411a7f277e @ivey ivey committed Apr 16, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 recipes/default.rb
View
4 recipes/default.rb
@@ -20,7 +20,7 @@
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 +36,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"

1 comment on commit 0c0bacf

@patcon

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

Please sign in to comment.