Skip to content

Commit

Permalink
install_ruby? needs to be available outside the namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Arie committed Jan 16, 2013
1 parent 6672fae commit 326cc84
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lib/roundsman/capistrano.rb
Expand Up @@ -84,6 +84,27 @@ def ensure_roundsman_working_dir
end
end

def install_ruby?
installed_version = capture("ruby --version || true").strip
if installed_version.include?("not found")
logger.info "No version of Ruby could be found."
return true
end
required_version = fetch(:ruby_version).gsub("-", "")
if installed_version.include?(required_version)
if fetch(:care_about_ruby_version)
logger.info "Ruby #{installed_version} matches the required version: #{required_version}."
return false
else
logger.info "Already installed Ruby #{installed_version}, not #{required_version}. Set :care_about_ruby_version if you want to fix this."
return false
end
else
logger.info "Ruby version mismatch. Installed version: #{installed_version}, required is #{required_version}"
return true
end
end


namespace :install do

Expand Down Expand Up @@ -147,27 +168,6 @@ def ensure_supported_distro
end
end

def install_ruby?
installed_version = capture("ruby --version || true").strip
if installed_version.include?("not found")
logger.info "No version of Ruby could be found."
return true
end
required_version = fetch(:ruby_version).gsub("-", "")
if installed_version.include?(required_version)
if fetch(:care_about_ruby_version)
logger.info "Ruby #{installed_version} matches the required version: #{required_version}."
return false
else
logger.info "Already installed Ruby #{installed_version}, not #{required_version}. Set :care_about_ruby_version if you want to fix this."
return false
end
else
logger.info "Ruby version mismatch. Installed version: #{installed_version}, required is #{required_version}"
return true
end
end

end

namespace :chef do
Expand Down

0 comments on commit 326cc84

Please sign in to comment.