Skip to content

Commit

Permalink
New property specifying username for user rbenv installs
Browse files Browse the repository at this point in the history
* No longer can use path expansion within ENV since SSHKit quotes all
values as of capistrano/sshkit#250
* Only requires property be set if the install type is :user
  • Loading branch information
Chad Shaffer committed Aug 11, 2015
1 parent 6f1216c commit 0850f3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ And then execute:

# config/deploy.rb
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_user, 'username' # specify which user if rbenv_type is :user
set :rbenv_ruby, '2.0.0-p247'

# in case you want to set ruby version from the file:
Expand Down
11 changes: 10 additions & 1 deletion lib/capistrano/tasks/rbenv.rake
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ Capistrano::DSL.stages.each do |stage|
after stage, 'rbenv:map_bins'
end

module Capistrano
class RbenvError < StandardError
end
end

namespace :load do
task :defaults do
set :rbenv_path, -> {
rbenv_path = fetch(:rbenv_custom_path)
rbenv_path ||= if fetch(:rbenv_type, :user) == :system
"/usr/local/rbenv"
else
"~/.rbenv"
rbenv_user = fetch(:rbenv_user)
if rbenv_user.nil?
fail Capistrano::RbenvError, "rbenv: rbenv_user is not set"
end
"/home/#{rbenv_user}/.rbenv"
end
}

Expand Down

0 comments on commit 0850f3d

Please sign in to comment.