Class: Cape::RecipeDefinition
- Inherits:
-
Object
- Object
- Cape::RecipeDefinition
- Defined in:
- lib/cape/recipe_definition.rb
Overview
Determines how a Capistrano recipe will be defined.
Direct Known Subclasses
Instance Method Summary collapse
-
#cd(path = nil, &block) ⇒ Object
The remote directory from which Rake tasks will be executed.
-
#env ⇒ HashList
A hash of remote environment variables.
-
#options ⇒ HashList
A hash of Capistrano recipe options to pass to the Capistrano
task
method. -
#rename(&block) ⇒ Object
How Rake tasks will be named when they are mirrored as Capistrano recipes.
Instance Method Details
#cd ⇒ String, Proc #cd(path) ⇒ String, Proc #cd(&block) ⇒ String, Proc
The remote directory from which Rake tasks will be executed.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cape/recipe_definition.rb', line 33 def cd(path=nil, &block) if (cd = (path || block)) if cd.respond_to?(:arity) case cd.arity when -1 # Lambda: good when 0 # Good else raise ::ArgumentError, "Must have 0 parameters but has #{cd.arity}" end end @cd = cd else @cd end end |
#env ⇒ HashList
A hash of remote environment variables.
55 56 57 |
# File 'lib/cape/recipe_definition.rb', line 55 def env @env ||= HashList.new end |
#options ⇒ HashList
A hash of Capistrano recipe options to pass to the Capistrano task
method.
65 66 67 |
# File 'lib/cape/recipe_definition.rb', line 65 def @options ||= HashList.new end |
#rename ⇒ Proc #rename {|task_name| ... } ⇒ Proc
How Rake tasks will be named when they are mirrored as Capistrano recipes.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cape/recipe_definition.rb', line 89 def rename(&block) if block unless (block.arity == 1) raise ::ArgumentError, "Must have 1 parameter but has #{block.arity}" end @rename = block else @rename end end |