-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (49 loc) · 1.69 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'
Bundler::GemHelper.install_tasks
require 'rake/clean'
# Original Author: Ryan Tomayko
# Copied from https://github.com/rtomayko/rocco/blob/master/Rakefile
begin
require 'rocco/tasks'
Rocco::make 'docs/'
desc "Build Bubble Docs"
task :docs => :rocco
desc 'Build docs and open in browser for the reading'
task :read => :docs do
sh 'open docs/lib/cyclop.html'
end
# Make index.html meta redirect to lib/cyclop.html
file 'docs/index.html' do |f|
sh %Q{echo '<html><head><meta http-equiv="refresh" content="1;url=http://JosephHalter.github.com/bubble/lib/bubble.html"></head><body></body></html>' > docs/index.html}
end
task :docs => 'docs/index.html'
CLEAN.include 'docs/index.html'
# GITHUB PAGES ===============================================================
desc 'Update gh-pages branch'
task :pages => ['docs/.git', :docs] do
rev = `git rev-parse --short HEAD`.strip
Dir.chdir 'docs' do
sh "git add *.html"
sh "git add lib/*.html"
sh "git add lib/bubble/*.html"
sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
if ok
verbose { puts "gh-pages updated" }
sh "git push -q o HEAD:gh-pages"
end
end
end
end
# Update the pages/ directory clone
file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
end
CLOBBER.include 'docs/.git'
rescue LoadError
warn "#$! -- rocco tasks not loaded."
task :rocco
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')
task :default => :spec