dev_tasks 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/lib/command.rb +58 -58
 - data/lib/environment.rb +15 -8
 - data/lib/htmllog.rb +52 -52
 - data/lib/jsonlog.rb +17 -17
 - data/lib/logger.rb +36 -36
 - data/lib/spec.json +1 -1
 - data/lib/yamllog.rb +17 -17
 - data/spec/command_spec.rb +79 -79
 - data/spec/test_data/ruby_projects/helloGem/rakefile.rb +2 -2
 - metadata +16 -28
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b4e0be21881e11a4234b974f6a43d52ab83f6ab4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c6b929f79f15f6933648a6c85ebd4d7c19ad0e78
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f90c38d0e9addf53d3d8e826af774a88709853c2f1b2af3bb1697b8cf46012b5a068f36ddd05e229266f99b1b94925ea9badfa14ff22adbb8c23660869613911
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a86f59dac99dca8e43a10db9a7c811115759be7d6de7f3c488e721524ebe3e219e3677ad6daf9d4b03cb47a106e2698518ac32a40f1729650171b1f89c04dcd7
         
     | 
    
        data/lib/command.rb
    CHANGED
    
    | 
         @@ -1,59 +1,59 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            class Command < Hash
         
     | 
| 
       2 
     | 
    
         
            -
            	def initialize command
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            		if(command.kind_of?(String))
         
     | 
| 
       5 
     | 
    
         
            -
            		  self[:input] = command
         
     | 
| 
       6 
     | 
    
         
            -
            		  self[:timeout] = 0
         
     | 
| 
       7 
     | 
    
         
            -
            		  self[:directory] = ''
         
     | 
| 
       8 
     | 
    
         
            -
            		  self[:exit_code] = 0
         
     | 
| 
       9 
     | 
    
         
            -
            		  self[:output] = ''
         
     | 
| 
       10 
     | 
    
         
            -
            		  self[:error] = ''
         
     | 
| 
       11 
     | 
    
         
            -
            		  self[:machine_name] = ''
         
     | 
| 
       12 
     | 
    
         
            -
            		  self[:user_name] = ''
         
     | 
| 
       13 
     | 
    
         
            -
            		  self[:start_time] = nil
         
     | 
| 
       14 
     | 
    
         
            -
            		  self[:end_time] = nil
         
     | 
| 
       15 
     | 
    
         
            -
                    end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                    if(command.kind_of?(Hash))
         
     | 
| 
       18 
     | 
    
         
            -
                    	command.each{|k,v|
         
     | 
| 
       19 
     | 
    
         
            -
                    		self[k.to_sym]=v
         
     | 
| 
       20 
     | 
    
         
            -
                    	}
         
     | 
| 
       21 
     | 
    
         
            -
                    end
         
     | 
| 
       22 
     | 
    
         
            -
            	end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            	def execute
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            		Logger.start_command self
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            		pwd=Dir.pwd
         
     | 
| 
       29 
     | 
    
         
            -
            		Dir.chdir(self[:directory]) if(self.has_key?(:directory) && File.exists?(self[:directory]))
         
     | 
| 
       30 
     | 
    
         
            -
            		#print " " + Color.green + self[:input] + Color.clear
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            		self[:start_time]=Time.now
         
     | 
| 
       33 
     | 
    
         
            -
            		timer=Timer.new
         
     | 
| 
       34 
     | 
    
         
            -
            		if self[:input].include?('<%') && self[:input].include?('%>')
         
     | 
| 
       35 
     | 
    
         
            -
            		  ruby = self[:input].gsub("<%","").gsub("%>","")
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            		  begin
         
     | 
| 
       38 
     | 
    
         
            -
            		  	puts "eval(#{ruby})"
         
     | 
| 
       39 
     | 
    
         
            -
            		    self[:output]=eval(ruby)
         
     | 
| 
       40 
     | 
    
         
            -
            		  rescue
         
     | 
| 
       41 
     | 
    
         
            -
            		  	puts "unable to eval(#{ruby})"
         
     | 
| 
       42 
     | 
    
         
            -
            		  	raise "unable to eval(#{ruby})"
         
     | 
| 
       43 
     | 
    
         
            -
            		  end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            		  #puts " " + timer.elapsed_str
         
     | 
| 
       46 
     | 
    
         
            -
            		  self[:elapsed] = timer.elapsed_str
         
     | 
| 
       47 
     | 
    
         
            -
            		  self[:end_time] = Time.now
         
     | 
| 
       48 
     | 
    
         
            -
            		else
         
     | 
| 
       49 
     | 
    
         
            -
            			self[:output] = `#{self[:input]}`
         
     | 
| 
       50 
     | 
    
         
            -
            			self[:elapsed] = timer.elapsed_str
         
     | 
| 
       51 
     | 
    
         
            -
            			self[:end_time] = Time.now
         
     | 
| 
       52 
     | 
    
         
            -
            			self[:exit_code]=$?.to_i
         
     | 
| 
       53 
     | 
    
         
            -
            		end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                    Dir.chdir(pwd) if pwd != Dir.pwd
         
     | 
| 
       56 
     | 
    
         
            -
            		Logger.end_command self
         
     | 
| 
       57 
     | 
    
         
            -
            	end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            class Command < Hash
         
     | 
| 
      
 2 
     | 
    
         
            +
            	def initialize command
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            		if(command.kind_of?(String))
         
     | 
| 
      
 5 
     | 
    
         
            +
            		  self[:input] = command
         
     | 
| 
      
 6 
     | 
    
         
            +
            		  self[:timeout] = 0
         
     | 
