-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
62 lines (51 loc) · 1.86 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/clean'
CLOBBER << 'output'
CLEAN << 'content/images/knitr'
CLEAN << 'content/share/pnp'
CLEAN << 'content/share/rules'
rrst_files = Rake::FileList["content/**/*.Rrst"]
CLEAN << rrst_files.ext(".rst").existing
CLEAN << Rake::FileList["**/*.RData"].existing
CLEAN << "about.rst"
if ENV.has_key?("debug") # rake debug=
debug_str = " --debug"
else
debug_str = ""
end
ENV['RGL_USE_WEBSHOT'] = "FALSE"
rule ".rst" => ".Rrst" do |t|
sh "Rscript -e 'knitr::knit(\"#{t.source}\", \"#{t.name}\", encoding=\"UTF-8\")'"
end
file 'content/pages/pnp.Rrst' => Rake::FileList["content/Articles/*_pnp.Rrst"].ext(".rst")
file 'content/pages/rules.Rrst' => "content/Articles/game_starts.rst"
file 'content/Articles/game_starts.Rrst' => Rake::FileList["content/Articles/*_game.Rrst"].ext(".rst")
file 'content/Articles/game_starts.Rrst' => "content/Articles/chess_pnp.rst"
file 'content/Articles/configuration.Rrst' => "content/pages/pnp.rst"
file 'about.Rrst' => Rake::FileList["content/Articles/*.Rrst"].ext(".rst")
file 'content/pages/about.Rrst' => "about.rst"
file 'content/pages/index.Rrst' => "about.rst"
desc "Build website"
task :default => rrst_files.ext(".rst")
task :default do
directory "output"
sh "pelican -o output -s pelicanconf.py content" + debug_str
cp Dir["aliases/*.html"], "output"
end
desc "Deploy website to trevor.l.davis.com/piecepackr"
task :deploy => :default
task :deploy do
do_dry_run = ENV.has_key?("dry_run") # rake deploy dry_run=
cmd = "rsync -avh --delete output/ trevorld@trevorldavis.com:public_html/piecepackr/"
if do_dry_run
cmd = cmd + " --dry-run"
end
sh cmd
end
desc "Test website on localhost:8000"
task :test => rrst_files.ext(".rst")
task :test do
sh "pelican -o output -s pelicanconf.py --relative-urls content" + debug_str
Dir.chdir("output") do
sh "python3 -m http.server"
end
end