Rakefile in merb_sequel-0.9.3 vs Rakefile in merb_sequel-0.9.4

- old
+ new

@@ -1,48 +1,79 @@ -require "rubygems" -require "rake/gempackagetask" +require 'rubygems' +require 'rake/gempackagetask' +require "rake/rdoctask" +require "extlib" +require 'merb-core/tasks/merb_rake_helper' +require "spec/rake/spectask" -PLUGIN = "merb_sequel" -NAME = "merb_sequel" -VERSION = "0.9.3" -AUTHOR = "Wayne E. Seguin, Lance Carlson" -EMAIL = "wayneeseguin@gmail.com, lancecarlson@gmail.com" -HOMEPAGE = "http://merb-plugins.rubyforge.org/merb_sequel/" -SUMMARY = "Merb plugin that provides support for Sequel and Sequel::Model" +############################################################################## +# Package && release +############################################################################## +RUBY_FORGE_PROJECT = "merb" +PROJECT_URL = "http://merbivore.com" +PROJECT_SUMMARY = "Merb plugin that provides support for Sequel and Sequel::Model" +PROJECT_DESCRIPTION = PROJECT_SUMMARY -specification = Gem::Specification.new do |spec| - spec.name = NAME - spec.email = EMAIL - spec.author = AUTHOR - spec.version = VERSION - spec.summary = SUMMARY - spec.platform = Gem::Platform::RUBY - spec.has_rdoc = true - spec.homepage = HOMEPAGE - spec.description = SUMMARY - spec.autorequire = PLUGIN - spec.require_path = "lib" - spec.extra_rdoc_files = ["README", "LICENSE", 'TODO'] - # Dependencies - #spec.add_dependency("merb", ">= 0.9") - spec.add_dependency("merb-core", ">= 0.9.3") # This will probably only be temporary until there is an official merb gem greater than 0.9 - spec.add_dependency("sequel", ">= 1.4.0") - spec.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs,sequel_generators}/**/*") +GEM_AUTHOR = "Wayne E. Seguin, Lance Carlson" +GEM_EMAIL = "wayneeseguin@gmail.com, lancecarlson@gmail.com" + +GEM_NAME = "merb_sequel" +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.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 = 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.add_dependency("sequel", ">= 1.4.0") + s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs,sequel_generators}/**/*") end -windows = (PLATFORM =~ /win32|cygwin/) rescue nil +Rake::GemPackageTask.new(spec) do |pkg| + pkg.gem_spec = spec +end -SUDO = windows ? "" : "sudo" +############################################################################## +# Installation +############################################################################## +desc "Install the gem" +task :install => [:package] do + sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources} +end -Rake::GemPackageTask.new(specification) do |package| - package.gem_spec = specification +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 -desc "Install merb_sequel" -task :install => :package do - sh %{#{SUDO} gem install pkg/#{NAME}-#{VERSION} --no-rdoc --no-ri --no-update-sources} +############################################################################## +# 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 'Release the current version on rubyforge' -task :release => :package do - sh %{rubyforge add_release merb #{PLUGIN} #{VERSION} pkg/#{NAME}-#{VERSION}.gem} +desc "Run all specs and generate an rcov report" +Spec::Rake::SpecTask.new('rcov') do |t| + t.spec_files = FileList['spec/**/*_spec.rb'] + t.spec_opts = ["--format", "specdoc", "--colour"] + t.rcov = true + t.rcov_dir = 'coverage' + t.rcov_opts = ['--exclude', 'gems', '--exclude', 'spec'] end