Permalink
Browse files

Use melbourne parser and devtools

  • Loading branch information...
1 parent 27858b9 commit 62745e312e1ffce85ff61c9cb04d4b2fd9dee67b Markus Schirp committed Nov 21, 2012
View
37 Gemfile
@@ -1,36 +1,9 @@
-source 'https://rubygems.org'
+source :rubygems
gemspec
-gem 'immutable', :git => 'https://github.com/dkubb/immutable.git', :ref => '4a4b7ddd138a32944fa0ddaff8412490cf9dd875'
-gem 'abstract', :git => 'https://github.com/mbj/abstract.git'
+gem 'melbourne', :git => 'https://github.com/mbj/melbourne.git'
+gem 'descendants_tracker', :git => 'https://github.com/dkubb/descendants_tracker.git'
+gem 'devtools', :git => 'https://github.com/mbj/devtools.git', :branch => 'rspec-2-mutant'
-# Remove git version once original to_source is updated
-#gem 'to_source', :git => 'https://github.com/mbj/to_source'
-#gem 'to_source', :git => 'https://github.com/mbj/to_source.git'
-gem 'to_source', :path => '../to_source'
-
-group :development do
- gem 'rake', '~> 0.9.2'
- gem 'yard', '~> 0.8.1'
- gem 'rspec', '~> 2'
- # Remove this once https://github.com/nex3/rb-inotify/pull/20 is solved.
- # This patch makes rb-inotify a nice player with listen so it does not poll.
- gem 'rb-inotify', :git => 'https://github.com/mbj/rb-inotify'
-end
-
-group :guard do
- gem 'guard', '~> 1.3.1'
- gem 'guard-bundler', '~> 1.0.0'
- gem 'guard-rspec', '~> 1.2.0'
-end
-
-group :metrics do
- gem 'flay', '~> 1.4.2'
- gem 'flog', '~> 2.5.1'
- gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git'
- gem 'roodi', '~> 2.1.0'
- gem 'yardstick', '~> 0.5.0'
- gem 'yard-spellcheck', '~> 0.1.5'
- gem 'pelusa', '~> 0.2.1'
-end
+eval File.read('Gemfile.devtools')
View
@@ -0,0 +1,53 @@
+gem 'equalizer', :git => 'https://github.com/dkubb/equalizer.git'
+
+group :development do
+ gem 'rake', '~> 0.9.2'
+ gem 'rspec', '~> 2.12.0'
+ gem 'yard', '~> 0.8.3'
+end
+
+group :guard do
+ gem 'guard', '~> 1.5.4'
+ gem 'guard-bundler', '~> 1.0.0'
+ gem 'guard-rspec', '~> 2.1.1'
+ gem 'rb-inotify', :git => 'https://github.com/mbj/rb-inotify'
+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.2'
+ gem 'flog', '~> 2.5.1'
+ gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git'
+ gem 'roodi', '~> 2.1.0'
+ gem 'yardstick', '~> 0.7.0'
+ gem 'simplecov'
+
+ 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 'json', '~> 1.7.3' # for metric_fu rake task
+ gem 'map', '~> 6.0.1' # for metric_fu
+ gem 'metric_fu', '~> 2.1.1'
+ gem 'mspec', '~> 1.5.17'
+ gem 'rcov', '~> 1.0.0'
+ end
+
+ platforms :rbx do
+ gem 'pelusa', '~> 0.2.1'
+ gem 'mutant', '~> 0.0.1', :git => 'https://github.com/mbj/mutant'
+ end
+end
View
@@ -1,6 +1,5 @@
require 'rake'
-FileList['tasks/**/*.rake'].each { |task| import task }
+require 'devtools'
-desc 'Default: run all specs'
-task :default => :spec
+Devtools.init
View
@@ -1,3 +1,4 @@
+require 'melbourne'
require 'to_source/version'
require 'to_source/visitor'
View
@@ -1,7 +0,0 @@
-desc 'Run metrics with Heckle'
-task :ci => %w[ ci:metrics heckle ]
-
-namespace :ci do
- desc 'Run metrics'
- task :metrics => %w[ verify_measurements flog flay reek roodi metrics:all ]
-end
View
@@ -1,41 +0,0 @@
-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'))
-
- # 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
- 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
-rescue LoadError
- task :flay do
- abort 'Flay is not available. In order to run flay, you must: gem install flay'
- end
-end
View
@@ -1,43 +0,0 @@
-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)
-
- # 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 }
-
- max = totals.last[1]
- unless max >= threshold
- raise "Adjust flog score down to #{max}"
- 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
-rescue LoadError
- task :flog do
- abort 'Flog is not available. In order to run flog, you must: gem install flog'
- end
-end
Oops, something went wrong.

0 comments on commit 62745e3

Please sign in to comment.