Class: DeltaTest::CLI::StatsSaveCommand
Constant Summary
Constants inherited
from CommandBase
CommandBase::DEFAULT_OPTIONS
Instance Method Summary
collapse
Methods inherited from CommandBase
#bundler_enabled?, #exec_with_data, #exit_with_message, #initialize, #invoke, #parse_options!
Instance Method Details
permalink
#cleanup_tmp_table_files ⇒ Object
[View source]
27
28
29
30
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 27
def cleanup_tmp_table_files
tmp_dir = DeltaTest.config.tmp_table_file.parent
FileUtils.rm_rf(tmp_dir) if File.directory?(tmp_dir)
end
|
[View source]
11
12
13
14
15
16
17
18
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 11
def invoke!
load_tmp_table_files
cleanup_tmp_table_files
save_table_file
stage_table_file
sync_table_file unless @options['no-sync']
end
|
permalink
#load_tmp_table_files ⇒ Object
[View source]
20
21
22
23
24
25
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 20
def load_tmp_table_files
tmp_table_files.each do |tmp_table_file|
tmp_table = DependenciesTable.load(tmp_table_file)
table.reverse_merge!(tmp_table)
end
end
|
permalink
#save_table_file ⇒ Object
[View source]
32
33
34
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 32
def save_table_file
table.dump(stats.table_file_path)
end
|
permalink
#stage_table_file ⇒ Object
[View source]
36
37
38
39
40
41
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 36
def stage_table_file
status = true
status &&= stats.stats_git.add(stats.table_file_path)
status &&= stats.stats_git.commit(stats.base_commit)
raise TableFileStageError unless status
end
|
[View source]
61
62
63
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 61
def stats
@stats ||= Stats.new(head: true)
end
|
permalink
#sync_table_file ⇒ Object
[View source]
43
44
45
46
47
48
49
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 43
def sync_table_file
return unless stats.stats_git.has_remote?
status = true
status &&= stats.stats_git.pull
status &&= stats.stats_git.push
raise StatsRepositorySyncError unless status
end
|
[View source]
57
58
59
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 57
def table
@table ||= DependenciesTable.new
end
|
permalink
#tmp_table_files ⇒ Object
[View source]
51
52
53
54
55
|
# File 'lib/delta_test/cli/stats_save_command.rb', line 51
def tmp_table_files
return @tmp_table_files if defined?(@tmp_table_files)
tmp_table_files_pattern ||= DeltaTest.config.tmp_table_file.parent.join('*')
@tmp_table_files = Dir.glob(tmp_table_files_pattern)
end
|