class DeltaTest::Stats
Constants
- TABLE_FILENAME_PATTERN
- TABLE_FILENAME_TPL
Attributes
base_git[R]
stats_git[R]
Public Class Methods
new(head: false)
click to toggle source
# File lib/delta_test/stats.rb, line 12 def initialize(head: false) @head = !!head @base_git = Git.new(DeltaTest.config.base_path) @stats_git = Git.new(DeltaTest.config.stats_path) end
Public Instance Methods
base_commit()
click to toggle source
# File lib/delta_test/stats.rb, line 19 def base_commit return @base_commit if defined?(@base_commit) if @head @base_commit = @base_git.rev_parse('HEAD') else indexes = @stats_git.ls_files .map { |f| f.split('/').take(2).join('') } .to_set @base_commit = @base_git.ls_hashes(DeltaTest.config.stats_life) .find { |h| indexes.include?(h) } end @base_commit end
commit_dir()
click to toggle source
# File lib/delta_test/stats.rb, line 36 def commit_dir return unless base_commit return @commit_dir if defined?(@commit_dir) @commit_dir = DeltaTest.config.stats_path.join(*base_commit.unpack('A2A*')) end
table_file_path()
click to toggle source
# File lib/delta_test/stats.rb, line 43 def table_file_path return unless commit_dir return @table_file_path if defined?(@table_file_path) if @head @table_file_path = commit_dir.join(TABLE_FILENAME_TPL % [DeltaTest.tester_id]) else file = Dir.glob(commit_dir.join(TABLE_FILENAME_PATTERN)).max do |f| File.basename(f).split('-').take(2).join('.').to_f end @table_file_path = file @table_file_path = Pathname.new(file) if file end @table_file_path end