Skip to content

Commit

Permalink
Merge pull request vmware-archive#17 from nixterrimus/master
Browse files Browse the repository at this point in the history
rbenv
  • Loading branch information
cunnie committed Oct 27, 2011
2 parents aeabb6c + 5854e4b commit 7a140fb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions attributes/rbenv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node.default["rbenv"]= {
"rubies" => {
"ree-1.8.7-2011.03" => "",
"1.8.7-p352" => "",
"1.9.2-p290" => ""
},
"default_ruby" => "ree-1.8.7-2011.03"
}
23 changes: 23 additions & 0 deletions libraries/rbenv_ruby_install.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Chef::Recipe
def rbenv_ruby_install(ruby_version, env_override)
include_recipe "pivotal_workstation::rbenv"

#don't use the marker file system for this. we guess that people are likely to be installing rubies by hand using rbenv.
#...that guess might be wrong.
unless File.exists?("#{::RBENV_HOME}/#{ruby_version}/bin/ruby")

install_cmd = "#{env_override} #{RBENV_COMMAND} install #{ruby_version}"

execute "installing #{ruby_version} with RBENV: #{install_cmd}" do
command install_cmd
user WS_USER
end

execute "check #{ruby_version}" do
command "#{RBENV_COMMAND} versions | grep #{ruby_version}"
user WS_USER
end

end
end
end
22 changes: 22 additions & 0 deletions recipes/rbenv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include_recipe "pivotal_workstation::bash_profile"
include_recipe "pivotal_workstation::git"

::RBENV_HOME = "#{WS_HOME}/.rbenv"
::RBENV_COMMAND = "/usr/local/bin/rbenv"


brew_install("rbenv")
brew_install("ruby-build")

bash_profile_include("rbenv")

node["rbenv"]["rubies"].each do |ruby_version_string, env_override|
rbenv_ruby_install(ruby_version_string,env_override)
end

if node["rbenv"]["default_ruby"]
execute "making #{node["rbenv"]["default_ruby"]} with rbenv the default" do
command "rbenv global #{node["rbenv"]["default_ruby"]}"
user WS_USER
end
end
2 changes: 2 additions & 0 deletions templates/default/bash_profile-rbenv.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eval "$(rbenv init -)"
export PATH=$PATH:~/.rbenv/shims

0 comments on commit 7a140fb

Please sign in to comment.