Sha256: f6de43b3c496e0e524d4532db644d8b491dda84db53e148cf9dd72b5f55955e1

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require_relative './build.rb'
require_relative './test.rb'
require_relative './add.rb'
require_relative './commit.rb'
require_relative './publish.rb'
require_relative './pull.rb'
require_relative './push.rb'
require_relative './setup.rb'
require_relative './upgrade.rb'
require_relative './timer.rb'
require_relative './verify.rb'

class Commands < Hash
  attr_accessor :build

  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

  def update
    self[:upgrade].update
	self[:setup].update
	self[:build].update
	self[:verify].update
	self[:publish].update
  end

  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


  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dev_tasks-1.0.37 lib/commands.rb
dev_tasks-1.0.35 lib/commands.rb
dev_tasks-1.0.34 lib/commands.rb
dev_tasks-1.0.33 lib/commands.rb
dev_tasks-1.0.31 lib/commands.rb
dev_tasks-1.0.30 lib/commands.rb