| 
      
 7 
     | 
    
         
            +
            		  self[:directory] = ''
         
     | 
| 
      
 8 
     | 
    
         
            +
            		  self[:exit_code] = 0
         
     | 
| 
      
 9 
     | 
    
         
            +
            		  self[:output] = ''
         
     | 
| 
      
 10 
     | 
    
         
            +
            		  self[:error] = ''
         
     | 
| 
      
 11 
     | 
    
         
            +
            		  self[:machine_name] = ''
         
     | 
| 
      
 12 
     | 
    
         
            +
            		  self[:user_name] = ''
         
     | 
| 
      
 13 
     | 
    
         
            +
            		  self[:start_time] = nil
         
     | 
| 
      
 14 
     | 
    
         
            +
            		  self[:end_time] = nil
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    if(command.kind_of?(Hash))
         
     | 
| 
      
 18 
     | 
    
         
            +
                    	command.each{|k,v|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    		self[k.to_sym]=v
         
     | 
| 
      
 20 
     | 
    
         
            +
                    	}
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
            	end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            	def execute
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            		Logger.start_command self
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            		pwd=Dir.pwd
         
     | 
| 
      
 29 
     | 
    
         
            +
            		Dir.chdir(self[:directory]) if(self.has_key?(:directory) && File.exists?(self[:directory]))
         
     | 
| 
      
 30 
     | 
    
         
            +
            		#print " " + Color.green + self[:input] + Color.clear
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            		self[:start_time]=Time.now
         
     | 
| 
      
 33 
     | 
    
         
            +
            		timer=Timer.new
         
     | 
| 
      
 34 
     | 
    
         
            +
            		if self[:input].include?('<%') && self[:input].include?('%>')
         
     | 
| 
      
 35 
     | 
    
         
            +
            		  ruby = self[:input].gsub("<%","").gsub("%>","")
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            		  begin
         
     | 
| 
      
 38 
     | 
    
         
            +
            		  	puts "eval(#{ruby})"
         
     | 
| 
      
 39 
     | 
    
         
            +
            		    self[:output]=eval(ruby)
         
     | 
| 
      
 40 
     | 
    
         
            +
            		  rescue
         
     | 
| 
      
 41 
     | 
    
         
            +
            		  	puts "unable to eval(#{ruby})"
         
     | 
| 
      
 42 
     | 
    
         
            +
            		  	raise "unable to eval(#{ruby})"
         
     | 
| 
      
 43 
     | 
    
         
            +
            		  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            		  #puts " " + timer.elapsed_str
         
     | 
| 
      
 46 
     | 
    
         
            +
            		  self[:elapsed] = timer.elapsed_str
         
     | 
| 
      
 47 
     | 
    
         
            +
            		  self[:end_time] = Time.now
         
     | 
| 
      
 48 
     | 
    
         
            +
            		else
         
     | 
| 
      
 49 
     | 
    
         
            +
            			self[:output] = `#{self[:input]}`
         
     | 
| 
      
 50 
     | 
    
         
            +
            			self[:elapsed] = timer.elapsed_str
         
     | 
| 
      
 51 
     | 
    
         
            +
            			self[:end_time] = Time.now
         
     | 
| 
      
 52 
     | 
    
         
            +
            			self[:exit_code]=$?.to_i
         
     | 
| 
      
 53 
     | 
    
         
            +
            		end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    Dir.chdir(pwd) if pwd != Dir.pwd
         
     | 
| 
      
 56 
     | 
    
         
            +
            		Logger.end_command self
         
     | 
| 
      
 57 
     | 
    
         
            +
            	end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       59 
59 
     | 
    
         
             
            end
         
     | 
    
        data/lib/environment.rb
    CHANGED
    
    | 
         @@ -59,17 +59,24 @@ class Environment < Hash 
     | 
|
| 
       59 
59 
     | 
    
         
             
              end
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
              def self.dev_root
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                 dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil?
         
     | 
| 
       68 
     | 
    
         
            -
                 dir=ENV["DEV_ROOT"].gsub('\\','/') unless ENV["DEV_ROOT"].nil?
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
                ["DEV_HOME","DEV_ROOT"].each {|v|
         
     | 
| 
      
 63 
     | 
    
         
            +
            	    return ENV[v].gsub('\\','/') unless ENV[v].nil?
         
     | 
| 
      
 64 
     | 
    
         
            +
            	  }
         
     | 
| 
      
 65 
     | 
    
         
            +
                dir=self.home
         
     | 
| 
      
 66 
     | 
    
         
            +
                dir=ENV["DEV_ROOT"].gsub('\\','/') unless ENV["DEV_ROOT"].nil?
         
     | 
| 
       70 
67 
     | 
    
         
             
            	 return dir
         
     | 
| 
       71 
68 
     | 
    
         
             
              end
         
     | 
| 
       72 
69 
     | 
    
         | 
| 
      
 70 
     | 
    
         
            +
              def self.home 
         
     | 
| 
      
 71 
     | 
    
         
            +
                ["USERPROFILE","HOME"].each {|v|
         
     | 
| 
      
 72 
     | 
    
         
            +
                  return ENV[v].gsub('\\','/') unless ENV[v].nil?
         
     | 
| 
      
 73 
     | 
    
         
            +
                }
         
     | 
| 
      
 74 
     | 
    
         
            +
                dir="~"
         
     | 
| 
      
 75 
     | 
    
         
            +
                dir=ENV["HOME"] unless ENV["HOME"].nil?
         
     | 
| 
      
 76 
     | 
    
         
            +
                dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil?
         
     | 
