Class: AsProject::EnvTask
- Inherits:
-
Object
- Object
- AsProject::EnvTask
- Defined in:
- lib/tasks/env_task.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :env_task) {|_self| ... } ⇒ EnvTask
constructor
A new instance of EnvTask.
- #target_not_found ⇒ Object
Constructor Details
#initialize(name = :env_task) {|_self| ... } ⇒ EnvTask
Returns a new instance of EnvTask.
9 10 11 12 13 |
# File 'lib/tasks/env_task.rb', line 9 def initialize(name=:env_task) @name = name yield self if block_given? define end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/tasks/env_task.rb', line 6 def name @name end |
#target ⇒ Object
Returns the value of attribute target.
6 7 8 |
# File 'lib/tasks/env_task.rb', line 6 def target @target end |
Instance Method Details
#define ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tasks/env_task.rb', line 15 def define if(target.nil?) raise EnvTaskError.new('EnvTask requires a task target to execute') end begin sh(target) rescue NoMethodError => e target_not_found rescue RuntimeError => e end end |
#target_not_found ⇒ Object
27 28 29 |
# File 'lib/tasks/env_task.rb', line 27 def target_not_found raise EnvTaskError.new("EnvTask was unable to find the target: #{target}") end |