Class: Sprinkle::Actors::Capistrano
- Defined in:
- lib/sprinkle/actors/capistrano.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#loaded_recipes ⇒ Object
Returns the value of attribute loaded_recipes.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Capistrano
constructor
A new instance of Capistrano.
- #process(name, commands, roles) ⇒ Object
- #recipes(script) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Capistrano
Returns a new instance of Capistrano.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sprinkle/actors/capistrano.rb', line 8 def initialize(&block) @config = ::Capistrano::Configuration.new @config.logger.level = Sprinkle::OPTIONS[:verbose] ? ::Capistrano::Logger::INFO : ::Capistrano::Logger::IMPORTANT @config.set(:password) { ::Capistrano::CLI.password_prompt } if block self.instance_eval &block else @config.load 'deploy' # normally in the config directory for rails end end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/sprinkle/actors/capistrano.rb', line 6 def config @config end |
#loaded_recipes ⇒ Object
Returns the value of attribute loaded_recipes.
6 7 8 |
# File 'lib/sprinkle/actors/capistrano.rb', line 6 def loaded_recipes @loaded_recipes end |
Instance Method Details
#process(name, commands, roles) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/sprinkle/actors/capistrano.rb', line 25 def process(name, commands, roles) define_task(name, roles) do via = fetch(:run_method, :sudo) commands.each do |command| invoke_command command, :via => via end end run(name) end |
#recipes(script) ⇒ Object
19 20 21 22 23 |
# File 'lib/sprinkle/actors/capistrano.rb', line 19 def recipes(script) @loaded_recipes ||= [] @config.load script @loaded_recipes << script end |