Permalink
Browse files

add 'install_options' attributes to recipe and LWRP

  • Loading branch information...
1 parent c2e24ea commit 4631d01340cc38871a1c790e01df688e79cd87ef @xdg xdg committed Jan 6, 2012
View
1 cookbooks/perlbrew/README.md
@@ -24,6 +24,7 @@ Attributes
* `node['perlbrew']['perlbrew_root'] = "/opt/perlbrew"` - Sets the `PERLBREW_ROOT` environment variable
* `node['perlbrew']['perls'] = []` - An array of perls to install, e.g. `["perl-5.14.2", "perl-5.12.3"]`
+* `node['perlbrew']['install_options'] = ''` - A string of command line options for `perlbrew install`, e.g. `-D usethreads` for building all perls with threads
Recipes
=======
View
5 cookbooks/perlbrew/attributes/default.rb
@@ -18,6 +18,11 @@
# limitations under the License.
#
+# sets PERLBREW_ROOT
default['perlbrew']['perlbrew_root'] = '/opt/perlbrew'
+# list of perls to install in perlbrew recipe, e.g. ["perl-5.14.2", ...]
default['perlbrew']['perls'] = []
+# default command line options for "perlbrew install" if no LWRP options
+# attribute is given
+default['perlbrew']['install_options'] = ''
View
3 cookbooks/perlbrew/providers/perl.rb
@@ -25,9 +25,10 @@
action :install do
unless @perl.installed
new_resource.version(new_resource.name) if not new_resource.version
+ new_resource.install_options(node['perlbrew']['install_options']) if not new_resource.install_options
execute "Install perlbrew perl #{new_resource.name}" do
environment ({'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root']})
- command "#{node['perlbrew']['perlbrew_root']}/bin/perlbrew install #{new_resource.version} --as #{new_resource.name}"
+ command "#{node['perlbrew']['perlbrew_root']}/bin/perlbrew install #{new_resource.version} --as #{new_resource.name} #{new_resource.install_options}"
end
new_resource.updated_by_last_action(true)
end
View
1 cookbooks/perlbrew/resources/perl.rb
@@ -21,4 +21,5 @@
actions :install, :remove
attribute :version, :kind_of => String
+attribute :install_options, :kind_of => String
attribute :installed, :default => false

0 comments on commit 4631d01

Please sign in to comment.