Skip to content

Commit

Permalink
use the :runner variable to determine who to sudo as for deploy:resta…
Browse files Browse the repository at this point in the history
…rt (closes #9212)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@7374 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jamis committed Aug 30, 2007
1 parent 642614e commit db1a850
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN*

* Use the :runner variable to determine who to sudo as for deploy:restart [Graham Ashton]

* Add Namespaces#top to always return a reference to the topmost namespace [Jamis Buck]

* Change the "-h" output so that it does not say that "-q" is the default [Jamis Buck]
Expand Down
16 changes: 10 additions & 6 deletions lib/capistrano/recipes/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,19 @@ def with_env(name, value)

desc <<-DESC
Restarts your application. This works by calling the script/process/reaper \
script under the current path. By default, this will be invoked via sudo, \
but if you are in an environment where sudo is not an option, or is not \
allowed, you can indicate that restarts should use `run' instead by \
setting the `use_sudo' variable to false:
script under the current path.
By default, this will be invoked via sudo as the `app' user. If \
you wish to run it as a different user, set the :runner variable to \
that user. If you are in an environment where you can't use sudo, set \
the :use_sudo variable to false:
set :use_sudo, false
DESC
task :restart, :roles => :app, :except => { :no_release => true } do
invoke_command "#{current_path}/script/process/reaper", :via => run_method
as = fetch(:runner, "app")
via = fetch(:run_method, :sudo)
invoke_command "#{current_path}/script/process/reaper", :via => via, :as => as
end

desc <<-DESC
Expand Down

0 comments on commit db1a850

Please sign in to comment.