Class: Ora::Cli::Task
- Inherits:
-
Object
- Object
- Ora::Cli::Task
- Defined in:
- lib/ora/cli/task.rb
Direct Known Subclasses
DeleteFeatureBranch, NewFeatureBranch, PushFeatureBranch, PushTask, PushToMaster, SwitchBranch
Constant Summary collapse
- DEFAULT_DEVELOP_BRANCH =
'develop'
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#develop_branch ⇒ Object
readonly
Returns the value of attribute develop_branch.
-
#print ⇒ Object
readonly
Returns the value of attribute print.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
Instance Method Summary collapse
- #commands ⇒ Object
-
#initialize(from, inputs: [], print: Print.new, develop_branch: nil) ⇒ Task
constructor
A new instance of Task.
- #run ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(from, inputs: [], print: Print.new, develop_branch: nil) ⇒ Task
Returns a new instance of Task.
13 14 15 16 17 18 19 20 |
# File 'lib/ora/cli/task.rb', line 13 def initialize(from, inputs: [], print: Print.new, develop_branch: nil) @from = from @bash = Bash.new(self, from: @from, print: print) @branch = current_branch @stdin = Stdin.new(bash: @bash, print: print, inputs: inputs) @print = print @develop_branch = develop_branch || DEFAULT_DEVELOP_BRANCH end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
9 10 11 |
# File 'lib/ora/cli/task.rb', line 9 def branch @branch end |
#develop_branch ⇒ Object (readonly)
Returns the value of attribute develop_branch.
9 10 11 |
# File 'lib/ora/cli/task.rb', line 9 def develop_branch @develop_branch end |
#print ⇒ Object (readonly)
Returns the value of attribute print.
9 10 11 |
# File 'lib/ora/cli/task.rb', line 9 def print @print end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
9 10 11 |
# File 'lib/ora/cli/task.rb', line 9 def stdin @stdin end |
Instance Method Details
#commands ⇒ Object
29 30 31 |
# File 'lib/ora/cli/task.rb', line 29 def commands raise PreconditionError, "Override this method in subclass." end |
#run ⇒ Object
22 23 24 25 26 27 |
# File 'lib/ora/cli/task.rb', line 22 def run @bash.run commands save_on_fail rescue PreconditionError => e @print.red("Precondition not met!\n#{e.message}") end |
#success? ⇒ Boolean
33 34 35 |
# File 'lib/ora/cli/task.rb', line 33 def success? @bash.success? end |