forked from mustache/mustache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
103 lines (82 loc) · 1.72 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
require 'rake/testtask'
require 'rake/rdoctask'
#
# Helpers
#
def command?(command)
system("type #{command} > /dev/null")
end
#
# Tests
#
task :default => :test
if command? :turn
desc "Run tests"
task :test do
suffix = "-n #{ENV['TEST']}" if ENV['TEST']
sh "turn test/*.rb #{suffix}"
end
else
Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
end
if command? :kicker
desc "Launch Kicker (like autotest)"
task :kicker do
puts "Kicking... (ctrl+c to cancel)"
exec "kicker -e rake test lib examples"
end
end
#
# Ron
#
if command? :ronn
desc "Show the manual"
task :man => "man:build" do
exec "man man/mustache.1"
end
desc "Build the manual"
task "man:build" do
sh "ronn -br5 --organization=DEFUNKT --manual='Mustache Manual' man/*.ron"
end
end
#
# Gems
#
desc "Push a new version to Gemcutter and publish docs."
task :publish do
require File.dirname(__FILE__) + '/lib/mustache/version'
system "git tag v#{Mustache::Version}"
sh "gem build mustache.gemspec"
sh "gem push mustache-#{Mustache::Version}.gem"
sh "git push origin master --tags"
sh "git clean -fd"
exec "rake pages"
end
#
# Documentation
#
begin
require 'sdoc_helpers'
rescue LoadError
warn "sdoc support not enabled. Please gem install sdoc-helpers."
end
desc "Publish to GitHub Pages"
task :pages => [ "man:build" ] do
Dir['man/*.html'].each do |f|
cp f, File.basename(f).sub('.html', '.newhtml')
end
`git commit -am 'generated manual'`
`git checkout site`
Dir['*.newhtml'].each do |f|
mv f, f.sub('.newhtml', '.html')
end
`git add .`
`git commit -m updated`
`git push site site:master`
`git checkout master`
puts :done
end