2010-12-23 20:18:15 -05:00
|
|
|
require 'bundler'
|
|
|
|
Bundler::GemHelper.install_tasks
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2010-12-23 20:18:15 -05:00
|
|
|
require 'cucumber/rake/task'
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2009-11-22 18:37:11 -05:00
|
|
|
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
2011-06-24 15:06:28 -04:00
|
|
|
t.cucumber_opts = "--drb --color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :spork do
|
|
|
|
desc "start spork in background"
|
|
|
|
task :start do
|
|
|
|
sh %{spork &}
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "stop spork"
|
|
|
|
task :stop do
|
|
|
|
Process.kill(:TERM, `ps -ef | grep spork | grep -v grep | awk '{ print $2 }'`.to_i)
|
|
|
|
end
|
2009-10-22 20:25:15 -04:00
|
|
|
end
|
|
|
|
|
2011-02-13 00:02:00 -05:00
|
|
|
#$LOAD_PATH.unshift 'lib'
|
|
|
|
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rake/clean'
|
|
|
|
|
2011-06-24 15:06:28 -04:00
|
|
|
task :test => ["spork:start", "cucumber", "spork:stop"]
|
2011-02-11 02:14:33 -05:00
|
|
|
|
2011-02-21 10:19:18 -05:00
|
|
|
# rocco depends on rdiscount, which makes me sad.
|
|
|
|
unless defined?(JRUBY_VERSION)
|
|
|
|
# Bring in Rocco tasks
|
|
|
|
require 'rocco/tasks'
|
|
|
|
Rocco::make 'docs/'
|
|
|
|
|
|
|
|
desc 'Build rocco docs'
|
|
|
|
task :docs => :rocco
|
|
|
|
directory 'docs/'
|
|
|
|
|
|
|
|
# Make index.html a copy of rocco.html
|
|
|
|
file 'docs/index.html' => 'docs/middleman.html' do |f|
|
|
|
|
cp 'docs/middleman.html', 'docs/index.html', :preserve => true
|
|
|
|
end
|
|
|
|
task :docs => 'docs/index.html'
|
|
|
|
CLEAN.include 'docs/index.html'
|
|
|
|
|
|
|
|
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 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
|
2011-02-13 00:02:00 -05:00
|
|
|
end
|
|
|
|
end
|
2011-02-11 02:14:33 -05:00
|
|
|
end
|
2011-02-13 00:02:00 -05:00
|
|
|
|
2011-02-21 10:19:18 -05:00
|
|
|
# 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'
|
2011-02-13 00:02:00 -05:00
|
|
|
end
|