forked from rubygems/bundler-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
59 lines (48 loc) · 1.56 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
require "bundler/setup"
directory "vendor"
directory "vendor/bundler" => ["vendor"] do
system "git clone [email protected]:carlhuda/bundler.git vendor/bundler"
# Some users don't have private permissions
if !File.exist?("vendor/bundler")
system "git clone git://github.com/carlhuda/bundler.git vendor/bundler"
end
end
task :update_vendor => ["vendor/bundler"] do
Dir.chdir("vendor/bundler") { sh "git fetch" }
end
desc "Pull in the man pages for the specified gem versions."
task :man => [:update_vendor] do
%w(v1.0 v1.1 v1.2 v1.3).each do |version|
branch = (version[1..-1].split('.') + %w(stable)).join('-')
mkdir_p "build/#{version}/man"
Dir.chdir "vendor/bundler" do
sh "git reset --hard HEAD"
sh "git checkout origin/#{branch}"
sh "ronn -5 man/*.ronn"
cp(FileList["man/*.html"], "../../build/#{version}/man")
sh "git clean -fd"
end
end
end
desc "Build the static site"
task :build do
sh "middleman build --clean"
end
desc "Release the current commit to carlhuda/bundler@gh-pages"
task :release => [:update_vendor, :build, :man] do
commit = `git rev-parse HEAD`.chomp
Dir.chdir "vendor/bundler" do
sh "git reset --hard HEAD"
sh "git checkout gh-pages"
rm_rf FileList["*"]
cp_r FileList["../../build/*"], "./"
File.write("CNAME", "gembundler.com")
sh "git add -A ."
sh "git commit -m 'carlhuda/bundler-site-middleman@#{commit}'"
sh "git push origin gh-pages"
end
end
# Allow Heroku deploys to build the site (for previewing)
namespace :assets do
task :precompile => [:build, :man]
end