-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
169 lines (140 loc) · 6.58 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
require "rake/clean"
LATEX_TEXT = FileList["*.tex", "FrontBackmatter/*.tex", "Chapters/*.tex"]
PICTURES = FileList["gfx/*"]
CLEAN.include(FileList["*.aux", "*.bbl", "*.blg", "*.brf", "*.idx", "*.ilg", "*.ind", "*.log"])
CLOBBER.include(FileList["*.pdf"])
EEPIC = FileList["gfx/*.xp"]
IMAGES = EEPIC.ext(".eepic") + [
"gfx/visibility_visibility_100kev.pgf",
"gfx/visibility_S00618.pgf",
"gfx/images_S00052.pgf",
"gfx/mythen-edge-on/efficiency.png",
"gfx/images_S00075_S00071.pgf",
"gfx/images_S00613.pgf",
"gfx/lynch-vs-saxs/plot.png",
"gfx/alignment-rot-x.png",
"gfx/delta-beta-comparison/delta-beta-comparison.png",
"gfx/sinusoidal-phase-stepping/sinusoidal-phase-stepping.png",
"gfx/spectrum-visibility/spectrum.png",
"gfx/spectrum-visibility/spectrum-100kV.png",
"gfx/spectrum-visibility/visibility.png",
"gfx/omnidirectional/visibility-omnidirectional.png",
"gfx/eiger/efficiency.png",
"gfx/mythen-edge-on/g1roty.png",
] +
FileList["gfx/eiger/*.png"]
namespace :main do
desc "main pdf"
file "ClassicThesis.pdf" => ["ClassicThesis.tex", "Bibliography.bib", "version.tex", "authoryear-brackets.cbx", "classicthesis.sty"] + IMAGES + LATEX_TEXT do |f|
sh "pdflatex ClassicThesis"
sh "biber ClassicThesis"
sh "pdflatex ClassicThesis"
sh "pdflatex ClassicThesis"
end
desc "write version text"
task "version" do |f|
version_string = `git describe --tags | tr -d '\n'`
current_version_string = `cat version.txt`
if version_string != current_version_string
File.open "version.txt", "w" do |output|
p "writing version #{version_string}"
output.write version_string
end
end
end
desc "write version file"
file "version.tex" => "main:version" do |f|
version_string = `cat version.txt`
current_version_string = `cat #{f.name}`
output_string = "\\newcommand{\\myVersion}{#{version_string}}"
if output_string != current_version_string
File.open f.name, "w" do |output|
p "writing version #{version_string}"
output.write output_string
end
end
end
desc "publish compiled version to github"
task "publish" do |f|
clean_check = `git status --porcelain`
unless clean_check.empty?
abort "uncommitted changes, cannot publish"
end
unless system("git describe --exact-match --tags HEAD")
#create tag if it doesnt exist
automatic_tag_name = `git describe | tr -d '\n'`
sh "git tag #{automatic_tag_name}"
end
tag_name = `git describe --tags | tr -d '\n'`
sh "git push"
sh "git push --tags"
Rake::Task["ClassicThesis.pdf"].invoke
token = `cat ~/github_token | tr -d '\n'`
sh "upload-release.py -vvv --owner Enucatl --repo phd-thesis --tag #{tag_name} --token #{token} ClassicThesis.pdf"
end
end
namespace :gfx do
for picture_filename in EEPIC do
file picture_filename.ext(".eepic") => picture_filename do |t|
Dir.chdir("gfx") do
sh "epix --tikz -o #{File.basename(t.name)} #{File.basename(t.source)}"
end
end
end
file "gfx/visibility_visibility_100kev.pgf" => ["gfx/visibility_100kev.hdf5", "gfx/plot_visibility_pgf.py"] do |f|
sh "python #{f.prerequisites[1]} --steps 25 --pixel 510 #{f.source} #{f.name}"
end
file "gfx/visibility_S00618.pgf" => ["gfx/S00618.hdf5", "gfx/plot_visibility_pgf.py"] do |f|
sh "python #{f.prerequisites[1]} --steps 25 --pixel 510 #{f.source} #{f.name}"
end
file "gfx/images_S00052.pgf" => ["gfx/S00052.hdf5", "gfx/plot_images.py"] do |f|
sh "python #{f.prerequisites[1]} #{f.source} #{f.name} 6"
end
file "gfx/images_S00075_S00071.pgf" => ["gfx/S00075_S00071.hdf5", "gfx/plot_images.py"] do |f|
sh "python #{f.prerequisites[1]} #{f.source} #{f.name} 7"
end
file "gfx/images_S00613.pgf" => ["gfx/S00613.hdf5", "gfx/plot_images.py"] do |f|
sh "python #{f.prerequisites[1]} #{f.source} #{f.name} 2.5"
end
file "gfx/lynch-vs-saxs/plot.png" => ["gfx/lynch-vs-saxs/plot_lynch_saxs.R", "gfx/lynch-vs-saxs/lynch.csv", "gfx/lynch-vs-saxs/saxs.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.prerequisites[2]} #{f.name}"
end
file "gfx/alignment-rot-x.png" => ["gfx/image_series.py", "#{ENV["HOME"]}/afsproject_backup/raw_data/2015/mythen/2015.06.22/S00000-00999/S00083.hdf5"] do |f|
sh "python #{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/alignment-rot-z.png" => ["gfx/image_series.py", "#{ENV["HOME"]}/afsproject_backup/raw_data/2015/mythen/2015.06.22/S00000-00999/S00035.hdf5"] do |f|
sh "python #{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/spectrum-visibility/visibility.png" => ["gfx/spectrum-visibility/visibility.R", "gfx/spectrum-visibility/12-full-spectrum.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/spectrum-visibility/spectrum-100kV.png" => ["gfx/spectrum-visibility/spectrum.R", "gfx/spectrum-visibility/spectrum-100kV.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/spectrum-visibility/spectrum.png" => ["gfx/spectrum-visibility/spectrum.R", "gfx/spectrum-visibility/12-full-spectrum.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/mythen-edge-on/g1roty.png" => ["gfx/image_series.py", "#{ENV["HOME"]}/afsproject_backup/raw_data/2015/mythen/2015.03.03/S00000-00999/S00117.hdf5"] do |f|
sh "python #{f.source} --min_x 600 --max_x 1000 #{f.prerequisites[1]} #{f.name}"
end
file "gfx/mythen-edge-on/efficiency.png" => ["gfx/mythen-edge-on/plot_efficiency.R", "gfx/mythen-edge-on/efficiency.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/eiger/efficiency.png" => ["gfx/mythen-edge-on/plot_efficiency.R", "gfx/eiger/efficiency.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/delta-beta-comparison/delta-beta-comparison.png" => ["gfx/delta-beta-comparison/delta_beta_plot.R", "gfx/delta-beta-comparison/delta_beta.csv"] do |f|
sh "./#{f.source} #{f.prerequisites[1]} #{f.name}"
end
file "gfx/delta-beta-comparison/delta_beta.csv" => ["gfx/delta-beta-comparison/delta_beta_comparison.py"] do |f|
sh "python #{f.source} #{f.name}"
end
file "gfx/sinusoidal-phase-stepping/sinusoidal-phase-stepping.png" => ["gfx/sinusoidal-phase-stepping/sinusoidal_phase_stepping.py"] do |f|
sh "python #{f.source} #{f.name}"
end
file "gfx/omnidirectional/visibility-omnidirectional.png" => ["gfx/omnidirectional/plot_image.py", "gfx/omnidirectional/171004.144941111316.h5"] do |f|
sh "python #{f.source} #{f.prerequisites[1]} #{f.name}"
end
desc "all images"
task :all => IMAGES
end