Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Devtools conversion #4

Merged
merged 10 commits into from

2 participants

Commits on Jan 17, 2013
Commits on Jan 18, 2013
  1. Add devtools gem dependency

    authored
    * Update gem to work within devtools framework.
  2. Merge branch 'master' into devtools

    authored
    Conflicts:
    	.travis.yml
Commits on Jan 19, 2013
  1. Merge branch 'master' into devtools

    authored
    Conflicts:
    	Gemfile
  2. Fix specs to expand the filename before comparison

    authored
    * This should fix some spec failures under ruby 1.8
This page is out of date. Refresh to see the latest.
View
4 .rspec
@@ -0,0 +1,4 @@
+--color
+--format progress
+--profile
+--order random
View
2  .travis.yml
@@ -1,7 +1,7 @@
language: ruby
before_install: gem install bundler
bundler_args: --without yard guard benchmarks
-script: "bundle exec rake spec"
+script: "bundle exec rake ci"
rvm:
- ree
- 1.8.7
View
54 Gemfile
@@ -4,55 +4,5 @@ source 'https://rubygems.org'
gemspec
-group :yard do
- gem 'yard', '~> 0.8.3'
- gem 'redcarpet', '~> 2.2.2', :platforms => [ :mri, :rbx ]
-end
-
-group :guard do
- gem 'guard', '~> 1.5.4'
- gem 'guard-bundler', '~> 1.0.0'
- gem 'guard-rspec', '~> 1.2.1'
-end
-
-group :benchmarks do
- gem 'rbench', '~> 0.2.3'
-end
-
-platform :jruby do
- group :jruby do
- gem 'jruby-openssl', '~> 0.7.4'
- end
-end
-
-group :metrics do
- gem 'flay', '~> 1.4.3'
- gem 'flog', '~> 2.5.3'
- gem 'roodi', '~> 2.1.0'
- gem 'yardstick', '~> 0.8.0'
-
- platforms :ruby_18, :ruby_19 do
- # this indirectly depends on ffi which does not build on ruby-head
- gem 'yard-spellcheck', '~> 0.1.5'
- end
-
- platforms :mri_18 do
- gem 'arrayfields', '~> 4.7.4' # for metric_fu
- gem 'fattr', '~> 2.2.0' # for metric_fu
- gem 'heckle', '~> 1.4.3'
- gem 'json', '~> 1.7.3' # for metric_fu rake task
- gem 'map', '~> 6.2.0' # for metric_fu
- gem 'metric_fu', '~> 2.1.1'
- gem 'mspec', '~> 1.5.17'
- gem 'rcov', '~> 1.0.0'
- gem 'ruby2ruby', '= 1.2.2' # for heckle
- end
-
- platforms :ruby_19 do
- gem 'simplecov', '~> 0.7.1'
- end
-
- platforms :rbx do
- gem 'pelusa', '~> 0.2.1'
- end
-end
+gem 'devtools', :git => 'https://github.com/datamapper/devtools.git'
+eval File.read('Gemfile.devtools')
View
67 Gemfile.devtools
@@ -0,0 +1,67 @@
+# encoding: utf-8
+
+group :development do
+ gem 'rake', '~> 10.0.3'
+ gem 'rspec', '~> 2.12.0'
+ gem 'yard', '~> 0.8.3'
+end
+
+group :yard do
+ gem 'redcarpet', '~> 2.2.2', :platforms => [ :mri, :rbx ]
+end
+
+group :guard do
+ gem 'guard', '~> 1.6.1'
+ gem 'guard-bundler', '~> 1.0.0'
+ gem 'guard-rspec', '~> 2.3.3'
+
+ # file system change event handling
+ gem 'rb-fchange', '~> 0.0.6', :require => false
+ gem 'rb-fsevent', '~> 0.9.3', :require => false
+ gem 'rb-inotify', '~> 0.9.0', :require => false
+
+ # Remove this one https://github.com/guard/listen/pull/78 is released
+ gem 'listen', '~> 0.7.2', :git => 'https://github.com/guard/listen'
+
+ # notification handling
+ gem 'libnotify', '~> 0.8.0', :require => false
+ gem 'rb-notifu', '~> 0.0.4', :require => false
+ gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
+end
+
+group :metrics do
+ gem 'backports', '~> 2.6.5'
+ gem 'flay', '~> 1.4.3'
+ gem 'flog', '~> 2.5.3'
+ gem 'mutant', '~> 0.2.15'
+ gem 'reek', '~> 1.2.13', :git => 'https://github.com/troessner/reek.git'
+ gem 'roodi', '~> 2.1.0'
+ gem 'yardstick', '~> 0.8.0'
+
+ platforms :ruby_18, :ruby_19 do
+ # this indirectly depends on ffi which does not build on ruby-head
+ gem 'yard-spellcheck', '~> 0.1.5'
+ end
+
+ platforms :mri_18 do
+ gem 'rcov', '~> 1.0.0'
+ end
+
+ platforms :mri_19 do
+ gem 'simplecov', '~> 0.7.1'
+ end
+
+ platforms :rbx do
+ gem 'pelusa', '~> 0.2.2'
+ end
+end
+
+group :benchmarks do
+ gem 'rbench', '~> 0.2.3'
+end
+
+platform :jruby do
+ group :jruby do
+ gem 'jruby-openssl', '~> 0.8.2'
+ end
+end
View
7 Rakefile
@@ -1,9 +1,6 @@
# encoding: utf-8
require 'rake'
+require 'devtools'
-require File.expand_path('../lib/abstract_type/version', __FILE__)
-
-FileList['tasks/**/*.rake'].each { |task| import task }
-
-task :default => :spec
+Devtools.init
View
5 abstract_type.gemspec
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
gem.test_files = `git ls-files -- {spec}/*`.split($/)
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
- gem.add_development_dependency('rake', '~> 10.0.2')
- gem.add_development_dependency('rspec', '~> 1.3.2')
+ gem.add_development_dependency('rake', '~> 10.0.2')
+ gem.add_development_dependency('rspec', '~> 1.3.2')
+ gem.add_development_dependency('backports', '~> 2.7.0')
end
View
3  config/mutant.yml
@@ -0,0 +1,3 @@
+---
+name: abstract_type
+namespace: AbstractType
View
7 spec/rcov.opts
@@ -1,7 +0,0 @@
---exclude-only "spec/,^/"
---sort coverage
---callsites
---xrefs
---profile
---text-summary
---failure-threshold 100
View
3  spec/spec.opts
@@ -1,3 +0,0 @@
---color
---loadby random
---format profile
View
22 spec/spec_helper.rb
@@ -1,11 +1,25 @@
# encoding: utf-8
+if ENV['COVERAGE'] == 'true'
+ require 'simplecov'
+
+ SimpleCov.start do
+ command_name 'spec:unit'
+ add_filter 'config'
+ add_filter 'spec'
+ minimum_coverage 100
+ end
+end
+
require 'abstract_type'
-require 'spec'
-require 'spec/autorun'
+require 'backports'
+require 'rspec'
+require 'rspec/autorun' if RUBY_VERSION < '1.9'
# require spec support files and shared behavior
-Dir[File.expand_path('../{support,shared}/**/*.rb', __FILE__)].each { |f| require f }
+Dir[File.expand_path('../{support,shared}/**/*.rb', __FILE__)].each do |file|
+ require file
+end
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
end
View
47 spec/unit/abstract_type/class_methods/abstract_method_spec.rb
@@ -3,31 +3,46 @@
require 'spec_helper'
describe AbstractType::ClassMethods, '#abstract_method' do
- subject { object.some_method }
+ subject { object.abstract_method(:some_method) }
- let(:abstract_type) do
- Class.new do
- include AbstractType
-
- abstract_method :some_method
- end
- end
-
- let(:class_under_test) do
- Class.new(abstract_type)
- end
+ let(:object) { Class.new { include AbstractType } }
+ let(:subclass) { Class.new(object) }
before do
- TheClassName = class_under_test
+ Subclass = subclass
end
after do
- Object.class_eval { remove_const(:TheClassName) }
+ Object.class_eval { remove_const(:Subclass) }
end
- let(:object) { class_under_test.new }
+ it { should equal(object) }
it 'creates an abstract method' do
- expect { subject }.to raise_error(NotImplementedError,'TheClassName#some_method is not implemented')
+ expect { subject }.to change { subclass.method_defined?(:some_method) }.
+ from(false).
+ to(true)
+ end
+
+ specification = proc do
+ subject
+ begin
+ subclass.new.some_method
+ rescue NotImplementedError => error
+ error.message.should == 'Subclass#some_method is not implemented'
+ file, line = error.backtrace.first.split(':')[0, 2]
+ File.expand_path(file).should eql(File.expand_path('../../../../../lib/abstract_type.rb', __FILE__))
+ line.to_i.should be(111)
+ else
+ raise 'expected error not raised'
+ end
+ end
+
+ it 'sets the file and line number properly' do
+ if RUBY_PLATFORM.include?('java')
+ pending('Kernel#caller returns the incorrect line number in JRuby', &specification)
+ else
+ instance_eval(&specification)
+ end
end
end
View
45 spec/unit/abstract_type/class_methods/abstract_singleton_method_spec.rb
@@ -2,26 +2,47 @@
require 'spec_helper'
-describe AbstractType::ClassMethods, '#abstract_method' do
- subject { object.some_method }
+describe AbstractType::ClassMethods, '#abstract_singleton_method' do
+ subject { object.abstract_singleton_method(:some_method) }
- let(:object) do
- Class.new do
- include AbstractType
-
- abstract_singleton_method :some_method
- end
- end
+ let(:object) { Class.new { include AbstractType } }
+ let(:subclass) { Class.new(object) }
before do
- TheClassName = object
+ Subclass = subclass
end
after do
- Object.class_eval { remove_const(:TheClassName) }
+ Object.class_eval { remove_const(:Subclass) }
end
+ it { should equal(object) }
+
it 'creates an abstract method' do
- expect { subject }.to raise_error(NotImplementedError, 'TheClassName.some_method is not implemented')
+ expect { subject }.to change { subclass.respond_to?(:some_method) }.
+ from(false).
+ to(true)
+ end
+
+ specification = proc do
+ subject
+ begin
+ subclass.some_method
+ rescue NotImplementedError => error
+ error.message.should == 'Subclass.some_method is not implemented'
+ file, line = error.backtrace.first.split(':')[0, 2]
+ File.expand_path(file).should eql(File.expand_path('../../../../../lib/abstract_type.rb', __FILE__))
+ line.to_i.should be(95)
+ else
+ raise 'expected error not raised'
+ end
+ end
+
+ it 'sets the file and line number properly' do
+ if RUBY_PLATFORM.include?('java')
+ pending('Kernel#caller returns the incorrect line number in JRuby', &specification)
+ else
+ instance_eval(&specification)
+ end
end
end
View
26 spec/unit/abstract_type/class_methods/included_spec.rb
@@ -0,0 +1,26 @@
+# encoding: utf-8
+
+require 'spec_helper'
+
+describe AbstractType, '.included' do
+ subject { object }
+
+ let(:object) { described_class }
+ let(:klass) { Class.new }
+
+ it 'extends the klass' do
+ klass.singleton_class.should_not include(described_class::ClassMethods)
+ klass.send(:include, subject)
+ klass.singleton_class.should include(described_class::ClassMethods)
+ end
+
+ it 'delegates to the ancestor' do
+ included_ancestor = false
+ subject.extend Module.new {
+ define_method(:included) { |_| included_ancestor = true }
+ }
+ expect {
+ klass.send(:include, subject)
+ }.to change { included_ancestor }.from(false).to(true)
+ end
+end
View
9 tasks/metrics/ci.rake
@@ -1,9 +0,0 @@
-# encoding: utf-8
-
-desc 'Run metrics with Heckle'
-task :ci => %w[ ci:metrics metrics:heckle ]
-
-namespace :ci do
- desc 'Run metrics (except heckle) and spec'
- task :metrics => %w[ spec metrics:verify_measurements metrics:flog metrics:flay metrics:reek metrics:roodi metrics:all ]
-end
View
45 tasks/metrics/flay.rake
@@ -1,45 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'flay'
- require 'yaml'
-
- config = YAML.load_file(File.expand_path('../../../config/flay.yml', __FILE__)).freeze
- threshold = config.fetch('threshold').to_i
- total_score = config.fetch('total_score').to_f
- files = Flay.expand_dirs_to_files(config.fetch('path', 'lib')).sort
-
- namespace :metrics do
- # original code by Marty Andrews:
- # http://blog.martyandrews.net/2009/05/enforcing-ruby-code-quality.html
- desc 'Analyze for code duplication'
- task :flay do
- # run flay once without a threshold to ensure the max mass matches the threshold
- flay = Flay.new(:fuzzy => false, :verbose => false, :mass => 0)
- flay.process(*files)
-
- max = (flay.masses.map { |hash, mass| mass.to_f / flay.hashes[hash].size }.max) || 0
- unless max >= threshold
- raise "Adjust flay threshold down to #{max}"
- end
-
- total = flay.masses.reduce(0.0) { |total, (hash, mass)| total + (mass.to_f / flay.hashes[hash].size) }
- unless total == total_score
- raise "Flay total is now #{total}, but expected #{total_score}"
- end
-
- # run flay a second time with the threshold set
- flay = Flay.new(:fuzzy => false, :verbose => false, :mass => threshold.succ)
- flay.process(*files)
-
- if flay.masses.any?
- flay.report
- raise "#{flay.masses.size} chunks of code have a duplicate mass > #{threshold}"
- end
- end
- end
-rescue LoadError
- task :flay do
- $stderr.puts 'Flay is not available. In order to run flay, you must: gem install flay'
- end
-end
View
49 tasks/metrics/flog.rake
@@ -1,49 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'flog'
- require 'yaml'
-
- class Float
- def round_to(n)
- (self * 10**n).round.to_f * 10**-n
- end
- end
-
- config = YAML.load_file(File.expand_path('../../../config/flog.yml', __FILE__)).freeze
- threshold = config.fetch('threshold').to_f.round_to(1)
-
- namespace :metrics do
- # original code by Marty Andrews:
- # http://blog.martyandrews.net/2009/05/enforcing-ruby-code-quality.html
- desc 'Analyze for code complexity'
- task :flog do
- flog = Flog.new
- flog.flog Array(config.fetch('path', 'lib'))
-
- totals = flog.totals.select { |name, score| name[-5, 5] != '#none' }.
- map { |name, score| [ name, score.round_to(1) ] }.
- sort_by { |name, score| score }
-
- if totals.any?
- max = totals.last[1]
- unless max >= threshold
- raise "Adjust flog score down to #{max}"
- end
- end
-
- bad_methods = totals.select { |name, score| score > threshold }
- if bad_methods.any?
- bad_methods.reverse_each do |name, score|
- puts '%8.1f: %s' % [ score, name ]
- end
-
- raise "#{bad_methods.size} methods have a flog complexity > #{threshold}"
- end
- end
- end
-rescue LoadError
- task :flog do
- $stderr.puts 'Flog is not available. In order to run flog, you must: gem install flog'
- end
-end
View
208 tasks/metrics/heckle.rake
@@ -1,208 +0,0 @@
-# encoding: utf-8
-
-$LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__))
-
-# original code by Ashley Moran:
-# http://aviewfromafar.net/2007/11/1/rake-task-for-heckling-your-specs
-
-begin
- require 'pathname'
- require 'heckle'
- require 'mspec'
- require 'mspec/utils/name_map'
-
- SKIP_METHODS = %w[ blank_slate_method_added ].freeze
-
- class NameMap
- def file_name(method, constant)
- map = MAP[method]
- name = if map
- map[constant] || map[:default]
- else
- method.gsub(/[?!=]\z/, '')
- end
- "#{name}_spec.rb"
- end
- end
-
- namespace :metrics do
- desc 'Heckle each module and class'
- task :heckle => :coverage do
- unless Ruby2Ruby::VERSION == '1.2.2'
- raise "ruby2ruby version #{Ruby2Ruby::VERSION} may not work properly, 1.2.2 *only* is recommended for use with heckle"
- end
-
- require 'abstract_type'
-
- root_module_regexp = Regexp.union('AbstractType')
-
- spec_dir = Pathname('spec/unit')
-
- NameMap::MAP.each do |op, method|
- next if method.kind_of?(Hash)
- NameMap::MAP[op] = { :default => method }
- end
-
- aliases = Hash.new { |h,mod| h[mod] = Hash.new { |h,method| h[method] = method } }
- map = NameMap.new
-
- heckle_caught_modules = Hash.new { |hash, key| hash[key] = [] }
- uncovered_methods = 0
-
- ObjectSpace.each_object(Module) do |mod|
- next unless mod.name =~ /\A#{root_module_regexp}(?::|\z)/
-
- spec_prefix = spec_dir.join(mod.name.underscore)
-
- specs = []
-
- # get the public class methods
- metaclass = class << mod; self end
- ancestors = metaclass.ancestors
-
- spec_class_methods = mod.singleton_methods(false)
-
- spec_class_methods.reject! do |method|
- %w[ yaml_new yaml_tag_subclasses? included nesting constants ].include?(method.to_s)
- end
-
- if mod.ancestors.include?(Singleton)
- spec_class_methods.reject! { |method| method.to_s == 'instance' }
- end
-
- # get the protected and private class methods
- other_class_methods = metaclass.protected_instance_methods(false) |
- metaclass.private_instance_methods(false)
-
- ancestors.each do |ancestor|
- other_class_methods -= ancestor.protected_instance_methods(false) |
- ancestor.private_instance_methods(false)
- end
-
- other_class_methods.reject! do |method|
- method.to_s == 'allocate' || SKIP_METHODS.include?(method.to_s)
- end
-
- other_class_methods.reject! do |method|
- next unless spec_class_methods.any? { |specced| specced.to_s == $1 }
-
- spec_class_methods << method
- end
-
- spec_class_methods -= other_class_methods
-
- # get the instances methods
- spec_methods = mod.public_instance_methods(false)
-
- other_methods = mod.protected_instance_methods(false) |
- mod.private_instance_methods(false)
-
- other_methods.reject! do |method|
- next unless spec_methods.any? { |specced| specced.to_s == $1 }
-
- spec_methods << method
- end
-
- # map the class methods to spec files
- spec_class_methods.each do |method|
- method = aliases[mod.name][method]
- next if SKIP_METHODS.include?(method.to_s)
-
- spec_file = spec_prefix.join('class_methods').join(map.file_name(method, mod.name))
-
- unless spec_file.file?
- raise "No spec file #{spec_file} for #{mod}.#{method}"
- end
-
- specs << [ ".#{method}", [ spec_file ] ]
- end
-
- # map the instance methods to spec files
- spec_methods.each do |method|
- method = aliases[mod.name][method]
- next if SKIP_METHODS.include?(method.to_s)
-
- spec_file = spec_prefix.join(map.file_name(method, mod.name))
-
- unless spec_file.file?
- raise "No spec file #{spec_file} for #{mod}##{method}"
- end
-
- specs << [ "##{method}", [ spec_file ] ]
- end
-
- # non-public methods are considered covered if they can be mutated
- # and any spec fails for the current or descendant modules
- other_methods.each do |method|
- descedant_specs = []
-
- ObjectSpace.each_object(Module) do |descedant|
- next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
- descedant_spec_prefix = spec_dir.join(descedant.name.underscore)
- descedant_specs << descedant_spec_prefix
-
- if method.to_s == 'initialize'
- descedant_specs.concat(Pathname.glob(descedant_spec_prefix.join('class_methods/new_spec.rb')))
- end
- end
-
- specs << [ "##{method}", descedant_specs ]
- end
-
- other_class_methods.each do |method|
- descedant_specs = []
-
- ObjectSpace.each_object(Module) do |descedant|
- next unless descedant.name =~ /\A#{root_module_regexp}(?::|\z)/ && mod >= descedant
- descedant_specs << spec_dir.join(descedant.name.underscore).join('class_methods')
- end
-
- specs << [ ".#{method}", descedant_specs ]
- end
-
- specs.sort.each do |(method, spec_files)|
- puts "Heckling #{mod}#{method}"
- IO.popen("spec #{spec_files.join(' ')} --heckle '#{mod}#{method}'") do |pipe|
- while line = pipe.gets
- case line = line.chomp
- when "The following mutations didn't cause test failures:"
- heckle_caught_modules[mod.name] << method
- uncovered_methods += 1
- end
- end
- end
- end
- end
-
- if uncovered_methods > 0
- error_message_lines = [ "*************\n" ]
-
- error_message_lines << "Heckle found #{uncovered_methods} " \
- "method#{"s" unless uncovered_methods == 1} " \
- "where mutations didn't cause spec violations\n"
-
- heckle_caught_modules.each do |mod, methods|
- error_message_lines << "#{mod} contains the following " \
- 'poorly-specified methods:'
- methods.each do |method|
- error_message_lines << " - #{method}"
- end
- error_message_lines << ''
- end
-
- error_message_lines << 'Get your act together and come back ' \
- 'when your specs are doing their job!'
-
- raise error_message_lines.join("\n")
- else
- puts 'Well done! Your code withstood a heckling.'
- end
- end
- end
-rescue LoadError
- namespace :metrics do
- task :heckle => :coverage do
- $stderr.puts 'Heckle or mspec is not available. In order to run heckle, you must: gem install heckle mspec'
- end
- end
-end
View
31 tasks/metrics/metric_fu.rake
@@ -1,31 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'metric_fu'
- require 'json'
-
- # XXX: temporary hack until metric_fu is fixed
- MetricFu::Saikuro.class_eval { include FileUtils }
-
- MetricFu::Configuration.run do |config|
- config.rcov = {
- :environment => 'test',
- :test_files => %w[ spec/**/*_spec.rb ],
- :rcov_opts => %w[
- --sort coverage
- --no-html
- --text-coverage
- --no-color
- --profile
- --exclude spec/,^/
- --include lib:spec
- ],
- }
- end
-rescue LoadError
- namespace :metrics do
- task :all do
- $stderr.puts 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
- end
- end
-end
View
21 tasks/metrics/reek.rake
@@ -1,21 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'reek/rake/task'
-
- RBX_18_MODE = RUBY_VERSION < '1.9' && defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
-
- namespace :metrics do
- Reek::Rake::Task.new do |t|
- # reek has some problems under rbx in 1.8 mode that cause the underlying
- # script to raise an exception. Rather than halt the "rake ci" process due
- # to one bug, we choose to ignore it in this specific case until reek can be
- # fixed.
- t.fail_on_error = ! RBX_18_MODE # always true, except under rbx 18 mode
- end
- end
-rescue LoadError
- task :reek do
- $stderr.puts 'Reek is not available. In order to run reek, you must: gem install reek'
- end
-end
View
19 tasks/metrics/roodi.rake
@@ -1,19 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'roodi'
- require 'rake/tasklib'
- require 'roodi_task'
-
- namespace :metrics do
- RoodiTask.new do |t|
- t.verbose = false
- t.config = File.expand_path('../../../config/roodi.yml', __FILE__)
- t.patterns = %w[ lib/**/*.rb ]
- end
- end
-rescue LoadError
- task :roodi do
- $stderr.puts 'Roodi is not available. In order to run roodi, you must: gem install roodi'
- end
-end
View
25 tasks/metrics/yardstick.rake
@@ -1,25 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'yardstick/rake/measurement'
- require 'yardstick/rake/verify'
- require 'yaml'
-
- config = YAML.load_file(File.expand_path('../../../config/yardstick.yml', __FILE__))
-
- namespace :metrics do
- # yardstick_measure task
- Yardstick::Rake::Measurement.new
-
- # verify_measurements task
- Yardstick::Rake::Verify.new do |verify|
- verify.threshold = config.fetch('threshold')
- end
- end
-rescue LoadError
- %w[ yardstick_measure verify_measurements ].each do |name|
- task name.to_s do
- $stderr.puts "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
- end
- end
-end
View
60 tasks/spec.rake
@@ -1,60 +0,0 @@
-# encoding: utf-8
-
-spec_defaults = lambda do |spec|
- spec.ruby_opts = %w[ -r./spec/support/config_alias ]
- spec.spec_opts << '--options' << 'spec/spec.opts'
-end
-
-begin
- require 'spec/rake/spectask'
-
- desc 'Run all specs'
- task :spec => %w[ spec:unit spec:integration ]
-
- namespace :spec do
- desc 'Run unit specs'
- Spec::Rake::SpecTask.new(:unit) do |unit|
- spec_defaults.call(unit)
- unit.pattern = 'spec/unit/**/*_spec.rb'
- end
-
- desc 'Run integration specs'
- Spec::Rake::SpecTask.new(:integration) do |integration|
- spec_defaults.call(integration)
- integration.pattern = 'spec/integration/**/*_spec.rb'
- end
- end
-rescue LoadError
- %w[ spec spec:unit spec:integration ].each do |name|
- task name do
- $stderr.puts "rspec is not available. In order to run #{name}, you must: gem install rspec"
- end
- end
-end
-
-namespace :metrics do
- begin
- if RUBY_VERSION < '1.9'
- desc 'Generate code coverage'
- Spec::Rake::SpecTask.new(:coverage) do |rcov|
- spec_defaults.call(rcov)
- rcov.rcov = true
- rcov.pattern = 'spec/unit/**/*_spec.rb'
- rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
- end
- else
- desc 'Generate code coverage'
- task :coverage do
- ENV['COVERAGE'] = 'true'
- Rake::Task['spec:unit'].execute
- end
- end
- rescue LoadError
- task :coverage do
- lib = RUBY_VERSION < '1.9' ? 'rcov' : 'simplecov'
- $stderr.puts "coverage is not available. In order to run #{lib}, you must: gem install #{lib}"
- end
- end
-end
-
-task :test => :spec
View
11 tasks/yard.rake
@@ -1,11 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'yard'
-
- YARD::Rake::YardocTask.new
-rescue LoadError
- task :yard do
- $stderr.puts 'YARD is not available. In order to run yard, you must: gem install yard'
- end
-end
Something went wrong with that request. Please try again.