Sha256: 31009289615728b5ed68027f18fbe307109d366d6a63f2886292f0294269d30c

Contents?: true

Size: 934 Bytes

Versions: 12

Compression:

Stored size: 934 Bytes

Contents

require_relative './build.rb'
require_relative './test.rb'
require_relative './add.rb'
require_relative './commit.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
  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

12 entries across 12 versions & 1 rubygems

Version Path
dev_tasks-0.0.19 lib/commands.rb
dev_tasks-0.0.18 lib/commands.rb
dev_tasks-0.0.17 lib/commands.rb
dev_tasks-0.0.16 lib/commands.rb
dev_tasks-0.0.15 lib/commands.rb
dev_tasks-0.0.14 lib/commands.rb
dev_tasks-0.0.13 lib/commands.rb
dev_tasks-0.0.12 lib/commands.rb
dev_tasks-0.0.11 lib/commands.rb
dev_tasks-0.0.10 lib/commands.rb
dev_tasks-0.0.9 lib/commands.rb
dev_tasks-0.0.8 lib/commands.rb