-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathRakefile
47 lines (37 loc) · 1.42 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
require_relative "./viz/build_graph"
require "twee2"
desc "Graph the walkthrough"
task :graph do
BuildGraph.()
end
namespace :compile do
desc "Compile the walkthrough for development"
task :dev do
STDERR.puts "Use 'rake compile:prod' to compile for production!"
filename = "compiled.html"
binary_name = ENV["BINARY_NAME"] || "exercism"
walkthrough_assets_path = ENV["WALKTHROUGH_ASSETS_PATH"] || "#{Dir.pwd}/contents/assets"
Twee2.build("main.tw2", filename, format: "./storyFormats/exercism")
contents = File.read(filename).gsub("BINARY_NAME", binary_name)
contents = contents.gsub("WALKTHROUGH_ASSETS_PATH", walkthrough_assets_path)
File.open(filename, "wb") do |f|
f.puts contents
end
end
desc "Compile the walkthrough for production"
task :prod do
filename = "compiled_prod.html"
binary_name = ENV["BINARY_NAME"] || "exercism"
walkthrough_assets_path = "https://raw.githubusercontent.com/exercism/interactive-cli-walkthrough/main/contents/assets"
Twee2.build("main.tw2", filename, format: "./storyFormats/exercism_prod")
contents = File.read(filename).gsub("BINARY_NAME", binary_name)
contents = contents.gsub("WALKTHROUGH_ASSETS_PATH", walkthrough_assets_path)
File.open(filename, "wb") do |f|
f.puts contents
end
end
end
desc "Compile the walkthrough for development (alias for compile:dev)"
task :compile do
Rake::Task['compile:dev'].invoke
end