Browse files

Add Rake tasks for Yard and Yardstick.

  • Loading branch information...
1 parent 7f1b8c6 commit 515507cd6457c6a3bc31772555c3bd66db0f585a @antw antw committed Jan 12, 2010
Showing with 90 additions and 24 deletions.
  1. +4 −2 .gitignore
  2. +19 −22 Rakefile
  3. +37 −0 tasks/spec.rake
  4. +9 −0 tasks/yard.rake
  5. +21 −0 tasks/yardstick.rake
View
6 .gitignore
@@ -1,7 +1,9 @@
*.sw?
.DS_Store
+.yardoc
coverage
-rdoc
+doc
+measurements
pkg
+rdoc
script/dumps
-
View
41 Rakefile
@@ -4,32 +4,29 @@ require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
- gem.name = "dm-mongo-adapter"
- gem.summary = %Q{Mongo DataMapper Adapter.}
- gem.email = "shane.hanna@gmail.com, piotr.solnica@gmail.com, lcarlson@rubyskills.com"
- gem.homepage = "http://github.com/solnic/dm-mongo-adapter"
- gem.authors = ['Shane Hanna', 'Piotr Solnica', 'Lance Carlson']
+ gem.name = 'dm-mongo-adapter'
+ gem.summary = 'Mongo DataMapper Adapter'
+ gem.description = 'An adapter the DataMapper ORM which adds support for MongoDB.'
+ gem.email = "shane.hanna@gmail.com, piotr.solnica@gmail.com, lcarlson@rubyskills.com"
+ gem.homepage = "http://github.com/solnic/dm-mongo-adapter"
+ gem.authors = ['Shane Hanna', 'Piotr Solnica', 'Lance Carlson']
+
+ gem.has_rdoc = false
+
+ # Dependencies
gem.add_dependency 'dm-core', '~> 0.10.0'
- gem.add_dependency 'mongo', '~> 0.18.2' # gemcutter
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ gem.add_dependency 'mongo', '~> 0.18.2'
+ gem.add_development_dependency 'rspec', '>= 1.2.0'
+ gem.add_development_dependency 'yard', '>= 0.5'
+ gem.add_development_dependency 'yardstick', '>= 0.1'
end
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
-end
-require 'spec/rake/spectask'
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
-end
-
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
- spec.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
+ FileList['tasks/**/*.rake'].each { |task| import task }
+rescue LoadError
+ puts 'Jeweler (or a dependency) not available. Install it with: sudo gem ' \
+ 'install jeweler'
end
task :install_fast do
sh "rake build; gem install pkg/dm-mongo-adapter*.gem --local"
-end
+end
View
37 tasks/spec.rake
@@ -0,0 +1,37 @@
+spec_defaults = lambda do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.libs << 'lib' << 'spec'
+ spec.spec_opts << '--options' << 'spec/spec.opts'
+end
+
+begin
+ require 'spec/rake/spectask'
+ Spec::Rake::SpecTask.new(:spec, &spec_defaults)
+rescue LoadError
+ task :spec do
+ abort 'rspec is not available. In order to run spec, you must: gem ' \
+ 'install rspec'
+ end
+end
+
+begin
+ require 'rcov'
+ require 'spec/rake/verify_rcov'
+
+ Spec::Rake::SpecTask.new(:rcov) do |rcov|
+ spec_defaults.call(rcov)
+ rcov.rcov = true
+ rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
+ end
+
+ RCov::VerifyTask.new('rcov:verify' => :rcov) do |rcov|
+ rcov.threshold = 100
+ end
+rescue LoadError
+ %w(rcov rcov:verify).each do |name|
+ task name do
+ abort "rcov is not available. In order to run #{name}, you must: gem " \
+ "install rcov"
+ end
+ end
+end
View
9 tasks/yard.rake
@@ -0,0 +1,9 @@
+begin
+ require 'yard'
+ YARD::Rake::YardocTask.new
+rescue LoadError
+ task :yard do
+ abort 'YARD is not available. In order to run yard, you must: gem ' \
+ 'install yard'
+ end
+end
View
21 tasks/yardstick.rake
@@ -0,0 +1,21 @@
+begin
+ require 'pathname'
+ require 'yardstick'
+ require 'yardstick/rake/measurement'
+ require 'yardstick/rake/verify'
+
+ # yardstick_measure task
+ Yardstick::Rake::Measurement.new('yardstick')
+
+ # verify_measurements task
+ Yardstick::Rake::Verify.new('yardstick:verify') do |verify|
+ verify.threshold = 100
+ end
+rescue LoadError
+ %w(yardstick yardstick:verify).each do |name|
+ task name do
+ abort "Yardstick is not available. In order to run #{name}, you " \
+ "must: gem install yardstick"
+ end
+ end
+end

0 comments on commit 515507c

Please sign in to comment.