metric_fu 2.1.3.7.19 → 2.1.4.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/.rspec +2 -0
  2. data/.travis.yml +12 -0
  3. data/Gemfile +2 -2
  4. data/HISTORY.md +15 -2
  5. data/README.md +19 -12
  6. data/TODO.md +121 -7
  7. data/bin/metric_fu +134 -2
  8. data/lib/metric_fu.rb +8 -1
  9. data/lib/metric_fu/configuration.rb +192 -0
  10. data/lib/{data_structures → metric_fu/data_structures}/careful_array.rb +0 -0
  11. data/lib/{data_structures → metric_fu/data_structures}/line_numbers.rb +0 -0
  12. data/lib/{data_structures → metric_fu/data_structures}/location.rb +0 -0
  13. data/lib/{errors → metric_fu/errors}/analysis_error.rb +0 -0
  14. data/lib/{initial_requires.rb → metric_fu/initial_requires.rb} +1 -0
  15. data/lib/{load_files.rb → metric_fu/load_files.rb} +0 -8
  16. data/lib/{logging → metric_fu/logging}/mf_debugger.rb +0 -0
  17. data/lib/{metrics → metric_fu/metrics}/base_template.rb +0 -0
  18. data/lib/metric_fu/metrics/churn/churn.rb +64 -0
  19. data/lib/{metrics → metric_fu/metrics}/churn/churn_hotspot.rb +0 -0
  20. data/lib/metric_fu/metrics/churn/init.rb +5 -0
  21. data/lib/{metrics → metric_fu/metrics}/churn/template_awesome/churn.html.erb +0 -0
  22. data/lib/{metrics → metric_fu/metrics}/churn/template_standard/churn.html.erb +0 -0
  23. data/lib/{metrics → metric_fu/metrics}/flay/flay.rb +3 -1
  24. data/lib/{metrics → metric_fu/metrics}/flay/flay_grapher.rb +0 -0
  25. data/lib/{metrics → metric_fu/metrics}/flay/flay_hotspot.rb +0 -0
  26. data/lib/metric_fu/metrics/flay/init.rb +9 -0
  27. data/lib/{metrics → metric_fu/metrics}/flay/template_awesome/flay.html.erb +0 -0
  28. data/lib/{metrics → metric_fu/metrics}/flay/template_standard/flay.html.erb +0 -0
  29. data/lib/{metrics → metric_fu/metrics}/flog/flog.rb +0 -0
  30. data/lib/{metrics → metric_fu/metrics}/flog/flog_grapher.rb +0 -0
  31. data/lib/{metrics → metric_fu/metrics}/flog/flog_hotspot.rb +0 -0
  32. data/lib/metric_fu/metrics/flog/init.rb +7 -0
  33. data/lib/{metrics → metric_fu/metrics}/flog/template_awesome/flog.html.erb +0 -0
  34. data/lib/{metrics → metric_fu/metrics}/flog/template_standard/flog.html.erb +0 -0
  35. data/lib/{metrics → metric_fu/metrics}/generator.rb +3 -4
  36. data/lib/{metrics → metric_fu/metrics}/graph.rb +0 -0
  37. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/code_issue.rb +0 -0
  38. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/grouping.rb +0 -0
  39. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/ranking.rb +0 -0
  40. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/record.rb +0 -0
  41. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/scoring_strategies.rb +0 -0
  42. data/lib/{metrics → metric_fu/metrics}/hotspots/analysis/table.rb +0 -0
  43. data/lib/{metrics → metric_fu/metrics}/hotspots/hotspot_analyzer.rb +0 -0
  44. data/lib/{metrics → metric_fu/metrics}/hotspots/hotspots.rb +0 -0
  45. data/lib/metric_fu/metrics/hotspots/init.rb +5 -0
  46. data/lib/{metrics → metric_fu/metrics}/hotspots/template_awesome/hotspots.html.erb +0 -0
  47. data/lib/{metrics → metric_fu/metrics}/hotspots/template_standard/hotspots.html.erb +0 -0
  48. data/lib/metric_fu/metrics/rails_best_practices/init.rb +7 -0
  49. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices.rb +4 -2
  50. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/rails_best_practices_grapher.rb +0 -0
  51. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_awesome/rails_best_practices.html.erb +0 -0
  52. data/lib/{metrics → metric_fu/metrics}/rails_best_practices/template_standard/rails_best_practices.html.erb +0 -0
  53. data/lib/metric_fu/metrics/rcov/init.rb +18 -0
  54. data/lib/{metrics → metric_fu/metrics}/rcov/rcov.rb +22 -7
  55. data/lib/{metrics → metric_fu/metrics}/rcov/rcov_grapher.rb +0 -0
  56. data/lib/{metrics → metric_fu/metrics}/rcov/rcov_hotspot.rb +0 -0
  57. data/lib/{metrics → metric_fu/metrics}/rcov/template_awesome/rcov.html.erb +0 -0
  58. data/lib/{metrics → metric_fu/metrics}/rcov/template_standard/rcov.html.erb +0 -0
  59. data/lib/metric_fu/metrics/reek/init.rb +7 -0
  60. data/lib/{metrics → metric_fu/metrics}/reek/reek.rb +3 -1
  61. data/lib/{metrics → metric_fu/metrics}/reek/reek_grapher.rb +0 -0
  62. data/lib/{metrics → metric_fu/metrics}/reek/reek_hotspot.rb +0 -0
  63. data/lib/{metrics → metric_fu/metrics}/reek/template_awesome/reek.html.erb +0 -0
  64. data/lib/{metrics → metric_fu/metrics}/reek/template_standard/reek.html.erb +0 -0
  65. data/lib/metric_fu/metrics/roodi/init.rb +7 -0
  66. data/lib/{metrics → metric_fu/metrics}/roodi/roodi.rb +3 -1
  67. data/lib/{metrics → metric_fu/metrics}/roodi/roodi_grapher.rb +0 -0
  68. data/lib/{metrics → metric_fu/metrics}/roodi/roodi_hotspot.rb +0 -0
  69. data/lib/{metrics → metric_fu/metrics}/roodi/template_awesome/roodi.html.erb +0 -0
  70. data/lib/{metrics → metric_fu/metrics}/roodi/template_standard/roodi.html.erb +0 -0
  71. data/lib/metric_fu/metrics/saikuro/init.rb +11 -0
  72. data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro.rb +0 -0
  73. data/lib/{metrics → metric_fu/metrics}/saikuro/saikuro_hotspot.rb +0 -0
  74. data/lib/{metrics → metric_fu/metrics}/saikuro/template_awesome/saikuro.html.erb +0 -0
  75. data/lib/{metrics → metric_fu/metrics}/saikuro/template_standard/saikuro.html.erb +0 -0
  76. data/lib/metric_fu/metrics/stats/init.rb +7 -0
  77. data/lib/{metrics → metric_fu/metrics}/stats/stats.rb +3 -1
  78. data/lib/{metrics → metric_fu/metrics}/stats/stats_grapher.rb +0 -0
  79. data/lib/{metrics → metric_fu/metrics}/stats/stats_hotspot.rb +0 -0
  80. data/lib/{metrics → metric_fu/metrics}/stats/template_awesome/stats.html.erb +0 -0
  81. data/lib/{metrics → metric_fu/metrics}/stats/template_standard/stats.html.erb +0 -0
  82. data/lib/{reporting → metric_fu/reporting}/graphs/engines/bluff.rb +0 -0
  83. data/lib/{reporting → metric_fu/reporting}/graphs/engines/gchart.rb +0 -0
  84. data/lib/metric_fu/reporting/graphs/engines/init.rb +5 -0
  85. data/lib/{reporting → metric_fu/reporting}/graphs/grapher.rb +0 -0
  86. data/lib/{reporting → metric_fu/reporting}/report.rb +3 -2
  87. data/lib/{reporting → metric_fu/reporting}/templates/awesome/awesome_template.rb +0 -0
  88. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/buttons.css +0 -0
  89. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/default.css +0 -0
  90. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/integrity.css +0 -0
  91. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/reset.css +0 -0
  92. data/lib/{reporting → metric_fu/reporting}/templates/awesome/css/syntax.css +0 -0
  93. data/lib/{reporting → metric_fu/reporting}/templates/awesome/index.html.erb +0 -0
  94. data/lib/{reporting → metric_fu/reporting}/templates/awesome/layout.html.erb +0 -0
  95. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/bluff-min.js +0 -0
  96. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/excanvas.js +0 -0
  97. data/lib/{reporting → metric_fu/reporting}/templates/javascripts/js-class.js +0 -0
  98. data/lib/{reporting → metric_fu/reporting}/templates/standard/default.css +0 -0
  99. data/lib/{reporting → metric_fu/reporting}/templates/standard/index.html.erb +0 -0
  100. data/lib/{reporting → metric_fu/reporting}/templates/standard/standard_template.rb +0 -0
  101. data/lib/{run.rb → metric_fu/run.rb} +12 -11
  102. data/lib/{tasks → metric_fu/tasks}/metric_fu.rake +0 -0
  103. data/lib/metric_fu/version.rb +3 -0
  104. data/metric_fu.gemspec +13 -21
  105. data/spec/metric_fu/configuration_spec.rb +298 -0
  106. data/spec/{base → metric_fu/data_structures}/line_numbers_spec.rb +11 -11
  107. data/spec/{base → metric_fu/data_structures}/location_spec.rb +1 -1
  108. data/spec/{base → metric_fu/metrics}/base_template_spec.rb +1 -1
  109. data/spec/metric_fu/metrics/churn/churn_spec.rb +85 -0
  110. data/spec/{graphs → metric_fu/metrics/flay}/flay_grapher_spec.rb +3 -3
  111. data/spec/{generators → metric_fu/metrics/flay}/flay_spec.rb +1 -1
  112. data/spec/{graphs → metric_fu/metrics/flog}/flog_grapher_spec.rb +4 -4
  113. data/spec/{generators → metric_fu/metrics/flog}/flog_spec.rb +1 -1
  114. data/spec/{base → metric_fu/metrics}/generator_spec.rb +4 -3
  115. data/spec/{base → metric_fu/metrics}/graph_spec.rb +1 -1
  116. data/spec/{base → metric_fu/metrics/hotspots/analysis}/ranking_spec.rb +1 -1
  117. data/spec/{base → metric_fu/metrics/hotspots/analysis}/table_spec.rb +1 -1
  118. data/spec/{base → metric_fu/metrics/hotspots}/hotspot_analyzer_spec.rb +1 -1
  119. data/spec/{generators → metric_fu/metrics/hotspots}/hotspots_spec.rb +1 -1
  120. data/spec/{graphs → metric_fu/metrics/rails_best_practices}/rails_best_practices_grapher_spec.rb +3 -3
  121. data/spec/{generators → metric_fu/metrics/rails_best_practices}/rails_best_practices_spec.rb +1 -1
  122. data/spec/{graphs → metric_fu/metrics/rcov}/rcov_grapher_spec.rb +3 -3
  123. data/spec/{generators → metric_fu/metrics/rcov}/rcov_spec.rb +1 -1
  124. data/spec/{graphs → metric_fu/metrics/reek}/reek_grapher_spec.rb +3 -3
  125. data/spec/{generators → metric_fu/metrics/reek}/reek_spec.rb +1 -1
  126. data/spec/{graphs → metric_fu/metrics/roodi}/roodi_grapher_spec.rb +3 -3
  127. data/spec/{generators → metric_fu/metrics/roodi}/roodi_spec.rb +1 -1
  128. data/spec/{generators → metric_fu/metrics/saikuro}/saikuro_spec.rb +4 -4
  129. data/spec/{graphs → metric_fu/metrics/stats}/stats_grapher_spec.rb +3 -3
  130. data/spec/{generators → metric_fu/metrics/stats}/stats_spec.rb +7 -4
  131. data/spec/{graphs → metric_fu/reporting/graphs}/engines/bluff_spec.rb +3 -3
  132. data/spec/{graphs → metric_fu/reporting/graphs}/engines/gchart_spec.rb +2 -1
  133. data/spec/{base → metric_fu/reporting}/report_spec.rb +5 -3
  134. data/spec/spec_helper.rb +17 -5
  135. data/spec/support/suite.rb +16 -0
  136. metadata +195 -183
  137. data/lib/configuration.rb +0 -227
  138. data/lib/metrics/churn/churn.rb +0 -28
  139. data/lib/version.rb +0 -3
  140. data/spec/base/configuration_spec.rb +0 -277
  141. data/spec/generators/churn_spec.rb +0 -41
  142. data/spec/spec.opts +0 -6
