Class: Commands
- Inherits:
-
Hash
- Object
- Hash
- Commands
- Defined in:
- lib/commands.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
Returns the value of attribute build.
Instance Method Summary collapse
- #execute_task(task) ⇒ Object
-
#initialize ⇒ Commands
constructor
A new instance of Commands.
- #show ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ Commands
Returns a new instance of Commands.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/commands.rb', line 16 def initialize self[:pull] = Pull.new if(Environment.scm=='git' && Environment.scm_origin.length > 0) self[:upgrade] = Upgrade.new self[:setup] = Setup.new self[:build] = Build.new self[:test] = Test.new self[:add] = Add.new self[:commit] = Commit.new self[:push] = Push.new self[:verify] = Verify.new self[:publish] = Publish.new end |
Instance Attribute Details
#build ⇒ Object
Returns the value of attribute build.
14 15 16 |
# File 'lib/commands.rb', line 14 def build @build end |
Instance Method Details
#execute_task(task) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/commands.rb', line 37 def execute_task task sym_task = task.to_sym if(self.has_key?(sym_task)) self[sym_task].update if self[sym_task].respond_to?(:update) if(self[sym_task].length>0) Logger.start_task task self[sym_task].execute Logger.end_task task else self.delete sym_task end end end |
#show ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/commands.rb', line 52 def show self.each do |key,array| if(array.length > 0) puts key array.each {|v| puts " " + Color.green + v + Color.clear + " " } end end puts " " end |
#update ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/commands.rb', line 29 def update self[:upgrade].update self[:setup].update self[:build].update self[:verify].update self[:publish].update end |