Skip to content

Commit

Permalink
add 'install_options' attributes to recipe and LWRP
Browse files Browse the repository at this point in the history
  • Loading branch information
xdg committed Jan 6, 2012
1 parent c2e24ea commit 4631d01
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions cookbooks/perlbrew/README.md
Expand Up @@ -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
=======
Expand Down
5 changes: 5 additions & 0 deletions cookbooks/perlbrew/attributes/default.rb
Expand Up @@ -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'] = ''

3 changes: 2 additions & 1 deletion cookbooks/perlbrew/providers/perl.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cookbooks/perlbrew/resources/perl.rb
Expand Up @@ -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.