Permalink
Browse files

Update project to use devtools

  • Loading branch information...
1 parent 94cb086 commit a8d8ae7456c090e3d149b58937f82a0b9e0b97a1 @dkubb committed Mar 10, 2013
File renamed without changes.
View
@@ -1,18 +1,24 @@
language: ruby
before_install: gem install bundler
-bundler_args: --without guard metrics
-script: "bundle exec rake spec"
+bundler_args: --without yard guard benchmarks
+script: "bundle exec rake ci"
rvm:
+ - ree
- 1.8.7
- 1.9.2
- 1.9.3
+ - 2.0.0
+ - ruby-head
- jruby-18mode
- jruby-19mode
- rbx-18mode
- rbx-19mode
- - ree
- - ruby-head
- - jruby-head
notifications:
+ irc: "irc.freenode.org#datamapper"
email:
- dan.kubb@gmail.com
+matrix:
+ allow_failures:
+ - rvm: 1.9.3 # mutant coverage needed
+ - rvm: rbx-19mode # mutant coverage needed
+ - rvm: jruby-head # yard parser fails
View
64 Gemfile
@@ -6,65 +6,5 @@ gemspec
gem 'veritas', '~> 0.0.8', :github => 'dkubb/veritas'
-group :yard do
- gem 'kramdown', '~> 0.14.2'
-end
-
-group :guard do
- gem 'guard', '~> 1.6.2'
- gem 'guard-bundler', '~> 1.0.0'
- gem 'guard-rspec', '~> 1.2.1'
-
- # 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
-
- # 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 'flay', '= 1.4.3'
- gem 'flog', '= 2.5.3'
- gem 'metric_fu-roodi', '~> 2.2.1'
- gem 'yardstick', '~> 0.9.4'
-
- 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.7' # for metric_fu rake task
- gem 'map', '~> 6.3.0' # for metric_fu
- gem 'metric_fu', '~> 2.1.1'
- gem 'mspec', '~> 1.5.17'
- gem 'rails_best_practices', '= 1.13.3' # for metric_fu
- gem 'rcov', '~> 1.0.0'
- gem 'ruby2ruby', '= 1.2.2' # for heckle
- 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
+gem 'devtools', :git => 'https://github.com/datamapper/devtools.git'
+eval File.read('Gemfile.devtools')
View
@@ -0,0 +1,65 @@
+# encoding: utf-8
+
+group :development do
+ gem 'rake', '~> 10.0.3'
+ gem 'rspec', '~> 2.13.0'
+ gem 'yard', '~> 0.8.5'
+end
+
+group :yard do
+ gem 'kramdown', '~> 0.14.2'
+end
+
+group :guard do
+ gem 'guard', '~> 1.6.2'
+ gem 'guard-bundler', '~> 1.0.0'
+ gem 'guard-rspec', '~> 2.5.0'
+
+ # 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
+
+ gem 'listen', '~> 0.7.3'
+
+ # 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', '~> 3.0', '>= 3.1.0'
+ gem 'flay', '~> 2.1.0'
+ gem 'flog', '~> 3.2.2'
+ gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
+ gem 'metric_fu-roodi', '~> 2.2.1'
+ gem 'yardstick', '~> 0.9.4'
+
+ 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_19, :rbx do
+ gem 'mutant', '~> 0.2.20'
+ 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
@@ -4,7 +4,7 @@ guard :bundler do
watch('Gemfile')
end
-guard :rspec, :cli => File.read('spec/spec.opts').split.join(' '), :keep_failed => false do
+guard :rspec, :cli => File.read('.rspec').split.join(' '), :keep_failed => false do
# run all specs if configuration is modified
watch('Guardfile') { 'spec' }
watch('Gemfile.lock') { 'spec' }
View
@@ -1,9 +1,6 @@
# encoding: utf-8
require 'rake'
+require 'devtools'
-require File.expand_path('../lib/veritas/optimizer/version', __FILE__)
-
-FileList['tasks/**/*.rake'].each { |task| import task }
-
-task :default => :spec
+Devtools.init_rake_tasks
View
@@ -1,7 +1,3 @@
---
-1.8:
- threshold: 113
- total_score: 888
-1.9:
- threshold: 113
- total_score: 1469
+threshold: 66
+total_score: 931
View
@@ -1,2 +1,2 @@
---
-threshold: 23.3
+threshold: 19.4
View
@@ -0,0 +1,3 @@
+---
+name: veritas-optimizer
+namespace: Veritas::Optimizer
@@ -95,3 +95,6 @@ LongYieldList:
max_params: 1
exclude: []
enabled: true
+NilCheck:
+ enabled: false
+ exclude: []
@@ -1,7 +0,0 @@
-# encoding: utf-8
-
-shared_examples_for 'an idempotent method' do
- it 'is idempotent' do
- should equal(instance_eval(&self.class.subject))
- end
-end
View
@@ -1,17 +1,24 @@
# encoding: utf-8
-if RUBY_VERSION >= '1.9' and ENV['COVERAGE'] == 'true'
+require 'backports'
+require 'backports/basic_object' unless defined?(::BasicObject)
+require 'devtools'
+require 'ice_nine'
+
+Devtools.init_spec_helper
+
+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 'veritas-optimizer'
-require 'spec'
-require 'spec/autorun'
include Veritas
@@ -20,13 +27,6 @@
require file
end
-Spec::Runner.configure do |config|
+RSpec.configure do |config|
config.extend AddMethodMissing
end
-
-# change the heckle timeout to be 5 seconds
-if defined?(::Heckle)
- class ::Heckle
- @@timeout = 5
- end
-end
@@ -1,6 +1,6 @@
module IceNine
class Freezer
- class Spec < NoFreeze
+ class RSpec < NoFreeze
end
end
end
@@ -5,7 +5,7 @@
describe Optimizer::Function, '.optimize_functions' do
subject { object.optimize_functions(functions) }
- let(:object) { self.class.described_type }
+ let(:object) { described_class }
let(:attribute) { mock('Attribute') }
let(:functions) { { attribute => function } }
@@ -5,7 +5,7 @@
describe Optimizer::Function, '.optimize_operand' do
subject { object.optimize_operand(function) }
- let(:object) { self.class.described_type }
+ let(:object) { described_class }
context 'when optimizable' do
let(:optimized) { mock('Optimized') }
@@ -5,7 +5,7 @@
describe Optimizer::Function::Predicate::Enumerable, '.sort_by_value' do
subject { object.sort_by_value(value) }
- let(:object) { self.class.described_type }
+ let(:object) { described_class }
context 'when the value is true' do
let(:value) { true }
View
@@ -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:roodi metrics:all ]
-end
View
@@ -1,49 +0,0 @@
-# encoding: utf-8
-
-begin
- require 'flay'
- require 'yaml'
-
- ruby_type = RUBY_VERSION < '1.9' ? 1.8 : 1.9
-
- config = YAML.load_file(File.expand_path('../../../config/flay.yml', __FILE__))[ruby_type].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
- namespace :metrics do
- task :flay do
- $stderr.puts 'Flay is not available. In order to run flay, you must: gem install flay'
- end
- end
-end
Oops, something went wrong.

0 comments on commit a8d8ae7

Please sign in to comment.