forked from sul-dlss/preservation_robots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
61 lines (53 loc) · 1.57 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'rake'
require 'robot-controller/tasks'
task :environment do
require_relative 'config/boot'
end
task default: :ci
desc 'run continuous integration suite (tests & rubocop)'
task ci: [:spec, :rubocop]
begin
require 'rspec/core/rake_task'
desc 'Run RSpec'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
desc 'Run RSpec'
task :spec do
abort 'Please install the rspec gem to run tests.'
end
end
begin
require 'rubocop/rake_task'
desc 'Run rubocop'
RuboCop::RakeTask.new
rescue LoadError
desc 'Run rubocop'
task :rubocop do
abort 'Please install the rubocop gem to run rubocop.'
end
end
desc 'Generate stats'
task generate_stats: [:environment] do
require File.expand_path(File.dirname(__FILE__) + '/lib/stats_reporter')
stats_reporter = StatsReporter.new
complete_report = <<-REPORT.strip_heredoc
Stats compiled on #{Time.now.to_date}
Storage stats for mounts on #{Socket.gethostname}:
#{stats_reporter.storage_report_text}
Workflow stats:
#{stats_reporter.workflow_report_text}
REPORT
File.open("#{ROBOT_ROOT}/log/weekly_stats.log", 'w') { |f| f.write(complete_report) }
end
desc 'get error and warning messages for each WF step'
task preservation_errors: [:environment] do
require File.expand_path(File.dirname(__FILE__) + '/lib/error_reporter')
error_reporter = ErrorReporter.new
error_reporter.output
end
desc 'get druid counts for each WF step'
task preservation_logs: [:environment] do
require File.expand_path(File.dirname(__FILE__) + '/lib/activity_reporter')
activity_reporter = ActivityReporter.new
activity_reporter.output
end