Skip to content

Commit

Permalink
adding rocco
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Nov 9, 2011
1 parent 27a2dc2 commit 71673b6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.bundle
Gemfile.lock
pkg/*
docs/
49 changes: 49 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,57 @@
require 'bundler'
Bundler::GemHelper.install_tasks

require 'rake/clean'

task :default => :test

task :test do
Dir["test/**_test.rb"].each{|r| require_relative r }
end

begin
# Bring in Rocco tasks
require 'rocco/tasks'
Rocco::make 'docs/'

desc 'Build rocco docs'
task :docs => :rocco
directory 'docs/'

file 'docs/index.html' => 'docs/lib/derp.html' do |f|
cp 'docs/lib/derp.html', 'docs/index.html', :preserve => true
end
task :docs => 'docs/index.html'
CLEAN.include 'docs/index.html'

# Alias for docs task
task :doc => :docs

# 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 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 => e
puts "Something with rocco didn't load, you can't build the docs! Try bundle install?"
end


1 change: 0 additions & 1 deletion TODO

This file was deleted.

1 change: 1 addition & 0 deletions derp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Gem::Specification.new do |s|
s.description = %q{This gem gives you String#to_derp, which converts your string to morse code, and then encodes dots and dashes via herps and derps.}

s.add_development_dependency "watchr"
s.add_development_dependency "rocco"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down

0 comments on commit 71673b6

Please sign in to comment.