-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
104 lines (90 loc) · 2.02 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
#!/usr/bin/env ruby
ignore 'website', 'heroku'
#include ShellUtils #why does this not work ?
#
# Run thin server to give site a spin.
#
desc "start thin server"
task "serve" do
sh "thin start -A file"
end
#
# Compile Handlebar.js templates.
#
desc "compile hnadle bar templates"
task 'compile' do
sh "handlebars source/handlebars/*.handlebars -f assets/javascripts/handlebars.templates.js"
end
#
# The publish task uses the detroit-github plugin
# from the Detroit project.
#
desc 'prepare'
task 'prepare' do
github.prepare
end
desc 'publish'
task 'publish' do
#mkdir_p 'website'
#cp 'index.html', 'website/'
#cp 'doc.json', 'website/'
#cp_r 'assets', 'website/'
github.publish
end
#
# Helper method create Detroit::GitHub instace.
#
def github
@github ||= (
require 'detroit'
require 'detroit-github'
Detroit::GitHub.new(
:folder => 'website'
#:sitemap => {
# 'index.html' => 'index.html',
# 'doc.json' => 'doc.json',
# 'assets' => 'assets'
#}
)
)
end
# Copy project files in website directory.
desc 'update website files'
task 'web:update' do
mkdir_p 'website'
install 'index.html', 'website/index.html'
install 'doc.json', 'website/doc.json'
sync 'assets', 'website/assets'
end
desc 'publish website'
task 'web:publish' => ['web:update'] do
cd 'website' do
sh 'git add index.html doc.json assets'
sh 'git commit -a -m "Automatic update."'
sh 'git push origin gh-pages'
end
end
desc 'publish to heroku'
task 'heroku' do
mkdir_p 'heroku'
install 'index.html', 'heroku/index.html'
install 'doc.json', 'heroku/doc.json'
sync 'assets', 'heroku/assets'
cd 'heroku' do
sh 'git add index.html doc.json assets'
sh 'git commit -a -m "Automatic update."'
sh 'git push orgin master'
end
end
file 'source/handlebars/*.handlebars' do
run :compile
end
#group :web do
# file 'assets' do |paths|
# sync 'assets', 'website/assets'
# end
#
# file 'index.html' do
# install 'index.html', 'website/index.html'
# end
#end