Rakefile in kematzy-dm-is-published-0.0.2 vs Rakefile in kematzy-dm-is-published-0.0.3

- old
+ new

@@ -10,11 +10,11 @@ # gem.description = gem.summary gem.description = IO.read('README.rdoc') || gem.summary gem.email = "kematzy@gmail.com" gem.homepage = "http://github.com/kematzy/dm-is-published" gem.authors = ["kematzy"] - gem.extra_rdoc_files = %w[ README.rdoc LICENSE TODO History.txt ] + gem.extra_rdoc_files = %w[ README.rdoc LICENSE TODO History.rdoc ] gem.add_dependency('dm-core', '>= 0.10.0') gem.add_dependency('dm-validations', '>= 0.10.0') # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end @@ -37,18 +37,39 @@ task :default => :spec require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| - if File.exist?('VERSION.yml') - config = YAML.load(File.read('VERSION.yml')) - version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" - else - version = "" - end - + version = File.exist?('VERSION') ? IO.read('VERSION').chomp : "[Unknown]" + rdoc.rdoc_dir = 'rdoc' rdoc.title = "dm-is-published #{version}" rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') +end + + +desc 'Build the rdoc HTML Files' +task :docs do + version = File.exist?('VERSION') ? IO.read('VERSION').chomp : "[Unknown]" + + sh "sdoc -N --title 'DM::Is::Published v#{version}' lib/dm-is-published README.rdoc" +end + +namespace :docs do + + desc 'Remove rdoc products' + task :remove => [:clobber_rdoc] do + sh "rm -rf doc" + end + + desc 'Force a rebuild of the RDOC files' + task :rebuild => [:docs] + + desc 'Build docs, and open in browser for viewing (specify BROWSER)' + task :open => [:docs] do + browser = ENV["BROWSER"] || "safari" + sh "open -a #{browser} doc/index.html" + end + end