Rakefile in dionysus-0.3.2 vs Rakefile in dionysus-0.4.0

- old
+ new

@@ -7,10 +7,12 @@ $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' +$:.unshift(File.join(File.dirname(__FILE__), 'lib')) + require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "dionysus" gem.summary = %Q{A helpful set of utility classes, generators, and command-line tools.} gem.email = "warlickt@operissystems.com" @@ -37,15 +39,55 @@ task :spec => :check_dependencies task :default => :spec require 'rake/rdoctask' +require 'sdoc' +require 'dionysus/rdoc/markdown' +require 'dionysus/rdoc/no_markup' +RDoc::NoMarkup.files.include('LICENSE', 'VERSION') + Rake::RDocTask.new do |rdoc| version = File.exist?('VERSION') ? File.read('VERSION') : "" - - rdoc.rdoc_dir = 'rdoc' + rdoc.options << '--fmt' << 'shtml' + rdoc.template = 'direct' rdoc.title = "Dionysus #{version}" - rdoc.rdoc_files.include('README*', 'LICENSE', 'VERSION') + rdoc.main = "README.md" + rdoc.rdoc_files.include('README.md', 'LICENSE', 'VERSION') rdoc.rdoc_files.include('lib/**/*.rb') + rdoc.rdoc_dir = 'docs' end task :clobber => [:clobber_rcov, :clobber_rdoc] + +# Github pages tasks taken from the sdoc-helpers gem. +# http://github.com/defunkt/sdoc-helpers +# Author: Chris Wanstrath chris@ozmm.org +namespace :pages do + task :publish => [ :check_dirty, :rerdoc ] do + version = File.exist?('VERSION') ? File.read('VERSION') : "" + `git checkout gh-pages` + `ls -1 | grep -v docs | xargs rm -rf; mv docs/* .; rm -rf docs` + `git add .; git commit -m "update docs for version #{version}"; git push origin gh-pages` + `git checkout master` + puts :done + end + + desc "Initialize GitHub Pages with documentation" + task :init => [ :check_dirty, :rerdoc ] do + `git symbolic-ref HEAD refs/heads/gh-pages` + `rm .git/index` + `ls -1 | grep -v docs | xargs rm -rf; mv docs/* .; rm -rf docs` + `git add .;git commit -m "create docs"; git push origin gh-pages` + `git checkout master` + puts :done + end + + task :check_dirty do + if !`git status`.include?('nothing to commit') + abort "dirty index - not publishing!" + end + end +end + +desc "Build and publish documentation using GitHub Pages." +task :pages => "pages:publish"