lib/chef/sugar/platform.rb in chef-sugar-2.5.0 vs lib/chef/sugar/platform.rb in chef-sugar-3.0.0

- old
+ new

@@ -1,7 +1,7 @@ # -# Copyright 2013-2014, Seth Vargo <sethvargo@gmail.com> +# Copyright 2013-2015, Seth Vargo <sethvargo@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # @@ -37,10 +37,17 @@ 'lion' => '10.7', 'mountain_lion' => '10.8', 'mavericks' => '10.9', 'yosemite' => '10.10', }, + 'solaris' => { + '7' => '5.7', + '8' => '5.8', + '9' => '5.9', + '10' => '5.10', + '11' => '5.11', + }, 'ubuntu' => { 'lucid' => '10.04', 'maverick' => '10.10', 'natty' => '11.04', 'oneiric' => '11.10', @@ -72,11 +79,12 @@ # off of what was given to us in the list. length = version.split('.').size check = node['platform_version'].split('.')[0...length].join('.') # Calling #to_f will ensure we only check major versions since - # '10.04.4'.to_f #=> 10.04. - node['platform'] == platform && block.call(check.to_f, version.to_f) + # '10.04.4'.to_f #=> 10.04. We also use a regex to match on + # platform so things like `solaris2` match on `solaris`. + node['platform'] =~ %r(^#{platform}) && block.call(check.to_f, version.to_f) end end end end