Sha256: e6bc2234d9b6d8045b4f57f6af39e18d3b795f5d6f5f4b26359e11b1a17dc082

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

require_relative './build.rb'
require_relative './test.rb'
require_relative './add.rb'
require_relative './commit.rb'
require_relative './publish.rb'
require_relative './upgrade.rb'

class Commands < Hash
  attr_accessor :build

  def initialize
    self["build"] = Build.new
	self["test"] = Test.new
	self["add"] = Add.new
	self["commit"] = Commit.new
	self["publish"] = Publish.new
	self["upgrade"] = Upgrade.new
  end

  def execute_command command
    puts Color.yellow + command + Color.clear
    puts " "

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

13 entries across 13 versions & 1 rubygems

Version Path
dev_tasks-0.0.35 lib/commands.rb
dev_tasks-0.0.34 lib/commands.rb
dev_tasks-0.0.33 lib/commands.rb
dev_tasks-0.0.32 lib/commands.rb
dev_tasks-0.0.31 lib/commands.rb
dev_tasks-0.0.30 lib/commands.rb
dev_tasks-0.0.29 lib/commands.rb
dev_tasks-0.0.28 lib/commands.rb
dev_tasks-0.0.27 lib/commands.rb
dev_tasks-0.0.26 lib/commands.rb
dev_tasks-0.0.25 lib/commands.rb
dev_tasks-0.0.24 lib/commands.rb
dev_tasks-0.0.23 lib/commands.rb