add some things
This commit is contained in:
parent
c1f1539cb6
commit
956e1fcfe3
@ -13,6 +13,24 @@ Capistrano::Configuration.instance.load do
|
||||
ENV['HOST'] || find_servers_for_task(current_task).first
|
||||
end
|
||||
|
||||
def switch_user(new_user)
|
||||
old_user = user
|
||||
set :user, new_user
|
||||
close_sessions
|
||||
yield
|
||||
set :user, old_user
|
||||
close_sessions
|
||||
end
|
||||
|
||||
def close_sessions
|
||||
sessions.values.each { |session| session.close }
|
||||
sessions.clear
|
||||
end
|
||||
|
||||
def rake(cmd, env = {})
|
||||
run "cd #{latest_release} && RAILS_ENV=#{rails_env} #{env.collect { |k, v| "#{k}=#{v}" }.join(' ')} bundle exec rake #{cmd}"
|
||||
end
|
||||
|
||||
Dir[File.expand_path('../cap-pack/recipes/**/*.rb', __FILE__)].each { |f| load f }
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user