Rakefile in merb_helpers-0.9.3 vs Rakefile in merb_helpers-0.9.4

- old
+ new

@@ -1,63 +1,74 @@ require 'rubygems' require 'rake/gempackagetask' -require 'rake/rdoctask' -require 'spec/rake/spectask' +require "rake/rdoctask" +require "extlib" +require 'merb-core/tasks/merb_rake_helper' +require "spec/rake/spectask" -PLUGIN = "merb_helpers" -NAME = "merb_helpers" -VERSION = "0.9.3" -AUTHOR = "Yehuda Katz" -EMAIL = "wycats@gmail.com" -HOMEPAGE = "http://merb.rubyforge.org/" -SUMMARY = "Helper support for merb (similar to the Rails form helpers)" +############################################################################## +# Package && release +############################################################################## +RUBY_FORGE_PROJECT = "merb" +PROJECT_URL = "http://merbivore.com" +PROJECT_SUMMARY = "Helper support for merb (similar to the Rails form helpers)" +PROJECT_DESCRIPTION = PROJECT_SUMMARY -windows = (PLATFORM =~ /win32|cygwin/) +GEM_AUTHOR = "Yehuda Katz" +GEM_EMAIL = "ykatz@engineyard.com" -SUDO = windows ? "" : "sudo" +GEM_NAME = "merb_helpers" +PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' +GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.4") + PKG_BUILD +RELEASE_NAME = "REL #{GEM_VERSION}" + +require "extlib/tasks/release" + spec = Gem::Specification.new do |s| - s.name = NAME - s.version = VERSION + s.rubyforge_project = RUBY_FORGE_PROJECT + s.name = GEM_NAME + s.version = GEM_VERSION s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = ["README", "LICENSE", 'TODO'] - s.summary = SUMMARY - s.description = s.summary - s.author = AUTHOR - s.email = EMAIL - s.homepage = HOMEPAGE - s.add_dependency("merb-core", ">=0.9.3") + s.summary = PROJECT_SUMMARY + s.description = PROJECT_DESCRIPTION + s.author = GEM_AUTHOR + s.email = GEM_EMAIL + s.homepage = PROJECT_URL + s.add_dependency('merb-core', '>= 0.9.4') s.require_path = 'lib' - s.autorequire = PLUGIN s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*") end - Rake::GemPackageTask.new(spec) do |pkg| pkg.gem_spec = spec end -desc "Run :package and install resulting .gem" +############################################################################## +# Installation +############################################################################## +desc "Install the gem" task :install => [:package] do - sh %{#{SUDO} gem install pkg/#{NAME}-#{VERSION} --no-rdoc --no-ri --no-update-sources} + sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources} end -Rake::RDocTask.new do |rdoc| - files = ['README', 'LICENSE', - 'lib/**/*.rb'] - rdoc.rdoc_files.add(files) - rdoc.main = 'README' - rdoc.title = 'Merb Helper Docs' - rdoc.rdoc_dir = 'doc/rdoc' - rdoc.options << '--line-numbers' << '--inline-source' +namespace :jruby do + desc "Run :package and install the resulting .gem with jruby" + task :install => :package do + sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION}.gem --no-rdoc --no-ri} + end end - -Spec::Rake::SpecTask.new do |t| - t.spec_opts = ["--format", "specdoc", "--colour"] - t.spec_files = Dir['spec/**/*_spec.rb'].sort +############################################################################## +# Specs +############################################################################## +desc "Run all specs" +Spec::Rake::SpecTask.new("specs") do |t| + t.spec_opts = ["--format", "specdoc", "--colour"] + t.spec_files = Dir["spec/**/*_spec.rb"].sort end desc "Run all specs and generate an rcov report" Spec::Rake::SpecTask.new('rcov') do |t| t.spec_files = FileList['spec/**/*_spec.rb'] @@ -65,6 +76,17 @@ t.rcov = true t.rcov_dir = 'coverage' t.rcov_opts = ['--exclude', 'gems', '--exclude', 'spec'] end - +############################################################################## +# Documentation +############################################################################## +Rake::RDocTask.new do |rdoc| + files = ['README', 'LICENSE', + 'lib/**/*.rb'] + rdoc.rdoc_files.add(files) + rdoc.main = 'README' + rdoc.title = 'Merb Helper Docs' + rdoc.rdoc_dir = 'doc/rdoc' + rdoc.options << '--line-numbers' << '--inline-source' +end