Sha256: f4a1ae4fd87e53b439cb2128e415e9af57ea05aece220f9194fa97d9fefb11f4

Contents?: true

Size: 997 Bytes

Versions: 178

Compression:

Stored size: 997 Bytes

Contents

puts __FILE__ if defined?(DEBUG)

class History
	attr_accessor :dev

	def initialize dev=nil
		@dev=dev
		@dev=Dev.new if @dev.nil?
	end
	
	# .0. for 0 exit codes
	# .X. for non 0 exit codes
	# project name is contained in directory name
	def get_commands pattern
		commands=Array.new
		Dir.chdir(@dev.log_dir) do
			Dir.glob("*#{pattern.gsub('/','-')}*.*").each{|logfile|
				commands << Command.new(JSON.parse(IO.read(logfile)))
			}
		end
		commands
	end

	def add_command command
		code="0"
		code="X" if command[:exit_code] !=0
		directory=command[:directory].gsub(@dev.root_dir,'').gsub('/','-')
		name="#{command[:input]}.#{code}.#{directory}.json"
		filename="#{@dev.log_dir}/#{name}"
		puts "add command #{filename}" if @dev.debug?
		File.open(filename,'w'){|f|f.write(command.to_json)}
	end

	def get_wrk_command project_fullname
		commands=get_commands("#{project_fullname}".gsub('/','-'))
		return commands[0] if commands.length > 0
		nil
	end
end

Version data entries

178 entries across 178 versions & 1 rubygems

Version Path
dev-2.1.153 lib/base/history.rb
dev-2.1.152 lib/base/history.rb
dev-2.1.151 lib/base/history.rb
dev-2.1.150 lib/base/history.rb
dev-2.1.149 lib/base/history.rb
dev-2.1.148 lib/base/history.rb
dev-2.1.147 lib/base/history.rb
dev-2.1.146 lib/base/history.rb
dev-2.1.145 lib/base/history.rb
dev-2.1.144 lib/base/history.rb
dev-2.1.143 lib/base/history.rb
dev-2.1.142 lib/base/history.rb
dev-2.1.141 lib/base/history.rb
dev-2.1.140 lib/base/history.rb
dev-2.1.139 lib/base/history.rb
dev-2.1.137 lib/base/history.rb
dev-2.1.136 lib/base/history.rb
dev-2.1.135 lib/base/history.rb
dev-2.1.134 lib/base/history.rb
dev-2.1.133 lib/base/history.rb