Class: Commands

Inherits:
Hash
  • Object
show all
Defined in:
lib/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommands

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

#buildObject

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

#showObject



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

#updateObject



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