Top Level Namespace
Defined Under Namespace
Modules: Capistrano
Instance Method Summary collapse
- #_cset(name, *args, &block) ⇒ Object
-
#depend(location, type, *args) ⇒ Object
Auxiliary helper method for the ‘deploy:check’ task.
-
#try_sudo(command) ⇒ Object
If :run_method is :sudo (or :use_sudo is true), this executes the given command via
sudo
. -
#with_env(name, value) ⇒ Object
Temporarily sets an environment variable, yields to a block, and restores the value when it is done.
Instance Method Details
#_cset(name, *args, &block) ⇒ Object
5 6 7 8 9 |
# File 'lib/capistrano/recipes/deploy.rb', line 5 def _cset(name, *args, &block) unless exists?(name) set(name, *args, &block) end end |
#depend(location, type, *args) ⇒ Object
Auxiliary helper method for the ‘deploy:check’ task. Lets you set up your own dependencies.
75 76 77 78 79 80 81 |
# File 'lib/capistrano/recipes/deploy.rb', line 75 def depend(location, type, *args) deps = fetch(:dependencies, {}) deps[location] ||= {} deps[location][type] ||= [] deps[location][type] << args set :dependencies, deps end |
#try_sudo(command) ⇒ Object
If :run_method is :sudo (or :use_sudo is true), this executes the given command via sudo
. Otherwise is uses run
. Further, if sudo is being used and :runner is set, the command will be executed as the user given by :runner.
95 96 97 98 99 |
# File 'lib/capistrano/recipes/deploy.rb', line 95 def try_sudo(command) as = fetch(:runner, "app") via = fetch(:run_method, :sudo) invoke_command(command, :via => via, :as => as) end |
#with_env(name, value) ⇒ Object
Temporarily sets an environment variable, yields to a block, and restores the value when it is done.
85 86 87 88 89 90 |
# File 'lib/capistrano/recipes/deploy.rb', line 85 def with_env(name, value) saved, ENV[name] = ENV[name], value yield ensure ENV[name] = saved end |