Permalink
Browse files

Fix broken default_use implementation in rvm_system_ruby

Using rvm --default use 1.9.2 no longer works in scripting mode.  We use
rvm alias create default instead.

Also fix a bug that prevents the default from being set when fist
installing a ruby version.

References #30.
  • Loading branch information...
blt04 committed Jan 21, 2012
1 parent f3a6e33 commit 11447dd8abf6a39e7e92341e1b5191993f7025a0
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb
@@ -5,6 +5,7 @@
def create
rvmcmd "install", resource[:name]
+ set_default if resource.value(:default_use)
end
def destroy
@@ -24,7 +25,7 @@ def exists?
def default_use
begin
- rvmcmd("list", "default", "string").split("\n").any? do |line|
+ rvmcmd("list", "default").split("\n").any? do |line|
line =~ Regexp.new(Regexp.escape(resource[:name]))
end
rescue Puppet::ExecutionFailure => detail
@@ -33,6 +34,10 @@ def default_use
end
def default_use=(value)
- rvmcmd "--default", "use", resource[:name] if value
+ set_default if value
+ end
+
+ def set_default
+ rvmcmd "alias", "create", "default", resource[:name]
end
end

0 comments on commit 11447dd

Please sign in to comment.