Permalink
Browse files

FC009: un-confuse foodcritic with method-scoped variables.

  • Loading branch information...
fnichol committed Nov 12, 2012
1 parent ffa8f0d commit b5313cb5e1ff0784b128e42ca0f0fd164c4ca1e0
Showing with 10 additions and 4 deletions.
  1. +10 −4 libraries/chef_rvm_recipe_helpers.rb
@@ -73,6 +73,10 @@ def install_rvm(opts = {})
exec_env = { 'TERM' => 'dumb' }
end
+ rvm_installed_check = rvm_wrap_cmd(
+ %{type rvm | cat | head -1 | grep -q '^rvm is a function$'}, user_dir
+ ), :environment => exec_env
+
i = execute exec_name do
user opts[:user] || "root"
command "curl -L #{opts[:installer_url]} | bash #{opts[:script_flags]}"
@@ -85,9 +89,7 @@ def install_rvm(opts = {})
action :run
end
- not_if rvm_wrap_cmd(
- %{type rvm | cat | head -1 | grep -q '^rvm is a function$'}, user_dir),
- :environment => exec_env
+ not_if rvm_installed_check
end
i.run_action(:run) if install_now
end
@@ -107,9 +109,13 @@ def upgrade_rvm(opts = {})
exec_env = nil
end
+ upgrade_cmd = rvm_wrap_cmd(
+ %{rvm get #{opts[:upgrade_strategy]}}, user_dir
+ )
+
u = execute exec_name do
user opts[:user] || "root"
- command rvm_wrap_cmd(%{rvm get #{opts[:upgrade_strategy]}}, user_dir)
+ command upgrade_cmd
environment(exec_env)
# excute in compile phase if gem_package recipe is requested

0 comments on commit b5313cb

Please sign in to comment.