-
Notifications
You must be signed in to change notification settings - Fork 77
/
Rakefile
54 lines (49 loc) · 1.57 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
namespace :hurl do
desc "Start Hurl for development"
task :start do
exec "bundle exec shotgun config.ru"
end
desc "Generate GitHub pages."
task :pages => :check_dirty do
require "mustache"
require "rdiscount"
view = Mustache.new
view.template = File.read("docs/index.mustache")
view[:content] = Markdown.new(File.read("README.md")).to_html
File.open("new_index.html", "w") do |f|
f.puts view.render
end
system "git checkout gh-pages"
system "git pull origin gh-pages"
system "mv new_index.html index.html"
system "git commit -a -m 'auto update docs'"
system "git push origin gh-pages"
system "git checkout master"
end
task :check_dirty do
if `git status -a` && $?.success?
abort "dirty index - not publishing!"
end
end
desc "Please pardon our dust."
task :deploy do
exec "ssh deploy@hurl.it 'cd /www/hurl && git fetch origin && git reset --hard origin/master && rake bundle && touch tmp/restart.txt'"
end
end
# Needs bundler, uglifyjs, and uglifycss installed on the server.
#
# Bundler:
# gem install bundler
# uglifyjs:
# npm install uglify-js
# uglifycss:
# curl https://github.com/fmarcia/UglifyCSS/raw/master/uglifycss > /usr/bin/uglifcss
task :bundle do
system "bundle install"
rm "public/js/bundle.js" rescue nil # >:O
rm "public/css/bundle.css" rescue nil
system "cat $(ls -1 public/js/*.js | grep -v jquery.js) | uglifyjs -nc > public/js/bundle.js"
system "uglifycss public/css/*.css > public/css/bundle.css"
end
desc "Start everything."
multitask :start => [ 'hurl:start' ]