@@ -1,58 +1,58 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu::LineNumbers do
4
4
 
5
5
  describe "in_method?" do
6
6
  it "should know if a line is NOT in a method" do
7
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
7
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
8
8
  ln.in_method?(2).should == false
9
9
  end
10
10
 
11
11
  it "should know if a line is in an instance method" do
12
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
12
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
13
13
  ln.in_method?(8).should == true
14
14
  end
15
15
 
16
16
  it "should know if a line is in an class method" do
17
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
17
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
18
18
  ln.in_method?(3).should == true
19
19
  end
20
20
  end
21
21
 
22
22
  describe "method_at_line" do
23
23
  it "should know the name of an instance method at a particular line" do
24
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
24
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
25
25
  ln.method_at_line(8).should == "Foo#what"
26
26
  end
27
27
 
28
28
  it "should know the name of a class method at a particular line" do
29
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
29
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
30
30
  ln.method_at_line(3).should == "Foo::awesome"
31
31
  end
32
32
 
33
33
  it "should know the name of a private method at a particular line" do
34
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
34
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
35
35
  ln.method_at_line(28).should == "Foo#whoop"
36
36
  end
37
37
 
38
38
  it "should know the name of a class method defined in a 'class << self block at a particular line" do
39
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/foo.rb"))
39
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/foo.rb"))
40
40
  ln.method_at_line(22).should == "Foo::neat"
41
41
  end
42
42
 
43
43
  it "should know the name of an instance method at a particular line in a file with two classes" do
44
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/two_classes.rb"))
44
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/two_classes.rb"))
45
45
  ln.method_at_line(3).should == "Foo#stuff"
46
46
  ln.method_at_line(9).should == "Bar#stuff"
47
47
  end
48
48
 
49
49
  it "should work with modules" do
50
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/module.rb"))
50
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/module.rb"))
51
51
  ln.method_at_line(4).should == 'KickAss#get_beat_up?'
52
52
  end
53
53
 
54
54
  it "should work with module surrounding class" do
55
- ln = MetricFu::LineNumbers.new(File.read(File.dirname(__FILE__) + "/../resources/line_numbers/module_surrounds_class.rb"))
55
+ ln = MetricFu::LineNumbers.new(File.read("#{resources_path}/line_numbers/module_surrounds_class.rb"))
56
56
  ln.method_at_line(5).should == "StuffModule::ThingClass#do_it"
57
57
  # ln.method_at_line(12).should == "StuffModule#blah" #why no work?
58
58
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu::Location do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
  require 'erb'
3
3
 
4
4
  describe MetricFu::Template do
@@ -0,0 +1,85 @@
1
+ require "spec_helper"
2
+
3
+ describe Churn do
4
+
5
+ let(:churn_yaml) { "--- \n:churn: \n :changed_files: \n - spec/graphs/flog_grapher_spec.rb\n - spec/base/graph_spec.rb\n - lib/templates/awesome/layout.html.erb\n - lib/graphs/rcov_grapher.rb\n - lib/base/base_template.rb\n - spec/graphs/grapher_spec.rb\n - lib/templates/awesome/flog.html.erb\n - lib/templates/awesome/flay.html.erb\n - lib/graphs/roodi_grapher.rb\n - lib/graphs/reek_grapher.rb\n - HISTORY\n - spec/graphs/roodi_grapher_spec.rb\n - lib/generators/rcov.rb\n - spec/graphs/engines/gchart_spec.rb\n - spec/graphs/rcov_grapher_spec.rb\n - lib/templates/javascripts/excanvas.js\n - lib/templates/javascripts/bluff-min.js\n - spec/graphs/reek_grapher_spec.rb\n" }
6
+
7
+ let(:config_setup) {
8
+ ENV['CC_BUILD_ARTIFACTS'] = nil
9
+ MetricFu.configure.reset
10
+ File.stub!(:directory?).and_return(true)
11
+ }
12
+
13
+ describe "new method" do
14
+ before :each do
15
+ config_setup
16
+ end
17
+
18
+ it "initializes with yaml option" do
19
+ churn = MetricFu::Churn.new
20
+ churn.send(:build_churn_options).should == "--yaml"
21
+ end
22
+
23
+ it "initializes with given minimum_churn_count option" do
24
+ churn = MetricFu::Churn.new( { :minimum_churn_count => 5 })
25
+ churn.send(:build_churn_options).should == "--yaml --minimum_churn_count=5"
26
+ end
27
+ end
28
+
29
+
30
+ describe "analyze method" do
31
+ before :each do
32
+ config_setup
33
+ @changes = {"lib/generators/flog.rb" => 2, "lib/metric_fu.rb" => 3}
34
+ end
35
+
36
+ it "should be empty on error" do
37
+ churn = MetricFu::Churn.new
38
+ churn.instance_variable_set(:@output, "Churning requires a subversion or git repo")
39
+ result = churn.analyze
40
+ result.should == [:churn => {}]
41
+ end
42
+
43
+ it "should return yaml results" do
44
+ churn = MetricFu::Churn.new
45
+ churn.instance_variable_set(:@output, churn_yaml)
46
+ result = churn.analyze
47
+ result.should == {:churn => {:changed_files => ["spec/graphs/flog_grapher_spec.rb", "spec/base/graph_spec.rb", "lib/templates/awesome/layout.html.erb", "lib/graphs/rcov_grapher.rb", "lib/base/base_template.rb", "spec/graphs/grapher_spec.rb", "lib/templates/awesome/flog.html.erb", "lib/templates/awesome/flay.html.erb", "lib/graphs/roodi_grapher.rb", "lib/graphs/reek_grapher.rb", "HISTORY", "spec/graphs/roodi_grapher_spec.rb", "lib/generators/rcov.rb", "spec/graphs/engines/gchart_spec.rb", "spec/graphs/rcov_grapher_spec.rb", "lib/templates/javascripts/excanvas.js", "lib/templates/javascripts/bluff-min.js", "spec/graphs/reek_grapher_spec.rb"]}}
48
+ end
49
+
50
+ end
51
+
52
+
53
+ describe "to_h method" do
54
+ before :each do
55
+ config_setup
56
+ end
57
+
58
+ it "should put the changes into a hash" do
59
+ churn = MetricFu::Churn.new
60
+ churn.instance_variable_set(:@churn, {:churn => 'results'})
61
+ churn.to_h[:churn].should == "results"
62
+ end
63
+ end
64
+
65
+
66
+ describe "emit method" do
67
+ before :each do
68
+ config_setup
69
+ @churn = MetricFu::Churn.new
70
+ end
71
+
72
+ it "returns churn output" do
73
+ @churn.stub(:churn_code).and_return(" master\n#{churn_yaml}")
74
+ result = @churn.emit
75
+ result.should == churn_yaml
76
+ end
77
+
78
+ it "returns nil, when churn result is not yaml" do
79
+ @churn.stub(:churn_code).and_return(" master\n")
80
+ result = @churn.emit
81
+ result.should be nil
82
+ end
83
+ end
84
+ end
85
+
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe FlayGrapher do
4
4
  before :each do
@@ -21,7 +21,7 @@ describe FlayGrapher do
21
21
  describe "responding to #get_metrics" do
22
22
  context "when metrics were not generated" do
23
23
  before(:each) do
24
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
24
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
25
25
  @date = "1/2"
26
26
  end
27
27
 
@@ -38,7 +38,7 @@ describe FlayGrapher do
38
38
 
39
39
  context "when metrics have been generated" do
40
40
  before(:each) do
41
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
41
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
42
42
  @date = "1/2"
43
43
  end
44
44
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Flay do
4
4
  describe "emit method" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu::FlogGrapher do
4
4
  before :each do
@@ -47,7 +47,7 @@ describe MetricFu::FlogGrapher do
47
47
 
48
48
  context "when metrics were not generated" do
49
49
  before(:each) do
50
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
50
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
51
51
  @date = "1/2"
52
52
  end
53
53
 
@@ -69,7 +69,7 @@ describe MetricFu::FlogGrapher do
69
69
 
70
70
  context "when metrics have been generated" do
71
71
  before(:each) do
72
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
72
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
73
73
  @date = "1/2"
74
74
  end
75
75
 
@@ -93,7 +93,7 @@ describe MetricFu::FlogGrapher do
93
93
 
94
94
  describe "responding to #get_metrics with legacy data" do
95
95
  before(:each) do
96
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
96
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
97
97
 
98
98
  @date = "1/2"
99
99
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
  describe Flog do
3
3
  before :each do
4
4
  MetricFu::Configuration.run {}
@@ -1,11 +1,9 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu::Generator do
4
4
 
5
5
  include Construct::Helpers
6
6
 
7
- MetricFu::Configuration.run do |config|
8
- end
9
7
 
10
8
  class ConcreteClass < MetricFu::Generator
11
9
  def emit
@@ -19,6 +17,9 @@ describe MetricFu::Generator do
19
17
  end
20
18
 
21
19
  before(:each) do
20
+ ENV['CC_BUILD_ARTIFACTS'] = nil
21
+ MetricFu.configuration.reset
22
+ MetricFu.configure
22
23
  @concrete_class = ConcreteClass.new
23
24
  end
24
25
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Ranking do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Table do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe HotspotAnalyzer do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Hotspots do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe RailsBestPracticesGrapher do
4
4
  before :each do
@@ -21,7 +21,7 @@ describe RailsBestPracticesGrapher do
21
21
  describe "responding to #get_metrics" do
22
22
  context "when metrics were not generated" do
23
23
  before(:each) do
24
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
24
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
25
25
  @date = "01022003"
26
26
  end
