Skip to content

Instantly share code, notes, and snippets.

@troyready
Created March 24, 2015 21:53
Show Gist options
  • Save troyready/8481b641d98ec37f9efb to your computer and use it in GitHub Desktop.
Save troyready/8481b641d98ec37f9efb to your computer and use it in GitHub Desktop.
chef-client 12.1 rbenv gem chef client recipe
include_recipe 'ruby_build'
include_recipe 'rbenv::user_install'
# Setup rbenv for app owner
git_url = node['rbenv']['git_url']
git_ref = node['rbenv']['git_ref']
home_dir = "/home/#{params[:owner]}"
rbenv_prefix = ::File.join(home_dir, '.rbenv')
install_or_upgrade_rbenv :rbenv_prefix => rbenv_prefix,
:home_dir => home_dir,
:git_url => git_url,
:git_ref => git_ref,
:upgrade_strategy => nil,
:user => params[:owner],
:group => params[:owner]
# Install ruby & gems for app owner
rbenv_ruby "#{params[:ruby_ver]} (#{params[:owner]})" do
definition params[:ruby_ver]
user params[:owner]
end
rbenv_global "#{params[:ruby_ver]} (#{params[:owner]})" do
rbenv_version params[:ruby_ver]
user params[:owner]
end
['bundler', 'rake'].each do |gem|
rbenv_gem "#{gem} (#{params[:owner]})" do
package_name gem
user params[:owner]
rbenv_version params[:ruby_ver]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment