Rakefile in merb_datamapper-0.9.2 vs Rakefile in merb_datamapper-0.9.3
- old
+ new
@@ -1,46 +1,58 @@
require 'rubygems'
-require 'rake/gempackagetask'
+require 'spec'
+require 'spec/rake/spectask'
+require 'pathname'
-PLUGIN = "merb_datamapper"
-NAME = "merb_datamapper"
-VERSION = "0.9.2"
+ROOT = Pathname(__FILE__).dirname.expand_path
+require ROOT + 'lib/merb_datamapper/version'
+
AUTHOR = "Jason Toy"
-EMAIL = "jtoy@rubynow.com"
-HOMEPAGE = "http://merbivore.com"
-SUMMARY = "Merb plugin that provides DataMapper support for Merb"
+EMAIL = "jtoy@rubynow.com"
+GEM_NAME = "merb_datamapper"
+GEM_VERSION = DataMapper::MerbDataMapper::VERSION
+GEM_DEPENDENCIES = [["dm-core", GEM_VERSION], ["dm-migrations", GEM_VERSION], ["merb-core", ">=0.9.3"]]
+GEM_CLEAN = ["log", "pkg", "coverage"]
+GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO ] }
-spec = Gem::Specification.new do |s|
- s.name = NAME
- s.version = 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.2')
- s.add_dependency('datamapper', '>= 0.2.3')
- s.require_path = 'lib'
- s.autorequire = PLUGIN
- s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs,datamapper_generators}/**/*")
-end
+PROJECT_NAME = "datamapper"
+PROJECT_URL = "http://github.com/sam/dm-more/tree/master/merb_datamapper"
+PROJECT_DESCRIPTION = PROJECT_SUMMARY = "DataMapper plugin providing DataMapper support for Merb"
-windows = (PLATFORM =~ /win32|cygwin/) rescue nil
+require ROOT.parent + 'tasks/hoe'
-SUDO = windows ? "" : "sudo"
+task :default => [ :spec ]
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
+WIN32 = (RUBY_PLATFORM =~ /win32|mingw|cygwin/) rescue nil
+SUDO = WIN32 ? '' : ('sudo' unless ENV['SUDOLESS'])
+
+desc "Install #{GEM_NAME} #{GEM_VERSION} (default ruby)"
+task :install => [ :package ] do
+ sh "#{SUDO} gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources", :verbose => false
end
-desc "Install merb_datamapper"
-task :install => :package do
- sh %{#{SUDO} gem install pkg/#{NAME}-#{VERSION} --no-rdoc --no-ri --no-update-sources}
+desc "Uninstall #{GEM_NAME} #{GEM_VERSION} (default ruby)"
+task :uninstall => [ :clobber ] do
+ sh "#{SUDO} gem uninstall #{GEM_NAME} -v#{GEM_VERSION} -I -x", :verbose => false
end
-desc 'Release the current version on rubyforge'
-task :release => :package do
- sh %{rubyforge add_release merb #{PLUGIN} #{VERSION} pkg/#{NAME}-#{VERSION}.gem}
+namespace :jruby do
+ desc "Install #{GEM_NAME} #{GEM_VERSION} with JRuby"
+ task :install => [ :package ] do
+ sh %{#{SUDO} jruby -S gem install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}, :verbose => false
+ end
+end
+
+desc 'Run specifications'
+Spec::Rake::SpecTask.new(:spec) do |t|
+ t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
+ t.spec_files = Pathname.glob(Pathname.new(__FILE__).dirname + 'spec/**/*_spec.rb')
+
+ begin
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
+ t.rcov_opts << '--exclude' << 'spec'
+ t.rcov_opts << '--text-summary'
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
+ rescue Exception
+ # rcov not installed
+ end
end