| 
      
 77 
     | 
    
         
            +
                return dir
         
     | 
| 
      
 78 
     | 
    
         
            +
              end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       73 
80 
     | 
    
         
             
              def self.machine
         
     | 
| 
       74 
81 
     | 
    
         
             
                 if !ENV['COMPUTERNAME'].nil? 
         
     | 
| 
       75 
82 
     | 
    
         
             
            	   return ENV['COMPUTERNAME']
         
     | 
    
        data/lib/htmllog.rb
    CHANGED
    
    | 
         @@ -1,53 +1,53 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            class HtmlLog
         
     | 
| 
       2 
     | 
    
         
            -
            	def initialize
         
     | 
| 
       3 
     | 
    
         
            -
            		FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
         
     | 
| 
       4 
     | 
    
         
            -
            		@file=File.open("#{Environment.dev_root}/log/rake.html",'w')
         
     | 
| 
       5 
     | 
    
         
            -
            		@file.write '<html>'
         
     | 
| 
       6 
     | 
    
         
            -
            		@file.write '<body>'
         
     | 
| 
       7 
     | 
    
         
            -
            		@file.write '<h1>'
         
     | 
| 
       8 
     | 
    
         
            -
            		@file.write "rake"
         
     | 
| 
       9 
     | 
    
         
            -
            		ARGV.each do|a|
         
     | 
| 
       10 
     | 
    
         
            -
              			puts " #{a}"
         
     | 
| 
       11 
     | 
    
         
            -
            		end
         
     | 
| 
       12 
     | 
    
         
            -
            		@file.write '</h1>'
         
     | 
| 
       13 
     | 
    
         
            -
            		@file.write '<h2>directory:' + File.dirname(__FILE__) + '</h2>'
         
     | 
| 
       14 
     | 
    
         
            -
            		@file.write '<h2>time:' + Time.now.to_s + '</h2>'
         
     | 
| 
       15 
     | 
    
         
            -
            		@current_task=nil
         
     | 
| 
       16 
     | 
    
         
            -
            		@task_commands=Hash.new
         
     | 
| 
       17 
     | 
    
         
            -
            	end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            	def finalize
         
     | 
| 
       20 
     | 
    
         
            -
            		@file.write('<ul>')
         
     | 
| 
       21 
     | 
    
         
            -
            		@task_commands.each{|k,v|
         
     | 
| 
       22 
     | 
    
         
            -
            			
         
     | 
| 
       23 
     | 
    
         
            -
            			@file.write('<li>')
         
     | 
| 
       24 
     | 
    
         
            -
            			@file.write(k)
         
     | 
| 
       25 
     | 
    
         
            -
            			@file.write('</li>')
         
     | 
| 
       26 
     | 
    
         
            -
            			
         
     | 
| 
       27 
     | 
    
         
            -
            		}
         
     | 
| 
       28 
     | 
    
         
            -
            		@file.write '</ul>'
         
     | 
| 
       29 
     | 
    
         
            -
            		@file.write '</body>'
         
     | 
| 
       30 
     | 
    
         
            -
            		@file.write '</html>'
         
     | 
| 
       31 
     | 
    
         
            -
            		@file.close
         
     | 
| 
       32 
     | 
    
         
            -
            	end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            	def start_task task
         
     | 
| 
       35 
     | 
    
         
            -
            		@current_task=task
         
     | 
| 
       36 
     | 
    
         
            -
            		@task_commands[task]=Hash.new
         
     | 
| 
       37 
     | 
    
         
            -
            		@task_commands[task][:command_results]=Array.new
         
     | 
| 
       38 
     | 
    
         
            -
            	end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            	def end_task task
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            		@current_task=nil
         
     | 
| 
       43 
     | 
    
         
            -
            		#@file
         
     | 
| 
       44 
     | 
    
         
            -
            	end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            	def start_command command
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
              	end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              	def end_command command
         
     | 
| 
       51 
     | 
    
         
            -
              		#@task_commands[@current_task][:command_results] << result
         
     | 
| 
       52 
     | 
    
         
            -
              	end
         
     | 
| 
      
 1 
     | 
    
         
            +
            class HtmlLog
         
     | 
| 
      
 2 
     | 
    
         
            +
            	def initialize
         
     | 
| 
      
 3 
     | 
    
         
            +
            		FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
         
     | 
| 
      
 4 
     | 
    
         
            +
            		@file=File.open("#{Environment.dev_root}/log/rake.html",'w')
         
     | 
| 
      
 5 
     | 
    
         
            +
            		@file.write '<html>'
         
     | 
| 
      
 6 
     | 
    
         
            +
            		@file.write '<body>'
         
     | 
| 
      
 7 
     | 
    
         
            +
            		@file.write '<h1>'
         
     | 
| 
      
 8 
     | 
    
         
            +
            		@file.write "rake"
         
     | 
| 
      
 9 
     | 
    
         
            +
            		ARGV.each do|a|
         
     | 
| 
      
 10 
     | 
    
         
            +
              			puts " #{a}"
         
     | 
| 
      
 11 
     | 
    
         
            +
            		end
         
     | 
| 
      
 12 
     | 
    
         
            +
            		@file.write '</h1>'
         
     | 
| 
      
 13 
     | 
    
         
            +
            		@file.write '<h2>directory:' + File.dirname(__FILE__) + '</h2>'
         
     | 
| 
      
 14 
     | 
    
         
            +
            		@file.write '<h2>time:' + Time.now.to_s + '</h2>'
         
     | 
| 
      
 15 
     | 
    
         
            +
            		@current_task=nil
         
     | 
