lib/inochi/rake.rb in inochi-1.0.0 vs lib/inochi/rake.rb in inochi-1.1.0

- old
+ new

@@ -1,8 +1,8 @@ #-- -# Copyright 2008 Suraj N. Kurapati -# See the LICENSE file for details. +# Copyright protects this work. +# See LICENSE file for details. #++ ## # Provides Rake tasks for packaging, publishing, and announcing your project. # @@ -162,13 +162,11 @@ lang_dump_deps = 'lang' lang_dump_file = 'lang/phrases.yaml' desc 'Extract language phrases for translation.' - task 'lang:dump' => lang_dump_file - - file lang_dump_file => lang_dump_deps do + task 'lang:dump' => lang_dump_deps do ENV['dump_lang_phrases'] = '1' Rake::Task[:test].invoke end lang_conv_delim = "\n" * 5 @@ -342,11 +340,11 @@ desc 'Build all documentation.' task :doc => %w[ doc:api doc:man ] # user manual doc_man_src = 'doc/index.erb' - doc_man_dst = 'doc/index.xhtml' + doc_man_dst = 'doc/index.html' doc_man_deps = FileList['doc/*.erb'] doc_man_doc = nil task :doc_man_doc => doc_man_src do unless doc_man_doc @@ -373,20 +371,19 @@ desc 'Build API reference.' task 'doc:api' => 'doc:api:rdoc' namespace :doc do namespace :api do - require 'sdoc' require 'rake/rdoctask' Rake::RDocTask.new do |t| t.rdoc_dir = doc_api_dst t.template = 'direct' # lighter template used on railsapi.com - t.options.push '--fmt', 'shtml' # explictly set shtml generator - t.rdoc_files.include '[A-Z]*', 'lib/**/*.rb', 'ext/**/*.{rb,c*}' + t.options.push '--fmt', 'shtml' # explictly set SDoc generator + t.rdoc_files.include '[A-Z]*', '{lib,ext}/**/*.{rb,c}' - # regen when sources change + # regenerate API reference when sources change task t.name => t.rdoc_files t.main = options[:license_file] task t.name => t.main end @@ -488,11 +485,11 @@ <h1>#{project_module::DISPLAY}</h1> <p>#{project_module::TAGLINE}</p> <p>#{project_module::WEBSITE}</p> </center> #{ann_nfo_doc} - #{ann_rel_doc} + #{ann_rel_doc.to_s.sub ann_rel_doc.parent_tabs_begin, '<div>'} } # remove heading navigation menus ann_html.gsub! %r{<div class="nav"[^>]*>(.*?)</div>}, '' @@ -503,13 +500,11 @@ end end ann_text = nil task :ann_text => :ann_html do - unless ann_text - ann_text = convert_html_to_text[ann_html] - end + ann_text ||= convert_html_to_text[ann_html] end ann_nfo_text = nil task :ann_nfo_text => :ann_nfo_doc do unless ann_nfo_text @@ -595,19 +590,15 @@ end CLEAN.include ann_mail_dst # packaging - desc 'Build a release.' - task :gem => [:clobber, :doc] do - sh $0, 'gem:package' - end - CLEAN.include 'pkg' + directory 'pkg' + CLOBBER.include 'pkg' - # ruby gem - require 'rake/gempackagetask' - + desc 'Build a release.' + task :gem => [:doc, :ann_text, 'pkg'] do gem_spec = Gem::Specification.new do |gem| authors = project_module::AUTHORS if author = authors.first gem.author, gem.email = author @@ -632,14 +623,14 @@ # `gem.name` when running `gem install ____`. # # For example, consider the "RedCloth" gem. # gem.name = project_module::PROGRAM - + gem.date = project_module::RELEASE gem.version = project_module::VERSION gem.summary = project_module::TAGLINE - gem.description = gem.summary + gem.description = ann_text gem.homepage = project_module::WEBSITE gem.files = FileList['**/*'].exclude('_darcs') - CLEAN gem.has_rdoc = true executable = project_module::PROGRAM @@ -665,23 +656,16 @@ gem.add_dependency Inochi::PROGRAM, Inochi::VERSION.requirement end end # additional configuration is done by user - yield gem if gem_config + gem_config.call(gem) if gem_config end - namespace :gem do - Rake::GemPackageTask.new(gem_spec).define + mv Gem::Builder.new(gem_spec).build, 'pkg' + end - %w[gem package repackage clobber_package].each do |t| - hide_rake_task.call "gem:#{t}" - end - end - - task :clobber => "gem:clobber_package" - # releasing desc 'Publish a release.' task 'pub' => %w[ pub:gem pub:doc pub:ann ] # connect to RubyForge services @@ -746,11 +730,11 @@ end end desc 'Announce to RubyForge news.' task 'pub:ann:forge' => :pub_forge do - puts 'Announcing to RubyForge news...' + puts '', 'Announcing to RubyForge news...' project = options[:rubyforge_project] if group_id = pub_forge.autoconfig['group_ids'][project] # check if this release was already announced @@ -776,11 +760,11 @@ end end desc 'Announce to ruby-talk mailing list.' task 'pub:ann:talk' => :ann_logins do - puts 'Announcing to ruby-talk mailing list...' + puts '', 'Announcing to ruby-talk mailing list...' host = 'http://ruby-forum.com' ruby_talk = 4 # ruby-talk forum ID require 'mechanize' @@ -838,10 +822,10 @@ end end desc 'Announce to RAA (Ruby Application Archive).' task 'pub:ann:raa' => :ann_logins do - puts 'Announcing to RAA (Ruby Application Archive)...' + puts '', 'Announcing to RAA (Ruby Application Archive)...' show_page_error = lambda do |page, message| warn "#{message}, so I can NOT announce this release to RAA:" warn "#{(page/'h2').text} -- #{(page/'p').first.text.strip}" end