Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minimal perlbrew_lib provider working

  • Loading branch information...
commit 7bfbe2001d8e96dc26c71f180800288fd66975f5 1 parent a1f9da6
@dagolden authored
View
22 cookbooks/perlbrew/providers/lib.rb
@@ -1,7 +1,7 @@
#
# Author:: David A. Golden
# Cookbook Name:: perlbrew
-# Provider:: perlbrew_perl
+# Provider:: perlbrew_lib
#
# Copyright:: 2012, David A. Golden <dagolden@cpan.org>
#
@@ -22,22 +22,28 @@
require 'chef/mixin/language'
include Chef::Mixin::ShellOut
+# XXX must be a fully qualified 'perl-5.X.Y@libname' style name
action :create do
- unless @perl.created
+ unless @lib.created
execute "Create perlbrew lib #{new_resource.name}" do
- environment ({'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root']})
- environment ({'PERLBREW_HOME' => node['perlbrew']['perlbrew_root']})
+ environment ({
+ 'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root'],
+ 'PERLBREW_HOME' => node['perlbrew']['perlbrew_root']
+ })
command "#{node['perlbrew']['perlbrew_root']}/bin/perlbrew lib create #{new_resource.name}"
end
new_resource.updated_by_last_action(true)
end
end
+# XXX must be a fully qualified 'perl-5.X.Y@libname' style name
action :delete do
- if @perl.installed
+ if @lib.created
execute "Remove perlbrew #{new_resource.name}" do
- environment ({'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root']})
- environment ({'PERLBREW_HOME' => node['perlbrew']['perlbrew_root']})
+ environment ({
+ 'PERLBREW_ROOT' => node['perlbrew']['perlbrew_root'],
+ 'PERLBREW_HOME' => node['perlbrew']['perlbrew_root']
+ })
command "#{node['perlbrew']['perlbrew_root']}/bin/perlbrew lib delete #{new_resource.name}"
end
new_resource.updated_by_last_action(true)
@@ -46,6 +52,6 @@
def load_current_resource
@lib = Chef::Resource::PerlbrewLib.new(new_resource.name)
- @perl.created(::File.exists?("#{node['perlbrew']['perlbrew_root']}/perls/#{@perl.name}"))
+ @lib.created(::File.exists?("#{node['perlbrew']['perlbrew_root']}/libs/#{@lib.name}"))
end
View
2  cookbooks/perlbrew/resources/lib.rb
@@ -1,7 +1,7 @@
#
# Author:: David A. Golden
# Cookbook Name:: perlbrew
-# Resource:: perlbrew_perl
+# Resource:: perlbrew_lib
#
# Copyright:: 2012, David A. Golden <dagolden@cpan.org>
#
Please sign in to comment.
Something went wrong with that request. Please try again.