| 
      
 16 
     | 
    
         
            +
            		@task_commands=Hash.new
         
     | 
| 
      
 17 
     | 
    
         
            +
            	end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            	def finalize
         
     | 
| 
      
 20 
     | 
    
         
            +
            		@file.write('<ul>')
         
     | 
| 
      
 21 
     | 
    
         
            +
            		@task_commands.each{|k,v|
         
     | 
| 
      
 22 
     | 
    
         
            +
            			
         
     | 
| 
      
 23 
     | 
    
         
            +
            			@file.write('<li>')
         
     | 
| 
      
 24 
     | 
    
         
            +
            			@file.write(k)
         
     | 
| 
      
 25 
     | 
    
         
            +
            			@file.write('</li>')
         
     | 
| 
      
 26 
     | 
    
         
            +
            			
         
     | 
| 
      
 27 
     | 
    
         
            +
            		}
         
     | 
| 
      
 28 
     | 
    
         
            +
            		@file.write '</ul>'
         
     | 
| 
      
 29 
     | 
    
         
            +
            		@file.write '</body>'
         
     | 
| 
      
 30 
     | 
    
         
            +
            		@file.write '</html>'
         
     | 
| 
      
 31 
     | 
    
         
            +
            		@file.close
         
     | 
| 
      
 32 
     | 
    
         
            +
            	end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            	def start_task task
         
     | 
| 
      
 35 
     | 
    
         
            +
            		@current_task=task
         
     | 
| 
      
 36 
     | 
    
         
            +
            		@task_commands[task]=Hash.new
         
     | 
| 
      
 37 
     | 
    
         
            +
            		@task_commands[task][:command_results]=Array.new
         
     | 
| 
      
 38 
     | 
    
         
            +
            	end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            	def end_task task
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            		@current_task=nil
         
     | 
| 
      
 43 
     | 
    
         
            +
            		#@file
         
     | 
| 
      
 44 
     | 
    
         
            +
            	end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            	def start_command command
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              	end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              	def end_command command
         
     | 
| 
      
 51 
     | 
    
         
            +
              		#@task_commands[@current_task][:command_results] << result
         
     | 
| 
      
 52 
     | 
    
         
            +
              	end
         
     | 
| 
       53 
53 
     | 
    
         
             
            end
         
     | 
    
        data/lib/jsonlog.rb
    CHANGED
    
    | 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'json'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class JsonLog
         
     | 
| 
       4 
     | 
    
         
            -
            	def initialize
         
     | 
| 
       5 
     | 
    
         
            -
            	end
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            	def finalize
         
     | 
| 
       8 
     | 
    
         
            -
            		name='DEV'
         
     | 
| 
       9 
     | 
    
         
            -
            		ARGV.each do|a|
         
     | 
| 
       10 
     | 
    
         
            -
            			name="#{name}.#{a}"
         
     | 
| 
       11 
     | 
    
         
            -
            		end
         
     | 
| 
       12 
     | 
    
         
            -
            		name="#{name}.json"
         
     | 
| 
       13 
     | 
    
         
            -
            		FileUtils.mkdir("#{DEV[:dev_root]}/log") if !File.exists?("#{DEV[:dev_root]}/log")
         
     | 
| 
       14 
     | 
    
         
            -
            		File.open("#{DEV[:dev_root]}/log/#{name}","w") do |f|
         
     | 
| 
       15 
     | 
    
         
            -
              			f.write(JSON.pretty_generate(DEV))
         
     | 
| 
       16 
     | 
    
         
            -
            		end
         
     | 
| 
       17 
     | 
    
         
            -
            	end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class JsonLog
         
     | 
| 
      
 4 
     | 
    
         
            +
            	def initialize
         
     | 
| 
      
 5 
     | 
    
         
            +
            	end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            	def finalize
         
     | 
| 
      
 8 
     | 
    
         
            +
            		name='DEV'
         
     | 
| 
      
 9 
     | 
    
         
            +
            		ARGV.each do|a|
         
     | 
| 
      
 10 
     | 
    
         
            +
            			name="#{name}.#{a}"
         
     | 
| 
      
 11 
     | 
    
         
            +
            		end
         
     | 
| 
      
 12 
     | 
    
         
            +
            		name="#{name}.json"
         
     | 
| 
      
 13 
     | 
    
         
            +
            		FileUtils.mkdir("#{DEV[:dev_root]}/log") if !File.exists?("#{DEV[:dev_root]}/log")
         
     | 
| 
      
 14 
     | 
    
         
            +
            		File.open("#{DEV[:dev_root]}/log/#{name}","w") do |f|
         
     | 
| 
      
 15 
     | 
    
         
            +
              			f.write(JSON.pretty_generate(DEV))
         
     | 
| 
      
 16 
     | 
    
         
            +
            		end
         
     | 
| 
      
 17 
     | 
    
         
            +
            	end
         
     | 
| 
       18 
18 
     | 
    
         
             
            end
         
     | 
    
        data/lib/logger.rb
    CHANGED
    
    | 
         @@ -1,37 +1,37 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative './htmllog.rb'
         
     | 
| 
       2 
     | 
    
         
            -
            require_relative './jsonlog.rb'
         
     | 
| 
       3 
     | 
    
         
            -
            require_relative './yamllog.rb'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            class Logger
         
     | 
| 
       6 
     | 
    
         
            -
            	@@timers=Hash.new
         
     | 
| 
       7 
     | 
    
         
            -
            	@@html_log=HtmlLog.new
         
     | 
| 
       8 
     | 
    
         
            -
              @@json_log=JsonLog.new
         
     | 
