Skip to content

Instantly share code, notes, and snippets.

@mattmeng
Last active May 6, 2016 16:02
Show Gist options
  • Select an option

  • Save mattmeng/93be437333eae292def1df15aa4a78fb to your computer and use it in GitHub Desktop.

Select an option

Save mattmeng/93be437333eae292def1df15aa4a78fb to your computer and use it in GitHub Desktop.
set :rbenv_ruby, '2.3.0'
set :bundle_binstubs, shared_path.join( 'bundle/bin' )
namespace :rbenv do
before :validate, :install_rbenv do
on roles( :flashpoint_server ) do
unless test( "[ -d $HOME/.rbenv ]" )
# Install rbenv
execute( :git, :clone, "https://github.com/rbenv/rbenv.git", "$HOME/.rbenv" )
execute( "cd $HOME/.rbenv/ && src/configure && make -C src" )
execute( :echo, "'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> $HOME/.bash_profile" )
execute( :echo, "'eval \"$(rbenv init -)\"' >> $HOME/.bash_profile" )
# Install rbenv install plugin
execute( :git, :clone, "https://github.com/rbenv/ruby-build.git", "$HOME/.rbenv/plugins/ruby-build" )
execute( :git, :clone, "https://github.com/sstephenson/rbenv-gem-rehash.git", "$HOME/.rbenv/plugins/rbenv-gem-rehash" )
# Install ruby version
execute( :rbenv, :install, fetch( :rbenv_ruby ) )
execute( :rbenv, :global, fetch( :rbenv_ruby ) )
# Install bundler
execute( :gem, :install, :bundler )
execute( :git, :clone, "https://github.com/ianheggie/rbenv-binstubs.git", "$HOME/.rbenv/plugins/rbenv-binstubs" )
end
end
end
end
namespace :bundle do
after :install, :rehash do
on roles( :flashpoint_server ) do
execute( :rbenv, :rehash )
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment