metric_fu 4.3.1 → 4.4.0
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.
- checksums.yaml +7 -0
- data/.metrics +55 -26
- data/.travis.yml +4 -1
- data/AUTHORS +12 -0
- data/Gemfile +1 -0
- data/HISTORY.md +24 -0
- data/README.md +27 -22
- data/checksum/metric_fu-4.3.1.gem.sha512 +1 -0
- data/checksum/metric_fu-4.4.0.gem.sha512 +1 -0
- data/lib/metric_fu.rb +28 -79
- data/lib/metric_fu/cli/helper.rb +1 -1
- data/lib/metric_fu/cli/parser.rb +1 -1
- data/lib/metric_fu/configuration.rb +104 -150
- data/lib/metric_fu/environment.rb +88 -0
- data/lib/metric_fu/formatter.rb +23 -0
- data/lib/metric_fu/formatter/html.rb +12 -9
- data/lib/metric_fu/initial_requires.rb +1 -0
- data/lib/metric_fu/io.rb +60 -1
- data/lib/metric_fu/load_files.rb +4 -2
- data/lib/metric_fu/loader.rb +62 -0
- data/lib/metric_fu/metric.rb +102 -0
- data/lib/metric_fu/metrics/base_template.rb +15 -9
- data/lib/metric_fu/metrics/cane/cane.rb +9 -5
- data/lib/metric_fu/metrics/cane/init.rb +35 -13
- data/lib/metric_fu/metrics/churn/churn.rb +5 -1
- data/lib/metric_fu/metrics/churn/init.rb +24 -4
- data/lib/metric_fu/metrics/flay/flay.rb +7 -3
- data/lib/metric_fu/metrics/flay/init.rb +29 -13
- data/lib/metric_fu/metrics/flay/template_awesome/flay.html.erb +1 -1
- data/lib/metric_fu/metrics/flog/flog.rb +14 -38
- data/lib/metric_fu/metrics/flog/init.rb +30 -7
- data/lib/metric_fu/metrics/generator.rb +21 -6
- data/lib/metric_fu/metrics/graph.rb +2 -2
- data/lib/metric_fu/metrics/hotspots/hotspots.rb +5 -1
- data/lib/metric_fu/metrics/hotspots/init.rb +21 -5
- data/lib/metric_fu/metrics/rails_best_practices/init.rb +29 -5
- data/lib/metric_fu/metrics/rails_best_practices/rails_best_practices.rb +20 -27
- data/lib/metric_fu/metrics/rails_best_practices/template_awesome/rails_best_practices.html.erb +1 -1
- data/lib/metric_fu/metrics/rcov/init.rb +40 -15
- data/lib/metric_fu/metrics/rcov/rcov.rb +15 -10
- data/lib/metric_fu/metrics/reek/init.rb +25 -6
- data/lib/metric_fu/metrics/reek/reek.rb +52 -31
- data/lib/metric_fu/metrics/reek/template_awesome/reek.html.erb +1 -1
- data/lib/metric_fu/metrics/roodi/init.rb +25 -6
- data/lib/metric_fu/metrics/roodi/roodi.rb +7 -3
- data/lib/metric_fu/metrics/saikuro/init.rb +22 -6
- data/lib/metric_fu/metrics/saikuro/saikuro.rb +8 -3
- data/lib/metric_fu/metrics/stats/init.rb +28 -5
- data/lib/metric_fu/metrics/stats/stats.rb +24 -6
- data/lib/metric_fu/metrics/stats/template_awesome/stats.html.erb +2 -2
- data/lib/metric_fu/parser_ext.rb +15 -0
- data/lib/metric_fu/reporting/graphs/engines/gchart.rb +1 -1
- data/lib/metric_fu/reporting/graphs/engines/init.rb +18 -4
- data/lib/metric_fu/reporting/graphs/grapher.rb +1 -1
- data/lib/metric_fu/reporting/result.rb +13 -6
- data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +1 -1
- data/lib/metric_fu/run.rb +7 -10
- data/lib/metric_fu/sexp_ext.rb +11 -0
- data/lib/metric_fu/version.rb +1 -1
- data/metric_fu.gemspec +23 -20
- data/spec/cli/helper_spec.rb +5 -16
- data/spec/metric_fu/configuration_spec.rb +62 -88
- data/spec/metric_fu/formatter/html_spec.rb +26 -16
- data/spec/metric_fu/formatter/yaml_spec.rb +2 -2
- data/spec/metric_fu/metric_spec.rb +50 -0
- data/spec/metric_fu/metrics/base_template_spec.rb +9 -7
- data/spec/metric_fu/metrics/cane/cane_spec.rb +19 -24
- data/spec/metric_fu/metrics/churn/churn_spec.rb +8 -8
- data/spec/metric_fu/metrics/flay/flay_spec.rb +7 -13
- data/spec/metric_fu/metrics/flog/flog_spec.rb +63 -58
- data/spec/metric_fu/metrics/generator_spec.rb +4 -0
- data/spec/metric_fu/metrics/hotspots/hotspots_spec.rb +7 -7
- data/spec/metric_fu/metrics/rails_best_practices/rails_best_practices_spec.rb +14 -33
- data/spec/metric_fu/metrics/rcov/rcov_spec.rb +17 -18
- data/spec/metric_fu/metrics/reek/reek_spec.rb +9 -10
- data/spec/metric_fu/metrics/roodi/roodi_spec.rb +5 -11
- data/spec/metric_fu/metrics/saikuro/saikuro_spec.rb +15 -14
- data/spec/metric_fu/metrics/stats/stats_spec.rb +5 -6
- data/spec/metric_fu/reporting/graphs/engines/bluff_spec.rb +2 -3
- data/spec/metric_fu/reporting/graphs/engines/gchart_spec.rb +12 -9
- data/spec/metric_fu/reporting/result_spec.rb +3 -3
- data/spec/run_spec.rb +45 -29
- data/spec/spec_helper.rb +7 -0
- data/spec/support/helper_methods.rb +9 -0
- data/spec/support/suite.rb +17 -11
- metadata +59 -56
- data/bin/mf-rails_best_practices +0 -9
- data/bin/mf-stats +0 -7
@@ -1,13 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe StatsGenerator do
|
4
4
|
describe "emit method" do
|
5
5
|
it "should gather the raw data" do
|
6
6
|
ENV['CC_BUILD_ARTIFACTS'] = nil
|
7
7
|
MetricFu.configure.reset
|
8
8
|
File.stub(:directory?).and_return(true)
|
9
|
-
stats = MetricFu::
|
10
|
-
stats.should_receive(:`).with("mf-stats > tmp/metric_fu/scratch/stats/stats.txt")
|
9
|
+
stats = MetricFu::StatsGenerator.new
|
11
10
|
stats.emit
|
12
11
|
end
|
13
12
|
end
|
@@ -36,8 +35,8 @@ describe Stats do
|
|
36
35
|
ENV['CC_BUILD_ARTIFACTS'] = nil
|
37
36
|
MetricFu.configure.reset
|
38
37
|
File.stub(:directory?).and_return(true)
|
39
|
-
stats = MetricFu::
|
40
|
-
|
38
|
+
stats = MetricFu::StatsGenerator.new
|
39
|
+
stats.instance_variable_set('@output', @lines)
|
41
40
|
@results = stats.analyze
|
42
41
|
end
|
43
42
|
|
@@ -69,7 +68,7 @@ describe Stats do
|
|
69
68
|
ENV['CC_BUILD_ARTIFACTS'] = nil
|
70
69
|
MetricFu.configure.reset
|
71
70
|
File.stub(:directory?).and_return(true)
|
72
|
-
stats = MetricFu::
|
71
|
+
stats = MetricFu::StatsGenerator.new
|
73
72
|
stats.instance_variable_set(:@stats, "the_stats")
|
74
73
|
stats.to_h[:stats].should == "the_stats"
|
75
74
|
end
|
@@ -2,9 +2,8 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Bluff graphers responding to #graph!" do
|
4
4
|
it "should write chart file" do
|
5
|
-
MetricFu.configure
|
6
5
|
graphs = {}
|
7
|
-
available_graphs = MetricFu.
|
6
|
+
available_graphs = MetricFu::Metric.enabled_metrics.select{|m|m.has_graph?}.map(&:name)
|
8
7
|
available_graphs.each do |graph|
|
9
8
|
grapher_name = graph.to_s.gsub("MetricFu::",'').gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
10
9
|
grapher_name = grapher_name+"BluffGrapher"
|
@@ -12,7 +11,7 @@ describe "Bluff graphers responding to #graph!" do
|
|
12
11
|
end
|
13
12
|
graphs.each do |key, val|
|
14
13
|
val.graph!
|
15
|
-
output_dir = File.expand_path(File.join(MetricFu.output_directory))
|
14
|
+
output_dir = File.expand_path(File.join(MetricFu::Io::FileSystem.directory('output_directory')))
|
16
15
|
lambda{ File.open(File.join(output_dir, "#{key.to_s.downcase}.js")) }.should_not raise_error
|
17
16
|
end
|
18
17
|
end
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe MetricFu::Grapher do
|
4
4
|
describe "require_graphing_gem" do
|
5
5
|
it "should give a warning if trying to use gchart but gem is not installed" do
|
6
|
-
MetricFu
|
6
|
+
MetricFu.configuration.configure_graph_engine(:gchart)
|
7
7
|
MetricFu::Grapher.should_receive(:require).with('gchart').and_raise(LoadError)
|
8
8
|
MetricFu::Grapher.should_receive(:mf_log).with(/If you want to use google charts/)
|
9
9
|
MetricFu::Grapher.require_graphing_gem
|
@@ -33,7 +33,10 @@ end
|
|
33
33
|
|
34
34
|
describe "Gchart graphers" do
|
35
35
|
before :each do
|
36
|
-
MetricFu
|
36
|
+
MetricFu.configuration.configure_graph_engine(:gchart)
|
37
|
+
end
|
38
|
+
def output_directory
|
39
|
+
directory('output_directory')
|
37
40
|
end
|
38
41
|
|
39
42
|
describe "FlayGchartGrapher graph! method" do
|
@@ -44,7 +47,7 @@ describe "Gchart graphers" do
|
|
44
47
|
:title => URI.encode("Flay: duplication"),
|
45
48
|
:axis_with_labels => 'x,y',
|
46
49
|
:format => 'file',
|
47
|
-
:filename => File.join(
|
50
|
+
:filename => File.join(output_directory, 'flay.png'),
|
48
51
|
}
|
49
52
|
Gchart.should_receive(:line).with(hash_including(expected))
|
50
53
|
grapher.graph!
|
@@ -63,7 +66,7 @@ describe "Gchart graphers" do
|
|
63
66
|
:custom => "chdlp=t",
|
64
67
|
:axis_with_labels => 'x,y',
|
65
68
|
:format => 'file',
|
66
|
-
:filename => File.join(
|
69
|
+
:filename => File.join(output_directory, 'flog.png'),
|
67
70
|
}
|
68
71
|
Gchart.should_receive(:line).with(hash_including(expected))
|
69
72
|
grapher.graph!
|
@@ -80,7 +83,7 @@ describe "Gchart graphers" do
|
|
80
83
|
:axis_with_labels => 'x,y',
|
81
84
|
:axis_labels => [grapher.labels.values, [0,20,40,60,80,100]],
|
82
85
|
:format => 'file',
|
83
|
-
:filename => File.join(
|
86
|
+
:filename => File.join(output_directory, 'rcov.png'),
|
84
87
|
}
|
85
88
|
Gchart.should_receive(:line).with(hash_including(expected))
|
86
89
|
grapher.graph!
|
@@ -97,7 +100,7 @@ describe "Gchart graphers" do
|
|
97
100
|
:bar_colors => MetricFu::GchartGrapher::COLORS,
|
98
101
|
:axis_with_labels => 'x,y',
|
99
102
|
:format => 'file',
|
100
|
-
:filename => File.join(
|
103
|
+
:filename => File.join(output_directory, 'reek.png'),
|
101
104
|
}
|
102
105
|
Gchart.should_receive(:line).with(hash_including(expected))
|
103
106
|
grapher.graph!
|
@@ -112,7 +115,7 @@ describe "Gchart graphers" do
|
|
112
115
|
:title => URI.encode("Roodi: potential design problems"),
|
113
116
|
:axis_with_labels => 'x,y',
|
114
117
|
:format => 'file',
|
115
|
-
:filename => File.join(
|
118
|
+
:filename => File.join(output_directory, 'roodi.png'),
|
116
119
|
}
|
117
120
|
Gchart.should_receive(:line).with(hash_including(expected))
|
118
121
|
grapher.graph!
|
@@ -130,7 +133,7 @@ describe "Gchart graphers" do
|
|
130
133
|
:custom => "chdlp=t",
|
131
134
|
:axis_with_labels => 'x,y',
|
132
135
|
:format => 'file',
|
133
|
-
:filename => File.join(
|
136
|
+
:filename => File.join(output_directory, 'stats.png'),
|
134
137
|
}
|
135
138
|
Gchart.should_receive(:line).with(hash_including(expected))
|
136
139
|
grapher.graph!
|
@@ -148,7 +151,7 @@ describe "Gchart graphers" do
|
|
148
151
|
:custom => "chdlp=t",
|
149
152
|
:axis_with_labels => 'x,y',
|
150
153
|
:format => 'file',
|
151
|
-
:filename => File.join(
|
154
|
+
:filename => File.join(output_directory, 'rails_best_practices.png'),
|
152
155
|
}
|
153
156
|
Gchart.should_receive(:line).with(hash_including(expected))
|
154
157
|
grapher.graph!
|
@@ -39,12 +39,12 @@ describe MetricFu::Result do
|
|
39
39
|
result_inst.should_receive(:generate_result).and_return({:a => 'b'})
|
40
40
|
result_inst.should_receive(:respond_to?).and_return(false)
|
41
41
|
|
42
|
-
MetricFu.should_receive(:
|
43
|
-
|
44
|
-
with('Type').and_return(result_type)
|
42
|
+
MetricFu::Generator.should_receive(:get_generator).
|
43
|
+
with(result_type).and_return(result_type)
|
45
44
|
result_hash = double('result_hash')
|
46
45
|
result_hash.should_receive(:merge!).with({:a => 'b'})
|
47
46
|
@result.should_receive(:result_hash).and_return(result_hash)
|
47
|
+
@result.should_receive(:metric_options_for_result_type).with(result_type)
|
48
48
|
@result.add(result_type)
|
49
49
|
end
|
50
50
|
end
|
data/spec/run_spec.rb
CHANGED
@@ -6,23 +6,40 @@ describe MetricFu do
|
|
6
6
|
let(:helper) { MetricFu::Cli::Helper.new }
|
7
7
|
|
8
8
|
before(:all) do
|
9
|
-
MetricFu
|
9
|
+
MetricFu.configuration.configure_graph_engine(:bluff)
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
13
13
|
setup_fs
|
14
14
|
end
|
15
15
|
|
16
|
+
def base_directory
|
17
|
+
directory('base_directory')
|
18
|
+
end
|
19
|
+
|
20
|
+
def output_directory
|
21
|
+
directory('output_directory')
|
22
|
+
end
|
23
|
+
|
24
|
+
def data_directory
|
25
|
+
directory('data_directory')
|
26
|
+
end
|
27
|
+
|
16
28
|
context "given configured metrics, when run" do
|
29
|
+
|
17
30
|
before do
|
18
31
|
|
19
32
|
# TODO: Should probably use some sort of fake metric
|
20
33
|
# to speed up tests. For now, just configuring with a
|
21
34
|
# limited set, so we can test the basic functionality
|
22
35
|
# without significantly slowing down the specs.
|
23
|
-
MetricFu
|
24
|
-
|
25
|
-
|
36
|
+
MetricFu.configuration.configure_metrics do |metric|
|
37
|
+
if metric.name == :churn
|
38
|
+
metric.enable
|
39
|
+
metric.activated = true
|
40
|
+
else
|
41
|
+
metric.enabled = false
|
42
|
+
end
|
26
43
|
end
|
27
44
|
|
28
45
|
end
|
@@ -35,45 +52,45 @@ describe MetricFu do
|
|
35
52
|
end
|
36
53
|
|
37
54
|
it "creates a report yaml file" do
|
38
|
-
expect { metric_fu }.to create_file("#{
|
55
|
+
expect { metric_fu }.to create_file("#{base_directory}/report.yml")
|
39
56
|
end
|
40
57
|
|
41
58
|
it "creates a data yaml file" do
|
42
|
-
expect { metric_fu }.to create_file("#{
|
59
|
+
expect { metric_fu }.to create_file("#{data_directory}/#{Time.now.strftime("%Y%m%d")}.yml")
|
43
60
|
end
|
44
61
|
|
45
62
|
it "creates a report html file" do
|
46
|
-
expect { metric_fu }.to create_file("#{
|
63
|
+
expect { metric_fu }.to create_file("#{output_directory}/index.html")
|
47
64
|
end
|
48
65
|
|
49
66
|
context "with configured formatter" do
|
50
67
|
it "outputs using configured formatter" do
|
51
68
|
expect {
|
52
69
|
MetricFu::Configuration.run do |config|
|
53
|
-
config.
|
70
|
+
config.configure_formatter(:yaml)
|
54
71
|
end
|
55
72
|
metric_fu
|
56
|
-
}.to create_file("#{
|
73
|
+
}.to create_file("#{base_directory}/report.yml")
|
57
74
|
end
|
58
75
|
|
59
76
|
it "doesn't output using formatters not configured" do
|
60
77
|
expect {
|
61
78
|
MetricFu::Configuration.run do |config|
|
62
|
-
config.
|
79
|
+
config.configure_formatter(:yaml)
|
63
80
|
end
|
64
81
|
metric_fu
|
65
|
-
}.to_not create_file("#{
|
82
|
+
}.to_not create_file("#{output_directory}/index.html")
|
66
83
|
end
|
67
84
|
|
68
85
|
end
|
69
86
|
|
70
87
|
context "with command line formatter" do
|
71
88
|
it "outputs using command line formatter" do
|
72
|
-
expect { metric_fu "--format yaml"}.to create_file("#{
|
89
|
+
expect { metric_fu "--format yaml"}.to create_file("#{base_directory}/report.yml")
|
73
90
|
end
|
74
91
|
|
75
92
|
it "doesn't output using formatters not configured" do
|
76
|
-
expect { metric_fu "--format yaml"}.to_not create_file("#{
|
93
|
+
expect { metric_fu "--format yaml"}.to_not create_file("#{output_directory}/index.html")
|
77
94
|
end
|
78
95
|
|
79
96
|
end
|
@@ -82,16 +99,16 @@ describe MetricFu do
|
|
82
99
|
|
83
100
|
before do
|
84
101
|
MetricFu::Configuration.run do |config|
|
85
|
-
config.
|
102
|
+
config.configure_formatter(:html)
|
86
103
|
end
|
87
104
|
end
|
88
105
|
|
89
106
|
it "outputs using command line formatter" do
|
90
|
-
expect { metric_fu "--format yaml"}.to create_file("#{
|
107
|
+
expect { metric_fu "--format yaml"}.to create_file("#{base_directory}/report.yml")
|
91
108
|
end
|
92
109
|
|
93
110
|
it "doesn't output using configured formatter (cli takes precedence)" do
|
94
|
-
expect { metric_fu "--format yaml"}.to_not create_file("#{
|
111
|
+
expect { metric_fu "--format yaml"}.to_not create_file("#{output_directory}/index.html")
|
95
112
|
end
|
96
113
|
|
97
114
|
end
|
@@ -100,41 +117,41 @@ describe MetricFu do
|
|
100
117
|
it "outputs using configured out" do
|
101
118
|
expect {
|
102
119
|
MetricFu::Configuration.run do |config|
|
103
|
-
config.
|
120
|
+
config.configure_formatter(:yaml, "customreport.yml")
|
104
121
|
end
|
105
122
|
metric_fu
|
106
|
-
}.to create_file("#{
|
123
|
+
}.to create_file("#{base_directory}/customreport.yml")
|
107
124
|
end
|
108
125
|
|
109
126
|
it "doesn't output using formatters not configured" do
|
110
127
|
expect {
|
111
128
|
MetricFu::Configuration.run do |config|
|
112
|
-
config.
|
129
|
+
config.configure_formatter(:yaml, "customreport.yml")
|
113
130
|
end
|
114
131
|
metric_fu
|
115
|
-
}.to_not create_file("#{
|
132
|
+
}.to_not create_file("#{base_directory}/report.yml")
|
116
133
|
end
|
117
134
|
|
118
135
|
end
|
119
136
|
|
120
137
|
context "with command line specified formatter + out" do
|
121
138
|
it "outputs to the specified path" do
|
122
|
-
expect { metric_fu "--format yaml --out customreport.yml"}.to create_file("#{
|
139
|
+
expect { metric_fu "--format yaml --out customreport.yml"}.to create_file("#{base_directory}/customreport.yml")
|
123
140
|
end
|
124
141
|
|
125
142
|
it "doesn't output to default path" do
|
126
|
-
expect { metric_fu "--format yaml --out customreport.yml"}.to_not create_file("#{
|
143
|
+
expect { metric_fu "--format yaml --out customreport.yml"}.to_not create_file("#{base_directory}/report.yml")
|
127
144
|
end
|
128
145
|
|
129
146
|
end
|
130
147
|
|
131
148
|
context "with command line specified out only" do
|
132
149
|
it "outputs to the specified path" do
|
133
|
-
expect { metric_fu "--out customdir --no-open"}.to create_file("#{
|
150
|
+
expect { metric_fu "--out customdir --no-open"}.to create_file("#{base_directory}/customdir/index.html")
|
134
151
|
end
|
135
152
|
|
136
153
|
it "doesn't output to default path" do
|
137
|
-
expect { metric_fu "--out customdir --no-open"}.to_not create_file("#{
|
154
|
+
expect { metric_fu "--out customdir --no-open"}.to_not create_file("#{output_directory}/index.html")
|
138
155
|
end
|
139
156
|
|
140
157
|
end
|
@@ -142,14 +159,9 @@ describe MetricFu do
|
|
142
159
|
|
143
160
|
after do
|
144
161
|
MetricFu::Configuration.run do |config|
|
145
|
-
config.metrics = @default_configured_metrics
|
146
162
|
config.formatters.clear
|
147
163
|
end
|
148
|
-
|
149
|
-
cleanup_fs
|
150
164
|
end
|
151
|
-
|
152
|
-
|
153
165
|
end
|
154
166
|
|
155
167
|
context "given other options" do
|
@@ -171,6 +183,10 @@ describe MetricFu do
|
|
171
183
|
|
172
184
|
end
|
173
185
|
|
186
|
+
after do
|
187
|
+
cleanup_fs
|
188
|
+
end
|
189
|
+
|
174
190
|
def metric_fu(options = "--no-open")
|
175
191
|
MfDebugger::Logger.capture_output {
|
176
192
|
begin
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,7 @@ end
|
|
8
8
|
require 'rspec/autorun'
|
9
9
|
require 'date'
|
10
10
|
require 'construct'
|
11
|
+
require 'json'
|
11
12
|
|
12
13
|
# add lib to the load path just like rubygems does
|
13
14
|
$:.push File.expand_path("../../lib", __FILE__)
|
@@ -24,7 +25,13 @@ RSpec.configure do |config|
|
|
24
25
|
# :each ever describe block
|
25
26
|
# :all ever it block
|
26
27
|
|
28
|
+
config.order = 'random'
|
29
|
+
|
27
30
|
config.after(:suite) do
|
28
31
|
cleanup_test_files
|
29
32
|
end
|
33
|
+
|
34
|
+
config.after(:each) do
|
35
|
+
MetricFu.reset
|
36
|
+
end
|
30
37
|
end
|
data/spec/support/suite.rb
CHANGED
@@ -17,20 +17,26 @@ def resources_path
|
|
17
17
|
"#{MetricFu.root_dir}/spec/resources"
|
18
18
|
end
|
19
19
|
|
20
|
+
def directory(name)
|
21
|
+
MetricFu::Io::FileSystem.directory(name)
|
22
|
+
end
|
23
|
+
|
20
24
|
def setup_fs
|
21
25
|
if !MetricFu.configuration.rubinius? # fakefs doesn't seem to work on rubinius...
|
22
26
|
FakeFS.activate!
|
23
27
|
FakeFS::FileSystem.clone('lib')
|
24
28
|
FakeFS::FileSystem.clone('.metrics')
|
25
|
-
FileUtils.mkdir_p(Pathname.pwd.join(
|
26
|
-
FileUtils.mkdir_p(Pathname.pwd.join(
|
29
|
+
FileUtils.mkdir_p(Pathname.pwd.join(directory('base_directory')))
|
30
|
+
FileUtils.mkdir_p(Pathname.pwd.join(directory('output_directory')))
|
27
31
|
else
|
28
32
|
# Have to use the file system, so let's shift the
|
29
33
|
# output directories so that we don't interfere with
|
30
34
|
# existing historical metric data.
|
31
|
-
MetricFu.stub(:base_directory).and_return("tmp/metric_fu/test")
|
32
|
-
MetricFu.stub(:output_directory).and_return("tmp/metric_fu/test/output")
|
33
|
-
MetricFu.stub(:data_directory).and_return("tmp/metric_fu/test/_data")
|
35
|
+
MetricFu::Io::FileSystem.stub(:directory).with('base_directory').and_return("tmp/metric_fu/test")
|
36
|
+
MetricFu::Io::FileSystem.stub(:directory).with('output_directory').and_return("tmp/metric_fu/test/output")
|
37
|
+
MetricFu::Io::FileSystem.stub(:directory).with('data_directory').and_return("tmp/metric_fu/test/_data")
|
38
|
+
MetricFu::Io::FileSystem.stub(:directory).with('code_dirs').and_return(%w(lib))
|
39
|
+
MetricFu::Io::FileSystem.stub(:directory).with('scratch_directory').and_return('tmp/metric_fu/test/scratch')
|
34
40
|
end
|
35
41
|
end
|
36
42
|
|
@@ -40,11 +46,11 @@ def cleanup_fs
|
|
40
46
|
FakeFS.deactivate!
|
41
47
|
else
|
42
48
|
# Not ideal, but workaround for rubinius...
|
43
|
-
FileUtils.rm_rf("#{
|
44
|
-
FileUtils.rm_rf(Dir.glob("#{
|
45
|
-
FileUtils.rm_rf(Dir.glob("#{
|
46
|
-
FileUtils.rm_rf("#{
|
47
|
-
FileUtils.rm_rf(Dir["#{
|
48
|
-
FileUtils.rm_rf("#{
|
49
|
+
FileUtils.rm_rf("#{directory('base_directory')}/report.yml")
|
50
|
+
FileUtils.rm_rf(Dir.glob("#{directory('output_directory')}/*.html"))
|
51
|
+
FileUtils.rm_rf(Dir.glob("#{directory('output_directory')}/*.js"))
|
52
|
+
FileUtils.rm_rf("#{directory('data_directory')}/#{Time.now.strftime("%Y%m%d")}.yml")
|
53
|
+
FileUtils.rm_rf(Dir["#{directory('base_directory')}/customdir"])
|
54
|
+
FileUtils.rm_rf("#{directory('base_directory')}/customreport.yml")
|
49
55
|
end
|
50
56
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
5
|
-
prerelease:
|
4
|
+
version: 4.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jake Scruggs
|
@@ -16,15 +15,15 @@ authors:
|
|
16
15
|
- Richard Huang
|
17
16
|
- Dan Mayer
|
18
17
|
- Benjamin Fleischer
|
18
|
+
- Robin Curry
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
|
-
date: 2013-08-
|
22
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: flay
|
26
26
|
requirement: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
27
|
requirements:
|
29
28
|
- - ~>
|
30
29
|
- !ruby/object:Gem::Version
|
@@ -32,7 +31,6 @@ dependencies:
|
|
32
31
|
type: :runtime
|
33
32
|
prerelease: false
|
34
33
|
version_requirements: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
34
|
requirements:
|
37
35
|
- - ~>
|
38
36
|
- !ruby/object:Gem::Version
|
@@ -40,7 +38,6 @@ dependencies:
|
|
40
38
|
- !ruby/object:Gem::Dependency
|
41
39
|
name: churn
|
42
40
|
requirement: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
41
|
requirements:
|
45
42
|
- - ~>
|
46
43
|
- !ruby/object:Gem::Version
|
@@ -48,7 +45,6 @@ dependencies:
|
|
48
45
|
type: :runtime
|
49
46
|
prerelease: false
|
50
47
|
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
48
|
requirements:
|
53
49
|
- - ~>
|
54
50
|
- !ruby/object:Gem::Version
|
@@ -56,23 +52,20 @@ dependencies:
|
|
56
52
|
- !ruby/object:Gem::Dependency
|
57
53
|
name: flog
|
58
54
|
requirement: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
55
|
requirements:
|
61
56
|
- - ~>
|
62
57
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
58
|
+
version: 4.1.1
|
64
59
|
type: :runtime
|
65
60
|
prerelease: false
|
66
61
|
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
62
|
requirements:
|
69
63
|
- - ~>
|
70
64
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
65
|
+
version: 4.1.1
|
72
66
|
- !ruby/object:Gem::Dependency
|
73
67
|
name: reek
|
74
68
|
requirement: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
69
|
requirements:
|
77
70
|
- - ~>
|
78
71
|
- !ruby/object:Gem::Version
|
@@ -80,7 +73,6 @@ dependencies:
|
|
80
73
|
type: :runtime
|
81
74
|
prerelease: false
|
82
75
|
version_requirements: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
76
|
requirements:
|
85
77
|
- - ~>
|
86
78
|
- !ruby/object:Gem::Version
|
@@ -88,7 +80,6 @@ dependencies:
|
|
88
80
|
- !ruby/object:Gem::Dependency
|
89
81
|
name: cane
|
90
82
|
requirement: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
83
|
requirements:
|
93
84
|
- - ~>
|
94
85
|
- !ruby/object:Gem::Version
|
@@ -96,7 +87,6 @@ dependencies:
|
|
96
87
|
type: :runtime
|
97
88
|
prerelease: false
|
98
89
|
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
90
|
requirements:
|
101
91
|
- - ~>
|
102
92
|
- !ruby/object:Gem::Version
|
@@ -104,128 +94,132 @@ dependencies:
|
|
104
94
|
- !ruby/object:Gem::Dependency
|
105
95
|
name: rails_best_practices
|
106
96
|
requirement: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
97
|
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.14.1
|
109
101
|
- - ~>
|
110
102
|
- !ruby/object:Gem::Version
|
111
|
-
version: 1.
|
103
|
+
version: '1.14'
|
112
104
|
type: :runtime
|
113
105
|
prerelease: false
|
114
106
|
version_requirements: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
107
|
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.14.1
|
117
111
|
- - ~>
|
118
112
|
- !ruby/object:Gem::Version
|
119
|
-
version: 1.
|
113
|
+
version: '1.14'
|
120
114
|
- !ruby/object:Gem::Dependency
|
121
115
|
name: metric_fu-Saikuro
|
122
116
|
requirement: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
117
|
requirements:
|
125
|
-
- -
|
118
|
+
- - '>='
|
126
119
|
- !ruby/object:Gem::Version
|
127
120
|
version: 1.1.1.0
|
128
121
|
type: :runtime
|
129
122
|
prerelease: false
|
130
123
|
version_requirements: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
124
|
requirements:
|
133
|
-
- -
|
125
|
+
- - '>='
|
134
126
|
- !ruby/object:Gem::Version
|
135
127
|
version: 1.1.1.0
|
136
128
|
- !ruby/object:Gem::Dependency
|
137
129
|
name: metric_fu-roodi
|
138
130
|
requirement: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
131
|
requirements:
|
141
|
-
- -
|
132
|
+
- - '>='
|
142
133
|
- !ruby/object:Gem::Version
|
143
134
|
version: 2.2.1
|
144
135
|
type: :runtime
|
145
136
|
prerelease: false
|
146
137
|
version_requirements: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
138
|
requirements:
|
149
|
-
- -
|
139
|
+
- - '>='
|
150
140
|
- !ruby/object:Gem::Version
|
151
141
|
version: 2.2.1
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: code_metrics
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ~>
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0.1'
|
149
|
+
type: :runtime
|
150
|
+
prerelease: false
|
151
|
+
version_requirements: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ~>
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0.1'
|
152
156
|
- !ruby/object:Gem::Dependency
|
153
157
|
name: redcard
|
154
158
|
requirement: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
159
|
requirements:
|
157
|
-
- -
|
160
|
+
- - '>='
|
158
161
|
- !ruby/object:Gem::Version
|
159
162
|
version: '0'
|
160
163
|
type: :runtime
|
161
164
|
prerelease: false
|
162
165
|
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
none: false
|
164
166
|
requirements:
|
165
|
-
- -
|
167
|
+
- - '>='
|
166
168
|
- !ruby/object:Gem::Version
|
167
169
|
version: '0'
|
168
170
|
- !ruby/object:Gem::Dependency
|
169
171
|
name: coderay
|
170
172
|
requirement: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
173
|
requirements:
|
173
|
-
- -
|
174
|
+
- - '>='
|
174
175
|
- !ruby/object:Gem::Version
|
175
176
|
version: '0'
|
176
177
|
type: :runtime
|
177
178
|
prerelease: false
|
178
179
|
version_requirements: !ruby/object:Gem::Requirement
|
179
|
-
none: false
|
180
180
|
requirements:
|
181
|
-
- -
|
181
|
+
- - '>='
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
- !ruby/object:Gem::Dependency
|
185
185
|
name: bluff
|
186
186
|
requirement: !ruby/object:Gem::Requirement
|
187
|
-
none: false
|
188
187
|
requirements:
|
189
|
-
- -
|
188
|
+
- - '>='
|
190
189
|
- !ruby/object:Gem::Version
|
191
190
|
version: '0'
|
192
191
|
type: :runtime
|
193
192
|
prerelease: false
|
194
193
|
version_requirements: !ruby/object:Gem::Requirement
|
195
|
-
none: false
|
196
194
|
requirements:
|
197
|
-
- -
|
195
|
+
- - '>='
|
198
196
|
- !ruby/object:Gem::Version
|
199
197
|
version: '0'
|
200
198
|
- !ruby/object:Gem::Dependency
|
201
199
|
name: multi_json
|
202
200
|
requirement: !ruby/object:Gem::Requirement
|
203
|
-
none: false
|
204
201
|
requirements:
|
205
|
-
- -
|
202
|
+
- - '>='
|
206
203
|
- !ruby/object:Gem::Version
|
207
204
|
version: '0'
|
208
205
|
type: :runtime
|
209
206
|
prerelease: false
|
210
207
|
version_requirements: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
208
|
requirements:
|
213
|
-
- -
|
209
|
+
- - '>='
|
214
210
|
- !ruby/object:Gem::Version
|
215
211
|
version: '0'
|
216
|
-
description: Code metrics from Flog, Flay, Saikuro, Churn, Reek, Roodi,
|
217
|
-
|
212
|
+
description: Code metrics from Flog, Flay, Saikuro, Churn, Reek, Roodi, Code Statistics,
|
213
|
+
and Rails Best Practices. (and optionally RCov)
|
218
214
|
email: github@benjaminfleischer.com
|
219
215
|
executables:
|
220
216
|
- metric_fu
|
221
217
|
- mf-cane
|
222
218
|
- mf-churn
|
223
219
|
- mf-flay
|
224
|
-
- mf-rails_best_practices
|
225
220
|
- mf-reek
|
226
221
|
- mf-roodi
|
227
222
|
- mf-saikuro
|
228
|
-
- mf-stats
|
229
223
|
extensions: []
|
230
224
|
extra_rdoc_files:
|
231
225
|
- HISTORY.md
|
@@ -238,6 +232,7 @@ files:
|
|
238
232
|
- .rspec
|
239
233
|
- .travis.yml
|
240
234
|
- .yardopts
|
235
|
+
- AUTHORS
|
241
236
|
- CONTRIBUTING.md
|
242
237
|
- Gemfile
|
243
238
|
- HISTORY.md
|
@@ -249,15 +244,15 @@ files:
|
|
249
244
|
- bin/mf-cane
|
250
245
|
- bin/mf-churn
|
251
246
|
- bin/mf-flay
|
252
|
-
- bin/mf-rails_best_practices
|
253
247
|
- bin/mf-reek
|
254
248
|
- bin/mf-roodi
|
255
249
|
- bin/mf-saikuro
|
256
|
-
- bin/mf-stats
|
257
250
|
- checksum/.gitkeep
|
258
251
|
- checksum/metric_fu-4.2.0.gem.sha512
|
259
252
|
- checksum/metric_fu-4.2.1.gem.sha512
|
260
253
|
- checksum/metric_fu-4.3.0.gem.sha512
|
254
|
+
- checksum/metric_fu-4.3.1.gem.sha512
|
255
|
+
- checksum/metric_fu-4.4.0.gem.sha512
|
261
256
|
- config/roodi_config.yml
|
262
257
|
- gem_tasks/build.rake
|
263
258
|
- gemfiles/Gemfile.travis
|
@@ -270,6 +265,7 @@ files:
|
|
270
265
|
- lib/metric_fu/data_structures/careful_array.rb
|
271
266
|
- lib/metric_fu/data_structures/line_numbers.rb
|
272
267
|
- lib/metric_fu/data_structures/location.rb
|
268
|
+
- lib/metric_fu/environment.rb
|
273
269
|
- lib/metric_fu/errors/analysis_error.rb
|
274
270
|
- lib/metric_fu/formatter.rb
|
275
271
|
- lib/metric_fu/formatter/html.rb
|
@@ -277,7 +273,9 @@ files:
|
|
277
273
|
- lib/metric_fu/initial_requires.rb
|
278
274
|
- lib/metric_fu/io.rb
|
279
275
|
- lib/metric_fu/load_files.rb
|
276
|
+
- lib/metric_fu/loader.rb
|
280
277
|
- lib/metric_fu/logging/mf_debugger.rb
|
278
|
+
- lib/metric_fu/metric.rb
|
281
279
|
- lib/metric_fu/metrics/base_template.rb
|
282
280
|
- lib/metric_fu/metrics/cane/cane.rb
|
283
281
|
- lib/metric_fu/metrics/cane/cane_bluff_grapher.rb
|
@@ -360,6 +358,7 @@ files:
|
|
360
358
|
- lib/metric_fu/metrics/stats/stats_grapher.rb
|
361
359
|
- lib/metric_fu/metrics/stats/stats_hotspot.rb
|
362
360
|
- lib/metric_fu/metrics/stats/template_awesome/stats.html.erb
|
361
|
+
- lib/metric_fu/parser_ext.rb
|
363
362
|
- lib/metric_fu/reporter.rb
|
364
363
|
- lib/metric_fu/reporting/graphs/engines/bluff.rb
|
365
364
|
- lib/metric_fu/reporting/graphs/engines/gchart.rb
|
@@ -380,6 +379,7 @@ files:
|
|
380
379
|
- lib/metric_fu/reporting/templates/javascripts/excanvas.js
|
381
380
|
- lib/metric_fu/reporting/templates/javascripts/js-class.js
|
382
381
|
- lib/metric_fu/run.rb
|
382
|
+
- lib/metric_fu/sexp_ext.rb
|
383
383
|
- lib/metric_fu/tasks/metric_fu.rake
|
384
384
|
- lib/metric_fu/version.rb
|
385
385
|
- lib/metric_fu_requires.rb
|
@@ -391,6 +391,7 @@ files:
|
|
391
391
|
- spec/metric_fu/formatter/html_spec.rb
|
392
392
|
- spec/metric_fu/formatter/yaml_spec.rb
|
393
393
|
- spec/metric_fu/formatter_spec.rb
|
394
|
+
- spec/metric_fu/metric_spec.rb
|
394
395
|
- spec/metric_fu/metrics/base_template_spec.rb
|
395
396
|
- spec/metric_fu/metrics/cane/cane_spec.rb
|
396
397
|
- spec/metric_fu/metrics/churn/churn_spec.rb
|
@@ -432,12 +433,14 @@ files:
|
|
432
433
|
- spec/resources/yml/metric_missing.yml
|
433
434
|
- spec/run_spec.rb
|
434
435
|
- spec/spec_helper.rb
|
436
|
+
- spec/support/helper_methods.rb
|
435
437
|
- spec/support/matcher_create_file.rb
|
436
438
|
- spec/support/matcher_create_files.rb
|
437
439
|
- spec/support/suite.rb
|
438
440
|
homepage: https://github.com/metricfu/metric_fu
|
439
441
|
licenses:
|
440
442
|
- MIT
|
443
|
+
metadata: {}
|
441
444
|
post_install_message:
|
442
445
|
rdoc_options:
|
443
446
|
- --main
|
@@ -445,22 +448,20 @@ rdoc_options:
|
|
445
448
|
require_paths:
|
446
449
|
- lib
|
447
450
|
required_ruby_version: !ruby/object:Gem::Requirement
|
448
|
-
none: false
|
449
451
|
requirements:
|
450
|
-
- -
|
452
|
+
- - '>='
|
451
453
|
- !ruby/object:Gem::Version
|
452
|
-
version: 1.
|
454
|
+
version: 1.9.0
|
453
455
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
454
|
-
none: false
|
455
456
|
requirements:
|
456
|
-
- -
|
457
|
+
- - '>='
|
457
458
|
- !ruby/object:Gem::Version
|
458
459
|
version: 1.3.6
|
459
460
|
requirements: []
|
460
461
|
rubyforge_project: metric_fu
|
461
|
-
rubygems_version:
|
462
|
+
rubygems_version: 2.0.3
|
462
463
|
signing_key:
|
463
|
-
specification_version:
|
464
|
+
specification_version: 4
|
464
465
|
summary: A fistful of code metrics, with awesome templates and graphs
|
465
466
|
test_files:
|
466
467
|
- spec/cli/helper_spec.rb
|
@@ -470,6 +471,7 @@ test_files:
|
|
470
471
|
- spec/metric_fu/formatter/html_spec.rb
|
471
472
|
- spec/metric_fu/formatter/yaml_spec.rb
|
472
473
|
- spec/metric_fu/formatter_spec.rb
|
474
|
+
- spec/metric_fu/metric_spec.rb
|
473
475
|
- spec/metric_fu/metrics/base_template_spec.rb
|
474
476
|
- spec/metric_fu/metrics/cane/cane_spec.rb
|
475
477
|
- spec/metric_fu/metrics/churn/churn_spec.rb
|
@@ -511,6 +513,7 @@ test_files:
|
|
511
513
|
- spec/resources/yml/metric_missing.yml
|
512
514
|
- spec/run_spec.rb
|
513
515
|
- spec/spec_helper.rb
|
516
|
+
- spec/support/helper_methods.rb
|
514
517
|
- spec/support/matcher_create_file.rb
|
515
518
|
- spec/support/matcher_create_files.rb
|
516
519
|
- spec/support/suite.rb
|