| 
       9 
     | 
    
         
            -
              @@yaml_log=YamlLog.new
         
     | 
| 
       10 
     | 
    
         
            -
            	def self.start_task task
         
     | 
| 
       11 
     | 
    
         
            -
            		@@timers[task]=Timer.new
         
     | 
| 
       12 
     | 
    
         
            -
            		Console.announce_task_start task
         
     | 
| 
       13 
     | 
    
         
            -
            		@@html_log.start_task task
         
     | 
| 
       14 
     | 
    
         
            -
              	end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              	def self.end_task task
         
     | 
| 
       17 
     | 
    
         
            -
              		elapsed=@@timers[task].elapsed
         
     | 
| 
       18 
     | 
    
         
            -
              		@@html_log.end_task task
         
     | 
| 
       19 
     | 
    
         
            -
              	end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              	def self.finalize
         
     | 
| 
       22 
     | 
    
         
            -
              		@@html_log.finalize
         
     | 
| 
       23 
     | 
    
         
            -
                  @@json_log.finalize
         
     | 
| 
       24 
     | 
    
         
            -
                  @@yaml_log.finalize
         
     | 
| 
       25 
     | 
    
         
            -
              	end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              	def self.start_command command
         
     | 
| 
       28 
     | 
    
         
            -
                  Console.start_command command
         
     | 
| 
       29 
     | 
    
         
            -
                  //
         
     | 
| 
       30 
     | 
    
         
            -
                  @@html_log.start_command command
         
     | 
| 
       31 
     | 
    
         
            -
              	end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              	def self.end_command command
         
     | 
| 
       34 
     | 
    
         
            -
                  Console.end_command command
         
     | 
| 
       35 
     | 
    
         
            -
                  @@html_log.end_command command
         
     | 
| 
       36 
     | 
    
         
            -
              	end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative './htmllog.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative './jsonlog.rb'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative './yamllog.rb'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class Logger
         
     | 
| 
      
 6 
     | 
    
         
            +
            	@@timers=Hash.new
         
     | 
| 
      
 7 
     | 
    
         
            +
            	@@html_log=HtmlLog.new
         
     | 
| 
      
 8 
     | 
    
         
            +
              @@json_log=JsonLog.new
         
     | 
| 
      
 9 
     | 
    
         
            +
              @@yaml_log=YamlLog.new
         
     | 
| 
      
 10 
     | 
    
         
            +
            	def self.start_task task
         
     | 
| 
      
 11 
     | 
    
         
            +
            		@@timers[task]=Timer.new
         
     | 
| 
      
 12 
     | 
    
         
            +
            		Console.announce_task_start task
         
     | 
| 
      
 13 
     | 
    
         
            +
            		@@html_log.start_task task
         
     | 
| 
      
 14 
     | 
    
         
            +
              	end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              	def self.end_task task
         
     | 
| 
      
 17 
     | 
    
         
            +
              		elapsed=@@timers[task].elapsed
         
     | 
| 
      
 18 
     | 
    
         
            +
              		@@html_log.end_task task
         
     | 
| 
      
 19 
     | 
    
         
            +
              	end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              	def self.finalize
         
     | 
| 
      
 22 
     | 
    
         
            +
              		@@html_log.finalize
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @@json_log.finalize
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @@yaml_log.finalize
         
     | 
| 
      
 25 
     | 
    
         
            +
              	end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              	def self.start_command command
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Console.start_command command
         
     | 
| 
      
 29 
     | 
    
         
            +
                  //
         
     | 
| 
      
 30 
     | 
    
         
            +
                  @@html_log.start_command command
         
     | 
| 
      
 31 
     | 
    
         
            +
              	end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              	def self.end_command command
         
     | 
| 
      
 34 
     | 
    
         
            +
                  Console.end_command command
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @@html_log.end_command command
         
     | 
| 
      
 36 
     | 
    
         
            +
              	end
         
     | 
| 
       37 
37 
     | 
    
         
             
            end
         
     | 
    
        data/lib/spec.json
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"name":"dev_tasks","version":"1.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            {"name":"dev_tasks","version":"1.0.28"}
         
     | 
    
        data/lib/yamllog.rb
    CHANGED
    
    | 
         @@ -1,18 +1,18 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'yaml'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class YamlLog
         
     | 
| 
       4 
     | 
    
         
            -
            	def initialize
         
     | 
| 
       5 
     | 
    
         
            -
            	end
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            	def finalize
         
     | 
| 
       8 
     | 
    
         
            -
            		name='DEV'
         
     | 
| 
       9 
     | 
    
         
            -
            		ARGV.each do|a|
         
     | 
| 
       10 
     | 
    
         
            -
            			name="#{name}.#{a}"
         
     | 
| 
       11 
     | 
    
         
            -
            		end
         
     | 
| 
       12 
     | 
    
         
            -
            		name="#{name}.yml"
         
     | 
| 
       13 
     | 
    
         
            -
            		FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
         
     | 
| 
       14 
     | 
    
         
            -
            		File.open("#{Environment.dev_root}/log/#{name}","w") do |f|
         
     | 
| 
       15 
     | 
    
         
            -
              			f.write(DEV.to_yaml)
         
     | 
| 
       16 
     | 
    
         
            -
            		end
         
     | 
| 
       17 
     | 
    
         
            -
            	end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class YamlLog
         
     | 
| 
      
 4 
     | 
    
         
            +
            	def initialize
         
     | 
| 
      
 5 
     | 
    
         
            +
            	end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            	def finalize
         
     | 
| 
      
 8 
     | 
    
         
            +
            		name='DEV'
         
     | 
| 
      
 9 
     | 
    
         
            +
            		ARGV.each do|a|
         
     | 
| 
      
 10 
     | 
    
         
            +
            			name="#{name}.#{a}"
         
     | 
| 
      
 11 
     | 
    
         
            +
            		end
         
     | 
| 
      
 12 
     | 
    
         
            +
            		name="#{name}.yml"
         
     | 
| 
      
 13 
     | 
    
         
            +
            		FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
         
     | 
| 
      
 14 
     | 
    
         
            +
            		File.open("#{Environment.dev_root}/log/#{name}","w") do |f|
         
     | 
| 
      
 15 
     | 
    
         
            +
              			f.write(DEV.to_yaml)
         
     | 
| 
      
 16 
     | 
    
         
            +
            		end
         
     | 
| 
      
 17 
     | 
    
         
            +
            	end
         
     | 
| 
       18 
18 
     | 
    
         
             
            end
         
     | 
    
        data/spec/command_spec.rb
    CHANGED
    
    | 
         @@ -1,80 +1,80 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative '../lib/command.rb'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe Command do
         
     | 
| 
       4 
     | 
    
         
            -
              it "should be able to execute ruby --version command" do
         
     | 
| 
       5 
     | 
    
         
            -
                cmd=Command.new("ruby --version")
         
     | 
| 
       6 
     | 
    
         
            -
                # Timeout
         
     | 
| 
       7 
     | 
    
         
            -
                expect(cmd[:timeout]).to eq(0)
         
     | 
| 
       8 
     | 
    
         
            -
                cmd[:timeout]=3000
         
     | 
| 
       9 
     | 
    
         
            -
                expect(cmd[:timeout]).to eq(3000)
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                # Directory
         
     | 
| 
       12 
     | 
    
         
            -
                expect(cmd[:directory]).to eq("")
         
     | 
| 
       13 
     | 
    
         
            -
                cmd[:directory] = File.dirname(__FILE__)
         
     | 
| 
       14 
     | 
    
         
            -
                expect(cmd[:directory]).to eq(File.dirname(__FILE__))
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                # ExitCode
         
     | 
| 
       17 
     | 
    
         
            -
                expect(cmd[:exit_code]).to eq(0)
         
     | 
| 
       18 
     | 
    
         
            -
                cmd[:exit_code] = 1
         
     | 
| 
       19 
     | 
    
         
            -
                expect(cmd[:exit_code]).to eq(1)
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                # Input
         
     | 
| 
       22 
     | 
    
         
            -
                expect(cmd[:input]).to eq("ruby --version")
         
     | 
| 
       23 
     | 
    
         
            -
                cmd2 = Command.new('')
         
     | 
| 
       24 
     | 
    
         
            -
                expect(cmd2[:input]).to eq('')
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                # Output
         
     | 
| 
       27 
     | 
    
         
            -
                expect(cmd[:output]).to eq('')
         
     | 
| 
       28 
     | 
    
         
            -
                cmd[:output]='test'
         
     | 
| 
       29 
     | 
    
         
            -
                expect(cmd[:output]).to eq('test')
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                # Error
         
     | 
| 
       32 
     | 
    
         
            -
                expect(cmd[:error]).to eq('')
         
     | 
| 
       33 
     | 
    
         
            -
                cmd[:error]='error_test'
         
     | 
| 
       34 
     | 
    
         
            -
                expect(cmd[:error]).to eq('error_test')
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                # MachineName
         
     | 
| 
       37 
     | 
    
         
            -
                expect(cmd[:machine_name]).to eq('')
         
     | 
| 
       38 
     | 
    
         
            -
                cmd[:machine_name]='machine_name_test'
         
     | 
| 
       39 
     | 
    
         
            -
                expect(cmd[:machine_name]).to eq('machine_name_test')
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                # UserName
         
     | 
| 
       42 
     | 
    
         
            -
                expect(cmd[:user_name]).to eq('')
         
     | 
| 
       43 
     | 
    
         
            -
                cmd[:user_name]='user_name_test'
         
     | 
| 
       44 
     | 
    
         
            -
                expect(cmd[:user_name]).to eq('user_name_test')
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # StartTime
         
     | 
| 
       47 
     | 
    
         
            -
                expect(cmd[:start_time]).to eq(nil)
         
     | 
| 
       48 
     | 
    
         
            -
                cmd[:start_time]=Time.now
         
     | 
| 
       49 
     | 
    
         
            -
                expect(cmd[:start_time]).not_to eq(nil)
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                # EndTime
         
     | 
| 
       52 
     | 
    
         
            -
                expect(cmd[:end_time]).to eq(nil)
         
     | 
| 
       53 
     | 
    
         
            -
                cmd[:end_time]=Time.now
         
     | 
| 
       54 
     | 
    
         
            -
                expect(cmd[:end_time]).not_to eq(nil)
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
              it "should be able to write to/load from JSON" do
         
     | 
| 
       59 
     | 
    
         
            -
                cmd=Command.new("ruby --version")
         
     | 
| 
       60 
     | 
    
         
            -
                expect(cmd[:timeout]).to eq(0)
         
     | 
| 
       61 
     | 
    
         
            -
                expect(cmd[:input]).to eq("ruby --version")
         
     | 
| 
       62 
     | 
    
         
            -
                cmd2=Command.new(JSON.parse(cmd.to_json))
         
     | 
| 
       63 
     | 
    
         
            -
                expect(cmd2[:timeout]).to eq(0)
         
     | 
| 
       64 
     | 
    
         
            -
                expect(cmd2[:input]).to eq("ruby --version")
         
     | 
| 
       65 
     | 
    
         
            -
              end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
              it "should be able to execute rake command in specific directory" do
         
     | 
| 
       68 
     | 
    
         
            -
                dir="#{DEV[:dev_root]}/tmp/rake_test"
         
     | 
| 
       69 
     | 
    
         
            -
                FileUtils.mkdir_p(dir) if(!File.exists?(dir))
         
     | 
| 
       70 
     | 
    
         
            -
                File.open("#{dir}/rakefile.rb","w") { |f| 
         
     | 
| 
       71 
     | 
    
         
            -
                    f.puts "task :default do"
         
     | 
| 
       72 
     | 
    
         
            -
                    f.puts " puts 'rake_test'"
         
     | 
| 
       73 
     | 
    
         
            -
                    f.puts "end" 
         
     | 
| 
       74 
     | 
    
         
            -
                }
         
     | 
| 
       75 
     | 
    
         
            -
                cmd=Command.new("rake")
         
     | 
| 
       76 
     | 
    
         
            -
                cmd[:directory]=dir
         
     | 
| 
       77 
     | 
    
         
            -
                cmd.execute
         
     | 
| 
       78 
     | 
    
         
            -
                expect(cmd[:output].include?('rake_test')).to eq(true)
         
     | 
| 
       79 
     | 
    
         
            -
              end
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative '../lib/command.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Command do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it "should be able to execute ruby --version command" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                cmd=Command.new("ruby --version")
         
     | 
| 
      
 6 
     | 
    
         
            +
                # Timeout
         
     | 
| 
      
 7 
     | 
    
         
            +
                expect(cmd[:timeout]).to eq(0)
         
     | 
| 
      
 8 
     | 
    
         
            +
                cmd[:timeout]=3000
         
     | 
| 
      
 9 
     | 
    
         
            +
                expect(cmd[:timeout]).to eq(3000)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                # Directory
         
     | 
| 
      
 12 
     | 
    
         
            +
                expect(cmd[:directory]).to eq("")
         
     | 
| 
      
 13 
     | 
    
         
            +
                cmd[:directory] = File.dirname(__FILE__)
         
     | 
| 
      
 14 
     | 
    
         
            +
                expect(cmd[:directory]).to eq(File.dirname(__FILE__))
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                # ExitCode
         
     | 
| 
      
 17 
     | 
    
         
            +
                expect(cmd[:exit_code]).to eq(0)
         
     | 
| 
      
 18 
     | 
    
         
            +
                cmd[:exit_code] = 1
         
     | 
| 
      
 19 
     | 
    
         
            +
                expect(cmd[:exit_code]).to eq(1)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                # Input
         
     | 
| 
      
 22 
     | 
    
         
            +
                expect(cmd[:input]).to eq("ruby --version")
         
     | 
| 
      
 23 
     | 
    
         
            +
                cmd2 = Command.new('')
         
     | 
| 
      
 24 
     | 
    
         
            +
                expect(cmd2[:input]).to eq('')
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                # Output
         
     | 
| 
      
 27 
     | 
    
         
            +
                expect(cmd[:output]).to eq('')
         
     | 
| 
      
 28 
     | 
    
         
            +
                cmd[:output]='test'
         
     | 
| 
      
 29 
     | 
    
         
            +
                expect(cmd[:output]).to eq('test')
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                # Error
         
     | 
| 
      
 32 
     | 
    
         
            +
                expect(cmd[:error]).to eq('')
         
     | 
| 
      
 33 
     | 
    
         
            +
                cmd[:error]='error_test'
         
     | 
| 
      
 34 
     | 
    
         
            +
                expect(cmd[:error]).to eq('error_test')
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                # MachineName
         
     | 
| 
      
 37 
     | 
    
         
            +
                expect(cmd[:machine_name]).to eq('')
         
     | 
| 
      
 38 
     | 
    
         
            +
                cmd[:machine_name]='machine_name_test'
         
     | 
| 
      
 39 
     | 
    
         
            +
                expect(cmd[:machine_name]).to eq('machine_name_test')
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                # UserName
         
     | 
| 
      
 42 
     | 
    
         
            +
                expect(cmd[:user_name]).to eq('')
         
     | 
| 
      
 43 
     | 
    
         
            +
                cmd[:user_name]='user_name_test'
         
     | 
| 
      
 44 
     | 
    
         
            +
                expect(cmd[:user_name]).to eq('user_name_test')
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                # StartTime
         
     | 
| 
      
 47 
     | 
    
         
            +
                expect(cmd[:start_time]).to eq(nil)
         
     | 
| 
      
 48 
     | 
    
         
            +
                cmd[:start_time]=Time.now
         
     | 
| 
      
 49 
     | 
    
         
            +
                expect(cmd[:start_time]).not_to eq(nil)
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                # EndTime
         
     | 
| 
      
 52 
     | 
    
         
            +
                expect(cmd[:end_time]).to eq(nil)
         
     | 
| 
      
 53 
     | 
    
         
            +
                cmd[:end_time]=Time.now
         
     | 
| 
      
 54 
     | 
    
         
            +
                expect(cmd[:end_time]).not_to eq(nil)
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              it "should be able to write to/load from JSON" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                cmd=Command.new("ruby --version")
         
     | 
| 
      
 60 
     | 
    
         
            +
                expect(cmd[:timeout]).to eq(0)
         
     | 
| 
      
 61 
     | 
    
         
            +
                expect(cmd[:input]).to eq("ruby --version")
         
     | 
| 
      
 62 
     | 
    
         
            +
                cmd2=Command.new(JSON.parse(cmd.to_json))
         
     | 
| 
      
 63 
     | 
    
         
            +
                expect(cmd2[:timeout]).to eq(0)
         
     | 
| 
      
 64 
     | 
    
         
            +
                expect(cmd2[:input]).to eq("ruby --version")
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              it "should be able to execute rake command in specific directory" do
         
     | 
| 
      
 68 
     | 
    
         
            +
                dir="#{DEV[:dev_root]}/tmp/rake_test"
         
     | 
| 
      
 69 
     | 
    
         
            +
                FileUtils.mkdir_p(dir) if(!File.exists?(dir))
         
     | 
| 
      
 70 
     | 
    
         
            +
                File.open("#{dir}/rakefile.rb","w") { |f| 
         
     | 
| 
      
 71 
     | 
    
         
            +
                    f.puts "task :default do"
         
     | 
| 
      
 72 
     | 
    
         
            +
                    f.puts " puts 'rake_test'"
         
     | 
| 
      
 73 
     | 
    
         
            +
                    f.puts "end" 
         
     | 
| 
      
 74 
     | 
    
         
            +
                }
         
     | 
| 
      
 75 
     | 
    
         
            +
                cmd=Command.new("rake")
         
     | 
| 
      
 76 
     | 
    
         
            +
                cmd[:directory]=dir
         
     | 
| 
      
 77 
     | 
    
         
            +
                cmd.execute
         
     | 
| 
      
 78 
     | 
    
         
            +
                expect(cmd[:output].include?('rake_test')).to eq(true)
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
       80 
80 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative '../../../../lib/dev_tasks.rb'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'json'
         
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative '../../../../lib/dev_tasks.rb'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'json'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'yaml'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,8 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: dev_tasks
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.28
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Lou Parslow
         
     | 
| 
         @@ -14,81 +13,71 @@ dependencies: 
     | 
|
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
       16 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
       18 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       20 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
19 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       22 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
     | 
    
         
            -
                none: false
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       28 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       30 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
28 
     | 
    
         
             
              name: json
         
     | 
| 
       32 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - -  
     | 
| 
      
 31 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       36 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
33 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       38 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       39 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       40 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - -  
     | 
| 
      
 38 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       44 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
40 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       46 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       47 
42 
     | 
    
         
             
              name: rspec
         
     | 
| 
       48 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       49 
     | 
    
         
            -
                none: false
         
     | 
| 
       50 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
     | 
    
         
            -
                - -  
     | 
| 
      
 45 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       52 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
47 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       54 
48 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       55 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       56 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
     | 
    
         
            -
                none: false
         
     | 
| 
       58 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - -  
     | 
| 
      
 52 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       60 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
54 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       62 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
56 
     | 
    
         
             
              name: rspec
         
     | 
| 
       64 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                none: false
         
     | 
| 
       66 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       67 
     | 
    
         
            -
                - -  
     | 
| 
      
 59 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       68 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
61 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       70 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       71 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       72 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
                none: false
         
     | 
| 
       74 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       75 
     | 
    
         
            -
                - -  
     | 
| 
      
 66 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       76 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       77 
68 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       78 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       79 
70 
     | 
    
         
             
              name: json
         
     | 
| 
       80 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       81 
     | 
    
         
            -
                none: false
         
     | 
| 
       82 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       83 
     | 
    
         
            -
                - -  
     | 
| 
      
 73 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       84 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       85 
75 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       86 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       87 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       88 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
     | 
    
         
            -
                none: false
         
     | 
| 
       90 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       91 
     | 
    
         
            -
                - -  
     | 
| 
      
 80 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       92 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       93 
82 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       94 
83 
     | 
    
         
             
            description: defines rake tasks for ruby and C# projects
         
     | 
| 
         @@ -145,27 +134,26 @@ files: 
     | 
|
| 
       145 
134 
     | 
    
         
             
            homepage: http://rubygems.org/gems/dev_tasks
         
     | 
| 
       146 
135 
     | 
    
         
             
            licenses:
         
     | 
| 
       147 
136 
     | 
    
         
             
            - Apache 2.0
         
     | 
| 
      
 137 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       148 
138 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       149 
139 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       150 
140 
     | 
    
         
             
            require_paths:
         
     | 
| 
       151 
141 
     | 
    
         
             
            - lib
         
     | 
| 
       152 
142 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       153 
     | 
    
         
            -
              none: false
         
     | 
| 
       154 
143 
     | 
    
         
             
              requirements:
         
     | 
| 
       155 
     | 
    
         
            -
              - -  
     | 
| 
      
 144 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       156 
145 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       157 
146 
     | 
    
         
             
                  version: 1.9.3
         
     | 
| 
       158 
147 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       159 
     | 
    
         
            -
              none: false
         
     | 
| 
       160 
148 
     | 
    
         
             
              requirements:
         
     | 
| 
       161 
     | 
    
         
            -
              - -  
     | 
| 
      
 149 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       162 
150 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       163 
151 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       164 
152 
     | 
    
         
             
            requirements: []
         
     | 
| 
       165 
153 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       166 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 154 
     | 
    
         
            +
            rubygems_version: 2.0.14
         
     | 
| 
       167 
155 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       168 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 156 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       169 
157 
     | 
    
         
             
            summary: development rake tasks
         
     | 
| 
       170 
158 
     | 
    
         
             
            test_files: []
         
     | 
| 
       171 
159 
     | 
    
         
             
            has_rdoc: 
         
     |