-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
48 lines (40 loc) · 1.38 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
require 'rake/clean'
require 'date'
CLEAN.include("../logging/georgesdata*")
CLOBBER.include ("../logging/output")
#startDate = Date.parse('2013-10-11')
startDate = Date.parse('2015-02-01')
task :default do |t|
sh "rsync -av pluto:pvi/aurora-1.7.8d/output-* ../logging"
end
desc 'get the data to show the efficiency of the inverter by day'
task :get_output_for_juliet do |t|
logdates = 15.upto(25)
logdates.each do |d|
sh "gunzip -c ../logging/output-201310#{d}.gz >> ../logging/output"
end
sh "gzip ../logging/output"
end
desc "gzip up files"
task :zip_files do |t|
sh "ls ../logging/output* | grep -v .gz | xargs gzip"
end
desc "get days from the start into one file, eliminating incomplete records"
task :get_recent_output do |t|
logdates = startDate.upto(Date.today()-2)
logdates.each do |d|
d1 = d.strftime("%Y%m%d")
puts (d1)
sh "gunzip -c ../logging/output-#{d1}.gz |tr '\\0' '\\n' |grep OK >> ../logging/output"
end
sh "gzip ../logging/output"
end
desc "get the data used by George's Geography project"
task :get_georges_data do |g|
logdates = 15.upto(19)
logdates.each do |d|
# cannot simply do this in one pass, although it ought to be easy. the simple approach runs multiple passes
sh "gunzip -c ../logging/output-201310#{d}.gz >> ../logging/georgesdata"
end
sh "gzip ../logging/georgesdata"
end