Sha256: 0e298306ada88c5aa38dc163b5f4c75519cf23eba10454b5e539e331851575f6

Contents?: true

Size: 1.51 KB

Versions: 27

Compression:

Stored size: 1.51 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
    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[:verify].update
	self[:publish].update
  end

  def execute_command command
    print " " + Color.green + command + Color.clear

	timer=Timer.new
	if command.include?('<%') && command.include?('%>')
	  ruby = command.gsub("<%","").gsub("%>","")
      eval(ruby)
	  puts " " + timer.elapsed_str
    else
		out = `#{command}`
		if $? != 0
		  puts out
		  raise Color.yellow + "`" + Color.green + command + Color.yellow + "`" + Color.clear + 
			  " has exit code " + $?.to_s  + " " + out
		else
		  puts " " + timer.elapsed_str
		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

27 entries across 27 versions & 1 rubygems

Version Path
dev_tasks-0.0.141 lib/commands.rb
dev_tasks-0.0.140 lib/commands.rb
dev_tasks-0.0.139 lib/commands.rb
dev_tasks-0.0.138 lib/commands.rb
dev_tasks-0.0.137 lib/commands.rb
dev_tasks-0.0.136 lib/commands.rb
dev_tasks-0.0.135 lib/commands.rb
dev_tasks-0.0.134 lib/commands.rb
dev_tasks-0.0.133 lib/commands.rb
dev_tasks-0.0.132 lib/commands.rb
dev_tasks-0.0.131 lib/commands.rb
dev_tasks-0.0.130 lib/commands.rb
dev_tasks-0.0.129 lib/commands.rb
dev_tasks-0.0.128 lib/commands.rb
dev_tasks-0.0.127 lib/commands.rb
dev_tasks-0.0.126 lib/commands.rb
dev_tasks-0.0.125 lib/commands.rb
dev_tasks-0.0.124 lib/commands.rb
dev_tasks-0.0.123 lib/commands.rb
dev_tasks-0.0.122 lib/commands.rb