Class: AvoDeploy::Task::Task
- Inherits:
-
Object
- Object
- AvoDeploy::Task::Task
- Defined in:
- lib/avodeploy/task/task.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#name ⇒ Object
Returns the value of attribute name.
-
#remote_except ⇒ Object
Returns the value of attribute remote_except.
-
#remote_only ⇒ Object
Returns the value of attribute remote_only.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
Class Method Summary collapse
-
.from_task_block(name, options, &block) ⇒ Task
Creates a new task from a task block in the deployment configuration process.
Instance Method Summary collapse
-
#invoke(env, options = {}) ⇒ mixed
Runs the code of a task.
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
26 27 28 |
# File 'lib/avodeploy/task/task.rb', line 26 def block @block end |
#desc ⇒ Object
Returns the value of attribute desc.
27 28 29 |
# File 'lib/avodeploy/task/task.rb', line 27 def desc @desc end |
#name ⇒ Object
Returns the value of attribute name.
23 24 25 |
# File 'lib/avodeploy/task/task.rb', line 23 def name @name end |
#remote_except ⇒ Object
Returns the value of attribute remote_except.
29 30 31 |
# File 'lib/avodeploy/task/task.rb', line 29 def remote_except @remote_except end |
#remote_only ⇒ Object
Returns the value of attribute remote_only.
28 29 30 |
# File 'lib/avodeploy/task/task.rb', line 28 def remote_only @remote_only end |
#scope ⇒ Object
Returns the value of attribute scope.
24 25 26 |
# File 'lib/avodeploy/task/task.rb', line 24 def scope @scope end |
#visibility ⇒ Object
Returns the value of attribute visibility.
25 26 27 |
# File 'lib/avodeploy/task/task.rb', line 25 def visibility @visibility end |
Class Method Details
.from_task_block(name, options, &block) ⇒ Task
Creates a new task from a task block in the deployment configuration process
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/avodeploy/task/task.rb', line 37 def self.from_task_block(name, , &block) instance = self.new instance.name = name instance.block = block instance.scope = :local if .has_key?(:scope) && [:scope] == :remote instance.scope = :remote end instance.visibility = :public if .has_key?(:visibility) && [:visibility] == :private instance.visibility = :private end if .has_key?(:desc) instance.desc = [:desc] end if .has_key?(:only) instance.remote_only = [:only] end if .has_key?(:except) instance.remote_except = [:except] end instance end |
Instance Method Details
#invoke(env, options = {}) ⇒ mixed
Runs the code of a task
75 76 77 78 79 80 81 82 83 |
# File 'lib/avodeploy/task/task.rb', line 75 def invoke(env, = {}) raise ArgumentError 'env must be a valid TaskExecutionEnvironment' unless env.kind_of?(TaskExecutionEnvironment) avo = AvoDeploy::Deployment.instance avo.log.debug "Running task #{@name}" env.instance_eval(&@block) end |