-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
53 lines (44 loc) · 1.61 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
require "rubygems"
require "bundler/setup"
require "stringex"
# Configuration variables.
public_dir = "public"
source_dir = "source"
stylesheet_dir = "stylesheets"
server_port = "4000"
desc "Generate site."
task :generate do
puts "## Generating site with Jekyll."
system "compass --compile --css-dir #{stylesheet_dir}"
system "jekyll"
end
desc "Watch the site and regenerate it when changes are made."
task :watch do
puts "Starting to watch source with Jekyll and Compass."
system "compass compile --css-dir #{stylesheet_dir}" unless File.exist?("#{stylesheet_dir}/screen.css")
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
trap("INT") {
[jekyllPid, compassPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
exit 0
}
[jekyllPid, compassPid].each { |pid| Process.wait(pid) }
end
desc "Preview the site in a browser."
task :preview do
puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}."
system "compass compile --css-dir #{stylesheet_dir}" unless File.exist?("#{stylesheet_dir}/screen.css")
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
trap("INT") {
[jekyllPid, compassPid, rackupPid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
exit 0
}
[jekyllPid, compassPid, rackupPid].each { |pid| Process.wait(pid) }
end
desc "List tasks."
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
puts "(type rake -T for more detail)\n\n"
end