27
27
 
@@ -38,7 +38,7 @@ describe RailsBestPracticesGrapher do
38
38
 
39
39
  context "when metrics have been generated" do
40
40
  before(:each) do
41
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
41
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
42
42
  @date = "01022003"
43
43
  end
44
44
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe RailsBestPractices do
4
4
  describe "emit method" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe RcovGrapher do
4
4
  before :each do
@@ -21,7 +21,7 @@ describe RcovGrapher do
21
21
  describe "responding to #get_metrics" do
22
22
  context "when metrics were not generated" do
23
23
  before(:each) do
24
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
24
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
25
25
  @date = "1/2"
26
26
  end
27
27
 
@@ -38,7 +38,7 @@ describe RcovGrapher do
38
38
 
39
39
  context "when metrics have been generated" do
40
40
  before(:each) do
41
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
41
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
42
42
  @date = "1/2"
43
43
  end
44
44
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe MetricFu::Rcov do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe ReekGrapher do
4
4
  before :each do
@@ -21,7 +21,7 @@ describe ReekGrapher do
21
21
  describe "responding to #get_metrics" do
22
22
  context "when metrics were not generated" do
23
23
  before(:each) do
24
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
24
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
25
25
  @date = "1/2"
26
26
  end
27
27
 
@@ -38,7 +38,7 @@ describe ReekGrapher do
38
38
 
39
39
  context "when metrics have been generated" do
40
40
  before(:each) do
41
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
41
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
42
42
  @date = "1/2"
43
43
  end
44
44
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Reek do
4
4
  describe "emit" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe RoodiGrapher do
4
4
  before :each do
@@ -21,7 +21,7 @@ describe RoodiGrapher do
21
21
  describe "responding to #get_metrics" do
22
22
  context "when metrics were not generated" do
23
23
  before(:each) do
24
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "metric_missing.yml")))
24
+ @metrics = YAML::load(File.open("#{resources_path}/yml/metric_missing.yml"))
25
25
  @date = "1/2"
26
26
  end
27
27
 
@@ -38,7 +38,7 @@ describe RoodiGrapher do
38
38
 
39
39
  context "when metrics have been generated" do
40
40
  before(:each) do
41
- @metrics = YAML::load(File.open(File.join(File.dirname(__FILE__), "..", "resources", "yml", "20090630.yml")))
41
+ @metrics = YAML::load(File.open("#{resources_path}/yml/20090630.yml"))
42
42
  @date = "1/2"
43
43
  end
44
44
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Roodi do
4
4
  describe "emit" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
1
+ require "spec_helper"
2
2
 
3
3
  describe Saikuro do
4
4
  describe "to_h method" do
@@ -6,7 +6,7 @@ describe Saikuro do
6
6
  MetricFu::Configuration.run {}
7
7
  File.stub!(:directory?).and_return(true)
8
8
  saikuro = MetricFu::Saikuro.new
9
- saikuro.stub!(:metric_directory).and_return(File.join(File.dirname(__FILE__), "..", "resources", "saikuro"))
9
+ saikuro.stub!(:metric_directory).and_return("#{resources_path}/saikuro")
10
10
  saikuro.analyze
11
11
  @output = saikuro.to_h
12
12
  end
@@ -39,7 +39,7 @@ describe Saikuro do
39
39
  MetricFu::Configuration.run {}
40
40
  File.stub!(:directory?).and_return(true)
41
41
  @saikuro = MetricFu::Saikuro.new
42
- @saikuro.stub!(:metric_directory).and_return(File.join(File.dirname(__FILE__), "..", "resources", "saikuro"))
42
+ @saikuro.stub!(:metric_directory).and_return("#{resources_path}/saikuro")
43
43
  @saikuro.analyze
44
44
  @output = @saikuro.to_h
45
45
  end
@@ -65,7 +65,7 @@ describe Saikuro do
65
65
  describe Saikuro::SFile do
66
66
  describe "getting elements from a Saikuro result file" do
67
67
  it "should parse nested START/END sections" do
68
- path = File.join(File.dirname(__FILE__), "..", "resources", "saikuro_sfiles", "thing.rb_cyclo.html")
68
+ path = "#{resources_path}/saikuro_sfiles/thing.rb_cyclo.html"
69
69
  sfile = Saikuro::SFile.new path
70
70
  sfile.elements.map { |e| e.complexity }.sort.should eql(["0","0","2"])
71
71
  end