p8-metric_fu 0.8.4.10 → 0.8.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -50,14 +50,16 @@ Which will check for updates every 24 hours and run all the metrics rake tasks (
50
50
  ****Notes on configuration****
51
51
 
52
52
  MetricFu::Configuration.run do |config|
53
- config.open_in_browser = false # Don't open reports in the browser on a mac
53
+ #define which metrics you want to use
54
+ config.metrics = [:coverage, :flog]
55
+ # Don't open reports in the browser on a mac
56
+ config.open_in_browser = false
54
57
  config.churn_options = { :start_date => lambda{ 3.months.ago } }
55
58
  config.coverage_options = { :test_files => ['test/**/test_*.rb'] }
56
59
  config.flog_options = { :dirs_to_flog => ['cms/app', 'cms/lib'] }
57
60
  config.flay_options = { :dirs_to_flay => ['cms/app', 'cms/lib'] }
58
61
  config.saikuro_options = { "--warn_cyclo" => "3", "--error_cyclo" => "4" }
59
- config.open_in_browser = false # Don't open reports in the browser on a mac
60
- ...
62
+
61
63
  end
62
64
 
63
65
  ****Notes on metrics:coverage****
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ Spec::Rake::SpecTask.new(:spec) do |t|
8
8
  t.spec_files = FileList['spec/**/*_spec.rb']
9
9
  end
10
10
 
11
- task :default => [:"metrics:all"]
12
-
13
- MetricFu::OPEN_IN_BROWSER = false
11
+ MetricFu::Configuration.run do |config|
12
+ config.metrics = [:flog]
13
+ end
14
+ task :default => [:"metrics:all"]
@@ -7,8 +7,10 @@ module MetricFu
7
7
 
8
8
  if RAILS
9
9
  CODE_DIRS = ['app', 'lib']
10
+ DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :railroad, :reek, :roodi, :stats, :saikuro ]
10
11
  else
11
12
  CODE_DIRS = ['lib']
13
+ DEFAULT_METRICS = [:coverage, :churn, :flog, :flay, :saikuro ]
12
14
  end
13
15
 
14
16
  module Base
@@ -96,6 +98,10 @@ module MetricFu
96
98
  configuration.flog_options
97
99
  end
98
100
 
101
+ def metrics
102
+ configuration.metrics
103
+ end
104
+
99
105
  def open_in_browser?
100
106
  PLATFORM['darwin'] && configuration.open_in_browser
101
107
  end
@@ -107,24 +113,28 @@ module MetricFu
107
113
  end
108
114
 
109
115
  class Configuration
110
- attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :open_in_browser, :saikuro_options
116
+ attr_accessor :churn_options, :coverage_options, :flay_options, :flog_options, :metrics, :open_in_browser, :saikuro_options
111
117
  def initialize
112
118
  raise "Use config.churn_options instead of MetricFu::CHURN_OPTIONS" if defined? ::MetricFu::CHURN_OPTIONS
113
119
  raise "Use config.flog_options[:dirs_to_flog] instead of MetricFu::DIRECTORIES_TO_FLOG" if defined? ::MetricFu::DIRECTORIES_TO_FLOG
114
120
  raise "Use config.saikuro_options instead of MetricFu::SAIKURO_OPTIONS" if defined? ::MetricFu::SAIKURO_OPTIONS
115
121
  reset
116
122
  end
123
+
117
124
  def self.run()
118
125
  yield MetricFu.configuration
119
126
  end
127
+
120
128
  def reset
121
- @churn_options = {}
129
+ @churn_options = {}
122
130
  @coverage_options = { :test_files => ['test/**/*_test.rb', 'spec/**/*_spec.rb'] }
123
- @flay_options = { :dirs_to_flay => CODE_DIRS}
124
- @flog_options = { :dirs_to_flog => CODE_DIRS}
125
- @open_in_browser = true
126
- @saikuro_options = {}
131
+ @flay_options = { :dirs_to_flay => CODE_DIRS}
132
+ @flog_options = { :dirs_to_flog => CODE_DIRS}
133
+ @metrics = DEFAULT_METRICS
134
+ @open_in_browser = true
135
+ @saikuro_options = {}
127
136
  end
137
+
128
138
  def saikuro_options=(options)
129
139
  raise "saikuro_options need to be a Hash" unless options.is_a?(Hash)
130
140
  @saikuro_options = options
@@ -1,8 +1,10 @@
1
+ MetricFu.metrics.each { |task| import "#{File.dirname(__FILE__)}/#{task}.rake" }
2
+
1
3
  namespace :metrics do
2
4
  if MetricFu::RAILS
3
5
 
4
6
  desc "Generate coverage, cyclomatic complexity, flog, flay, railroad, reek, roodi, stats and churn reports"
5
- task :all => [:coverage, :stats, :saikuro, :churn, :flog, :flay, :railroad, :reek, :roodi]
7
+ task :all => MetricFu.metrics
6
8
 
7
9
  task :set_testing_env do
8
10
  RAILS_ENV = 'test'
@@ -14,7 +16,7 @@ namespace :metrics do
14
16
  else
15
17
 
16
18
  desc "Generate coverage, cyclomatic complexity, flog, flay, railroad and churn reports"
17
- task :all => [:coverage, :saikuro, :churn, :flog, :flay, :railroad ]
19
+ task :all => MetricFu.metrics
18
20
 
19
21
  end
20
22
 
@@ -3,4 +3,4 @@ require 'rubygems'
3
3
  require 'rake'
4
4
 
5
5
  # Load rake files
6
- Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext }
6
+ import "#{File.dirname(__FILE__)}/metric_fu.rake"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p8-metric_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4.10
4
+ version: 0.8.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Scruggs