metric_fu 4.10.0 → 4.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -2
  4. data/.simplecov +42 -0
  5. data/.travis.yml +7 -6
  6. data/CONTRIBUTING.md +1 -1
  7. data/DEV.md +4 -3
  8. data/Gemfile +29 -7
  9. data/HISTORY.md +29 -3
  10. data/README.md +6 -1
  11. data/Rakefile +33 -11
  12. data/checksum/metric_fu-4.10.0.gem.sha512 +1 -1
  13. data/gem_tasks/usage_test.rake +0 -11
  14. data/lib/metric_fu.rb +12 -0
  15. data/lib/metric_fu/configuration.rb +1 -5
  16. data/lib/metric_fu/environment.rb +3 -3
  17. data/lib/metric_fu/formatter.rb +1 -1
  18. data/lib/metric_fu/formatter/html.rb +9 -9
  19. data/lib/metric_fu/gem_run.rb +2 -2
  20. data/lib/metric_fu/{metrics/generator.rb → generator.rb} +0 -0
  21. data/lib/metric_fu/loader.rb +30 -23
  22. data/lib/metric_fu/logger.rb +65 -0
  23. data/lib/metric_fu/logging/mf_debugger.rb +13 -48
  24. data/lib/metric_fu/metric.rb +3 -3
  25. data/lib/metric_fu/metrics/cane/{cane.rb → generator.rb} +0 -0
  26. data/lib/metric_fu/metrics/cane/{cane_grapher.rb → grapher.rb} +0 -0
  27. data/lib/metric_fu/metrics/cane/{init.rb → metric.rb} +1 -1
  28. data/lib/metric_fu/metrics/cane/{template_awesome/cane.html.erb → report.html.erb} +0 -0
  29. data/lib/metric_fu/metrics/churn/{churn.rb → generator.rb} +0 -0
  30. data/lib/metric_fu/metrics/churn/{churn_hotspot.rb → hotspot.rb} +0 -0
  31. data/lib/metric_fu/metrics/churn/{init.rb → metric.rb} +0 -0
  32. data/lib/metric_fu/metrics/churn/{template_awesome/churn.html.erb → report.html.erb} +0 -0
  33. data/lib/metric_fu/metrics/flay/{flay.rb → generator.rb} +16 -2
  34. data/lib/metric_fu/metrics/flay/{flay_grapher.rb → grapher.rb} +0 -0
  35. data/lib/metric_fu/metrics/flay/{flay_hotspot.rb → hotspot.rb} +0 -0
  36. data/lib/metric_fu/metrics/flay/{init.rb → metric.rb} +1 -1
  37. data/lib/metric_fu/metrics/flay/{template_awesome/flay.html.erb → report.html.erb} +0 -0
  38. data/lib/metric_fu/metrics/flog/{flog.rb → generator.rb} +0 -0
  39. data/lib/metric_fu/metrics/flog/{flog_grapher.rb → grapher.rb} +0 -0
  40. data/lib/metric_fu/metrics/flog/{flog_hotspot.rb → hotspot.rb} +0 -0
  41. data/lib/metric_fu/metrics/flog/{init.rb → metric.rb} +1 -1
  42. data/lib/metric_fu/metrics/flog/{template_awesome/flog.html.erb → report.html.erb} +0 -0
  43. data/lib/metric_fu/metrics/hotspots/{hotspots.rb → generator.rb} +1 -1
  44. data/lib/metric_fu/metrics/hotspots/{init.rb → metric.rb} +0 -0
  45. data/lib/metric_fu/metrics/hotspots/{template_awesome/hotspots.html.erb → report.html.erb} +0 -0
  46. data/lib/metric_fu/metrics/rails_best_practices/{rails_best_practices.rb → generator.rb} +0 -0
  47. data/lib/metric_fu/metrics/rails_best_practices/{rails_best_practices_grapher.rb → grapher.rb} +0 -0
  48. data/lib/metric_fu/metrics/rails_best_practices/{init.rb → metric.rb} +1 -1
  49. data/lib/metric_fu/metrics/rails_best_practices/{template_awesome/rails_best_practices.html.erb → report.html.erb} +0 -0
  50. data/lib/metric_fu/metrics/rcov/{rcov.rb → generator.rb} +0 -0
  51. data/lib/metric_fu/metrics/rcov/{rcov_grapher.rb → grapher.rb} +0 -0
  52. data/lib/metric_fu/metrics/rcov/{rcov_hotspot.rb → hotspot.rb} +0 -0
  53. data/lib/metric_fu/metrics/rcov/{init.rb → metric.rb} +0 -0
  54. data/lib/metric_fu/metrics/rcov/rcov_format_coverage.rb +57 -9
  55. data/lib/metric_fu/metrics/rcov/{template_awesome/rcov.html.erb → report.html.erb} +0 -0
  56. data/lib/metric_fu/metrics/rcov/simplecov_formatter.rb +13 -2
  57. data/lib/metric_fu/metrics/reek/{reek.rb → generator.rb} +0 -0
  58. data/lib/metric_fu/metrics/reek/{reek_grapher.rb → grapher.rb} +0 -0
  59. data/lib/metric_fu/metrics/reek/{reek_hotspot.rb → hotspot.rb} +1 -1
  60. data/lib/metric_fu/metrics/reek/{init.rb → metric.rb} +0 -0
  61. data/lib/metric_fu/metrics/reek/{template_awesome/reek.html.erb → report.html.erb} +0 -0
  62. data/lib/metric_fu/metrics/roodi/{roodi.rb → generator.rb} +0 -0
  63. data/lib/metric_fu/metrics/roodi/{roodi_grapher.rb → grapher.rb} +0 -0
  64. data/lib/metric_fu/metrics/roodi/{roodi_hotspot.rb → hotspot.rb} +0 -0
  65. data/lib/metric_fu/metrics/roodi/{init.rb → metric.rb} +0 -0
  66. data/lib/metric_fu/metrics/roodi/{template_awesome/roodi.html.erb → report.html.erb} +0 -0
  67. data/lib/metric_fu/metrics/saikuro/{saikuro.rb → generator.rb} +0 -0
  68. data/lib/metric_fu/metrics/saikuro/{saikuro_hotspot.rb → hotspot.rb} +0 -0
  69. data/lib/metric_fu/metrics/saikuro/{init.rb → metric.rb} +0 -0
  70. data/lib/metric_fu/metrics/saikuro/{template_awesome/saikuro.html.erb → report.html.erb} +0 -0
  71. data/lib/metric_fu/metrics/stats/{stats.rb → generator.rb} +1 -1
  72. data/lib/metric_fu/metrics/stats/{stats_grapher.rb → grapher.rb} +0 -0
  73. data/lib/metric_fu/metrics/stats/{stats_hotspot.rb → hotspot.rb} +0 -0
  74. data/lib/metric_fu/metrics/stats/{init.rb → metric.rb} +0 -0
  75. data/lib/metric_fu/metrics/stats/{template_awesome/stats.html.erb → report.html.erb} +0 -0
  76. data/lib/metric_fu/{metrics → reporting/graphs}/graph.rb +0 -0
  77. data/lib/metric_fu/{reporting/templates/awesome → templates}/_graph.html.erb +0 -0
  78. data/lib/metric_fu/{reporting/templates/awesome → templates}/_report_footer.html.erb +0 -0
  79. data/lib/metric_fu/templates/configuration.rb +3 -2
  80. data/lib/metric_fu/{reporting/templates/awesome → templates}/index.html.erb +1 -1
  81. data/lib/metric_fu/{reporting/templates → templates}/javascripts/bluff-min.js +0 -0
  82. data/lib/metric_fu/{reporting/templates → templates}/javascripts/bluff_graph.js +0 -0
  83. data/lib/metric_fu/{reporting/templates → templates}/javascripts/excanvas.js +0 -0
  84. data/lib/metric_fu/{reporting/templates → templates}/javascripts/highcharts.js +0 -0
  85. data/lib/metric_fu/{reporting/templates → templates}/javascripts/highcharts_graph.js +0 -0
  86. data/lib/metric_fu/{reporting/templates → templates}/javascripts/js-class.js +0 -0
  87. data/lib/metric_fu/{reporting/templates → templates}/javascripts/standalone-framework.js +0 -0
  88. data/lib/metric_fu/{reporting/templates → templates}/javascripts/utils.js +0 -0
  89. data/lib/metric_fu/{reporting/templates/awesome → templates}/layout.html.erb +1 -1
  90. data/lib/metric_fu/templates/metrics_template.rb +68 -0
  91. data/lib/metric_fu/templates/report.rb +11 -3
  92. data/lib/metric_fu/{metrics/base_template.rb → templates/template.rb} +8 -24
  93. data/lib/metric_fu/utility.rb +25 -0
  94. data/lib/metric_fu/version.rb +1 -1
  95. data/metric_fu.gemspec +2 -0
  96. data/spec/capture_warnings.rb +48 -0
  97. data/spec/dummy/lib/bad_encoding.rb +6 -0
  98. data/spec/fixtures/coverage-153.rb +11 -0
  99. data/spec/fixtures/rcov_output.txt +135 -0
  100. data/spec/metric_fu/configuration_spec.rb +4 -265
  101. data/spec/metric_fu/formatter/configuration_spec.rb +46 -0
  102. data/spec/metric_fu/formatter/html_spec.rb +17 -25
  103. data/spec/metric_fu/formatter/yaml_spec.rb +1 -1
  104. data/spec/metric_fu/{metrics/generator_spec.rb → generator_spec.rb} +0 -0
  105. data/spec/metric_fu/metrics/cane/configuration_spec.rb +22 -0
  106. data/spec/metric_fu/metrics/cane/{cane_spec.rb → generator_spec.rb} +1 -1
  107. data/spec/metric_fu/metrics/churn/configuration_spec.rb +15 -0
  108. data/spec/metric_fu/metrics/churn/{churn_spec.rb → generator_spec.rb} +1 -1
  109. data/spec/metric_fu/metrics/flay/configuration_spec.rb +15 -0
  110. data/spec/metric_fu/metrics/flay/{flay_spec.rb → generator_spec.rb} +2 -2
  111. data/spec/metric_fu/metrics/flay/{flay_grapher_spec.rb → grapher_spec.rb} +1 -1
  112. data/spec/metric_fu/metrics/flog/configuration_spec.rb +20 -0
  113. data/spec/metric_fu/metrics/flog/{flog_spec.rb → generator_spec.rb} +1 -1
  114. data/spec/metric_fu/metrics/flog/{flog_grapher_spec.rb → grapher_spec.rb} +1 -1
  115. data/spec/metric_fu/metrics/hotspots/{hotspots_spec.rb → generator_spec.rb} +1 -1
  116. data/spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb +47 -0
  117. data/spec/metric_fu/metrics/rails_best_practices/{rails_best_practices_spec.rb → generator_spec.rb} +1 -1
  118. data/spec/metric_fu/metrics/rails_best_practices/{rails_best_practices_grapher_spec.rb → grapher_spec.rb} +1 -1
  119. data/spec/metric_fu/metrics/rcov/configuration_spec.rb +30 -0
  120. data/spec/metric_fu/metrics/rcov/generator_spec.rb +26 -0
  121. data/spec/metric_fu/metrics/rcov/{rcov_grapher_spec.rb → grapher_spec.rb} +1 -1
  122. data/spec/metric_fu/metrics/rcov/{rcov_hotspot_spec.rb → hotspot_spec.rb} +2 -2
  123. data/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb +40 -12
  124. data/spec/metric_fu/metrics/reek/configuration_spec.rb +13 -0
  125. data/spec/metric_fu/metrics/reek/{reek_spec.rb → generator_spec.rb} +1 -1
  126. data/spec/metric_fu/metrics/reek/{reek_grapher_spec.rb → grapher_spec.rb} +1 -1
  127. data/spec/metric_fu/metrics/roodi/configuration_spec.rb +16 -0
  128. data/spec/metric_fu/metrics/roodi/{roodi_spec.rb → generator_spec.rb} +1 -1
  129. data/spec/metric_fu/metrics/roodi/{roodi_grapher_spec.rb → grapher_spec.rb} +1 -1
  130. data/spec/metric_fu/metrics/saikuro/configuration_spec.rb +26 -0
  131. data/spec/metric_fu/metrics/saikuro/{saikuro_spec.rb → generator_spec.rb} +1 -1
  132. data/spec/metric_fu/metrics/stats/{stats_spec.rb → generator_spec.rb} +1 -1
  133. data/spec/metric_fu/metrics/stats/{stats_grapher_spec.rb → grapher_spec.rb} +1 -1
  134. data/spec/metric_fu/{metrics → reporting/graphs}/graph_spec.rb +1 -1
  135. data/spec/metric_fu/run_spec.rb +1 -1
  136. data/spec/metric_fu/templates/configuration_spec.rb +57 -0
  137. data/spec/metric_fu/templates/report_spec.rb +15 -0
  138. data/spec/metric_fu/{metrics/base_template_spec.rb → templates/template_spec.rb} +0 -0
  139. data/spec/quality_spec.rb +86 -0
  140. data/spec/shared/configured.rb +47 -0
  141. data/spec/shared/test_coverage.rb +99 -0
  142. data/spec/spec_helper.rb +9 -5
  143. data/spec/support/helper_methods.rb +3 -2
  144. data/spec/support/matcher_create_file.rb +2 -2
  145. data/spec/support/matcher_create_files.rb +2 -2
  146. data/spec/support/usage_test.rb +24 -7
  147. data/spec/usage_test_spec.rb +28 -2
  148. metadata +165 -112
  149. metadata.gz.sig +0 -0
  150. data/Gemfile.devtools +0 -39
  151. data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +0 -62
  152. data/spec/metric_fu/metrics/rcov/rcov_spec.rb +0 -185
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDU0ZjAyZDI4ZTQxN2JhZDVlNzc5M2VmNDBiYmNjODNjMTE4ZTczMA==
4
+ NTlhNTUwYTY3MzMxNmZiZGM4YzM4YjI0YjM2ZmUwMTU4MzA2YTM5NQ==
5
5
  data.tar.gz: !binary |-
6
- MzI4ZDg2NjA1NzIwZmM5NDFjMzM5NGFhZjFjM2I4NGVjOGUwMGI1ZQ==
6
+ ZTNjOGQwNjIxOWRhYWYzYzE3ZWE4MTAzYjhlZmI0ZDAzNGU3Mjc3NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2MyNjBjZGVhZDgxNzk2OTE3MWMwNDU1ZGI3NjMzNjRhYTI2NjI2OGE4MzQy
10
- NDI1NzFkNDRkYjU3NzM5NDdjYzI4NDEzNTZmMjA4NWZlYjM2ZWUyZGMzMmJk
11
- MWNlZWY4NDk2NDlhMzU3ZWYxYzZlY2E1MmYwZjA4NDRjM2IyZmE=
9
+ ZTkwMWM3ZjBkMjUwZDQzYzJiMmQ1YzZlZmNmMzMxNDVlNWM4NWRkZTE4MTEy
10
+ MGM4YjI3YjBkYWQxNGJhZGE5NTFiNDgxMmUwMTU4YzY2OTY5NjYzYjdlYTg4
11
+ YzFhYTVkZWRiYzU2ZDNiNzk3NWM3ZGNkMDBjYjI1NGZkMDI5OWI=
12
12
  data.tar.gz: !binary |-
13
- N2JkYzVjNGY0OTI2OThlZDgwYTYzYjk5OGU0Yjg1NjQ3Y2JmYjE2NzRlYjc2
14
- ZDMxODUxMGFjMmNmZDQ2OTdhOTVlMTVmMzc5YjEzNjA3MGNhZGM1M2JiODUy
15
- NWUyM2RmZDQ2NmY3YjI2MzExZGU3ZmJmMjk2YTVhZDY5NzY4Nzg=
13
+ ZjkyNGU5YmE2MGRjYmEwODJkMTdlY2JlNjc0OWM5Y2JmZTc5ZGI4YmQ3NzEw
14
+ MDI0YWE1ZGYxMDVkYWM5MzNhY2VkZDlhYjc1NjkxYjE3ZTRjMGI2NjUyZDZj
15
+ ZWY1NWI4NmJlNzE5ZGE4NTY5MTdiOTE4NWRmODI4OTVmNGFjNGQ=
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- j���X��0J��k�J��ȮE'
2
- ]&ݩ&
1
+ ҫ�4ev��b�-��Nt�+>�g��>,�b*�rtz
2
+ ���<e�3�F�%z��Aʁp�"f�n2��Y���ٲ�E�#c�����@�H�P����ע���q�_o<���1���#b�����5�'ϟi�~kR�)��7�� �O+�*~ ���
data/.simplecov ADDED
@@ -0,0 +1,42 @@
1
+ # https://github.com/colszowka/simplecov#using-simplecov-for-centralized-config
2
+ # see https://github.com/colszowka/simplecov/blob/master/lib/simplecov/defaults.rb
3
+ if SimpleCov.respond_to?(:profiles)
4
+ SimpleCov.profiles
5
+ else
6
+ SimpleCov.adapters
7
+ end.define 'metric_fu' do
8
+ if defined?(load_profile)
9
+ load_profile 'test_frameworks'
10
+ else
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ add_group "Cli", "lib/metric_fu/cli"
15
+ add_group "Data Structures", "lib/metric_fu/data_structures"
16
+ add_group "Formatters", "lib/metric_fu/formatter"
17
+ add_group "Hotspots", "lib/metric_fu/metrics/hotspots"
18
+ add_group "Metrics", "lib/metric_fu/metrics"
19
+ add_group "Reporters", "lib/metric_fu/reporting"
20
+ add_group "Templates", "lib/metric_fu/templates"
21
+
22
+ add_group "Long files" do |src_file|
23
+ src_file.lines.count > 100
24
+ end
25
+ class MaxLinesFilter < SimpleCov::Filter
26
+ def matches?(source_file)
27
+ source_file.lines.count < filter_argument
28
+ end
29
+ end
30
+ add_group "Short files", MaxLinesFilter.new(5)
31
+
32
+ # Exclude these paths from analysis
33
+ add_filter 'bundle'
34
+ add_filter 'bin'
35
+ add_filter 'lib/metric_fu/tasks'
36
+ end
37
+ SimpleCov.at_exit do
38
+ File.open(File.join(SimpleCov.coverage_path, 'coverage_percent.txt'), 'w') do |f|
39
+ f.write SimpleCov.result.covered_percent
40
+ end
41
+ SimpleCov.result.format!
42
+ end
data/.travis.yml CHANGED
@@ -1,21 +1,22 @@
1
1
  language: ruby
2
- bundler_args: --without local_development yard metrics guard --path vendor/bundle
2
+ bundler_args: --path vendor/bundle
3
3
  script: bundle exec rspec
4
4
  cache: bundler
5
5
  gemfile:
6
6
  - gemfiles/Gemfile.travis
7
7
  before_install:
8
8
  - gem install bundler
9
- - bundle config --local without local_development
10
- # env:
11
- # - "rack=1.3.4"
9
+ - bundle config --local without local_development yard guard
12
10
  rvm:
13
- - 2.1.0
11
+ # 2.1, not 2.1.0 until fixed https://github.com/travis-ci/travis-ci/issues/2220
12
+ - 2.1
14
13
  - 2.0.0
15
14
  - 1.9.3
16
15
  - 1.9.2
17
16
  - jruby
18
- - rbx-2
17
+ - "rbx-2"
19
18
  matrix:
20
19
  allow_failures:
21
20
  - rvm: rbx-2
21
+ - rvm: 2.1
22
+ fast_finish: true
data/CONTRIBUTING.md CHANGED
@@ -8,7 +8,7 @@ How to contribute:
8
8
 
9
9
  ## Code
10
10
 
11
- 1. Fork and clone the repo: `git clone git://github.com/yourghname/metric_fu.git && cd metric_fu`
11
+ 1. Fork and clone the repo: `git clone git://github.com/yourghname/metric_fu.git && cd metric_fu`
12
12
  2. Install the gem dependencies: `bundle install`
13
13
  3. Make the changes you want and back them up with tests.
14
14
  * Run the tests (`bundle exec rspec`)
data/DEV.md CHANGED
@@ -9,14 +9,15 @@ MetricFu.loader.load_user_configuration
9
9
  MetricFu.loader.loaded_files
10
10
  MetricFu.lib_require { 'utility' }
11
11
  MetricFu.lib_dir #=> metric_fu/lib
12
- MetricFu.lib_require('metrics') { 'flog/init' }
13
- MetricFu.metrics_require {'flog/init' }
12
+ MetricFu.lib_require('metrics') { 'flog/metric' }
13
+ MetricFu.metrics_require {'flog/metric' }
14
14
  MetricFu.metrics_dir #=> metric_fu/lib/metrics
15
15
  MetricFu.formatter_require { 'html' }
16
16
  MetricFu.formatter_dir #=> metric_fu/lib/formatter
17
17
  MetricFu.reporting_require { 'result' }
18
18
  MetricFu.reporting_dir #=> metric_fu/lib/reporting
19
19
  MetricFu.logging_require { 'mf_debugger' }
20
+ MetricFu.lib_require { 'logger' }
20
21
  MetricFu.logging_dir #=> metric_fu/lib/logging
21
22
  MetricFu.errors_require { 'analysis_error' }
22
23
  MetricFu.errors_dir #=> metric_fu/lib/errors
@@ -41,7 +42,7 @@ end
41
42
 
42
43
  ```ruby
43
44
  # Given
44
- template = AwesomeTemplate.new
45
+ template = MetricFu::Templates::MetricsTemplate.new
45
46
 
46
47
  # Render _report_footer.html.erb partial:
47
48
 
data/Gemfile CHANGED
@@ -1,17 +1,39 @@
1
+ # encoding: utf-8
1
2
  source 'https://rubygems.org'
2
3
 
3
-
4
4
  group :test, :local_development do
5
5
  gem 'pry'
6
6
  gem 'pry-nav'
7
- gem 'redcarpet', :platforms => :ruby
8
7
  end
9
8
 
10
9
  gemspec :path => File.expand_path('..', __FILE__)
11
10
 
12
- # group :development, :test do
13
- # gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
14
- # end
15
-
16
11
  # Added by devtools
17
- eval_gemfile File.expand_path('Gemfile.devtools', File.dirname(__FILE__))
12
+ group :development do
13
+ gem 'rake', '~> 10.1.0'
14
+ gem 'rspec', '~> 3.0.0.beta2'
15
+ gem 'yard', '~> 0.8.7', group: :yard
16
+ end
17
+
18
+ group :guard do
19
+ gem 'guard', '~> 1.8.1'
20
+ gem 'guard-bundler', '~> 1.0.0'
21
+ gem 'guard-rspec'
22
+
23
+ # file system change event handling
24
+ gem 'listen', '~> 1.3.0'
25
+ gem 'rb-fchange', '~> 0.0.6', require: false
26
+ gem 'rb-fsevent', '~> 0.9.3', require: false
27
+ gem 'rb-inotify', '~> 0.9.0', require: false
28
+
29
+ # notification handling
30
+ gem 'libnotify', '~> 0.8.0', require: false
31
+ gem 'rb-notifu', '~> 0.0.4', require: false
32
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
33
+ end
34
+
35
+ platform :jruby do
36
+ group :jruby do
37
+ gem 'jruby-openssl', '~> 0.8.5'
38
+ end
39
+ end
data/HISTORY.md CHANGED
@@ -1,16 +1,42 @@
1
- Changes are below categorized as `Features, Fixes, or Misc`.
1
+ Changes are below categorized as `Breaking changes, Features, Fixes, or Misc`.
2
2
 
3
3
  Each change should fall into categories that would affect whether the release is major (breaking changes), minor (new behavior), or patch (bug fix). See [semver](http://semver.org/) and [pessimistic versioning](http://docs.rubygems.org/read/chapter/16#page74)
4
4
 
5
- As such, a _Feature_ would map to either major or minor. A _bug fix_ to a patch. And _misc_ is either minor or patch, the difference being kind of fuzzy for the purposes of history. Adding tests would be patch level.
5
+ As such, a _Feature_ would map to either major (breaking change) or minor. A _bug fix_ to a patch. And _misc_ is either minor or patch, the difference being kind of fuzzy for the purposes of history. Adding tests would be patch level.
6
6
 
7
- ### Master [changes](https://github.com/metricfu/metric_fu/compare/v4.10.0...master)
7
+ ### Master [changes](https://github.com/metricfu/metric_fu/compare/v4.11.0...master)
8
8
 
9
9
  * Breaking Changes
10
10
  * Features
11
11
  * Fixes
12
12
  * Misc
13
13
 
14
+ ### [4.11.0](https://github.com/metricfu/metric_fu/compare/v4.10.0...v4.11.0)
15
+
16
+ * Features
17
+ * There is now a `MetricFu.logger` with standard available configurations.
18
+ The old `mf_debug` and `mf_log` main mixin is presevered. Needs documentation. See #113. (Benjamin Fleischer, a49bfdd182)
19
+ * Use *launchy* (new dependency) when opening output files. (Nick Veys, #224)
20
+ * Coverage formatter now behaves like SimpleCov; it ignores certain lines in
21
+ calculating the precent run. Fixes #153, #222 (Benjamin Fleischer, #226).
22
+ - Thanks to @crv for the test in #153
23
+ - Note: JRuby will usually report different Coverage from MRI. This is a known issue.
24
+ - Note: This technically is a *breaking change* from how RCov works. But wwe don't run RCov anymore. (65bf21723291f)
25
+ * Fixes
26
+ * Ensure paths with spaces don't cause the open command to fail (Nick Veys, #220)
27
+ * Read in source files for annotation in BINARY mode to avoid encoding errors. (Benjamin Fleischer, #216)
28
+ * Start SimpleCov before any MetricFu code is loaded. Coverage isn't tracked on already-loaded code. (Benjamin Fleischer, cca659f7d48d3f6799)
29
+ * Remove unused/invalid Flay param 'filetypes'. Closes #151. (Benjamin Fleischer, 5973595f51c)
30
+ * Misc
31
+ * Document ENV variables the may fix encoding exceptions. (Mike Szyndel, #217)
32
+ * Begin adding shared tests for metrics and configuration. Test fenced-codeblock matching. (Benjamin Fleischer, #221)
33
+ * Reorganize the application file layout. Still more to be done. (Benjamin Fleischer, #223)
34
+ * Rename AwesomeTemplate to MetricFu::Templates::MetricsTemplate. (Benjamin Fleischer, 55c52afd95d78)
35
+ * Rename ReekHotspot to MetricFu::ReekHotspot. Was missing namespace. (Benjamin Fleischer, a3aa70c1a9)
36
+ * Allow failures for Ruby 2.1, in addition to rbx per issues with rvm. (Benjamin Fleischer, 3018b22)
37
+ * `spec/quality_spec.rb` checks for whitespace, tabs, quotes, etc. `rake spec` also checks for warnings. (Benjamin Fleischer, b0c51bb9b17)
38
+ * When run with COVERAGE=true, will ouptut a file to `coverage/coverage_percent.txt` that can be checked via `rake check_code_coverage`. Borrowed from VCR. (Benjamin Fleischer, 32df3a34c6)
39
+
14
40
  ### [4.10.0 / 2014-04-01](https://github.com/metricfu/metric_fu/compare/v4.9.0...v4.10.0)
15
41
 
16
42
  * Features
data/README.md CHANGED
@@ -19,7 +19,7 @@ To be sure the gem you install hasn't been tampered with:
19
19
 
20
20
  The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.
21
21
 
22
- This is necessary because not all of MetricFus dependencies are signed, so we cannot use HighSecurity.
22
+ This is necessary because not all of MetricFu's dependencies are signed, so we cannot use HighSecurity.
23
23
 
24
24
  ## Usage
25
25
 
@@ -228,6 +228,11 @@ SimpleCov.start
228
228
  Additionally, the `coverage_file` path must be specified as above
229
229
  and must exist.
230
230
 
231
+ ## Common problems / debugging
232
+
233
+ - ['ArgumentError; message invalid byte sequence in US-ASCII'](https://github.com/metricfu/metric_fu/issues/215) may be caused by having a default external encoding that is not UTF-8. You can see this in the output of `metric_fu --debug`
234
+ - OSX: Ensure you have set `LANG=en_US.UTF-8` and `LC_ALL=en_US.UTF-8`. You can add these to your `~/.profile`.
235
+
231
236
  ## Compatibility
232
237
 
233
238
  * It is currently testing on MRI (>= 1.9.3), JRuby (19 mode), and Rubinius (19 mode). Ruby 1.8 is no longer supported.
data/Rakefile CHANGED
@@ -1,22 +1,44 @@
1
1
  #!/usr/bin/env rake
2
- require 'bundler/setup'
2
+ using_git = File.exist?(File.expand_path('../.git/', __FILE__))
3
+ if using_git
4
+ require 'bundler/setup'
5
+ require 'bundler/gem_helper'
6
+ Bundler::GemHelper.install_tasks
7
+ # require 'appraisal'
8
+ end
9
+ require 'rake'
3
10
 
4
11
  Dir['./gem_tasks/*.rake'].each do |task|
5
12
  import(task)
6
13
  end
7
14
 
8
- begin
9
- require 'spec/rake/spectask'
10
- desc "Run all specs in spec directory"
11
- Spec::Rake::SpecTask.new(:spec) do |t|
12
- t.spec_files = FileList['spec/**/*_spec.rb']
13
- end
14
- rescue LoadError
15
- require 'rspec/core/rake_task'
16
- desc "Run all specs in spec directory"
17
- RSpec::Core::RakeTask.new(:spec)
15
+ require 'rspec/core/rake_task'
16
+ desc "Run all specs in spec directory"
17
+ RSpec::Core::RakeTask.new(:spec) do |t|
18
+ t.verbose = false
19
+
20
+ t.pattern = "spec/**/_spec.rb"
21
+ # we require spec_helper so we don't get an RSpec warning about
22
+ # examples being defined before configuration.
23
+ t.ruby_opts = "-I./spec -r./spec/capture_warnings -rspec_helper"
24
+ t.rspec_opts = %w[--format progress] if (ENV['FULL_BUILD'] || !using_git)
18
25
  end
19
26
 
20
27
  require File.expand_path File.join(File.dirname(__FILE__),'lib/metric_fu')
21
28
 
29
+ # Borrowed from vcr
30
+ desc "Checks the spec coverage and fails if it is less than 100%"
31
+ task :check_code_coverage do
32
+ if RUBY_VERSION.to_f < 1.9 || RUBY_ENGINE != 'ruby'
33
+ puts "Cannot check code coverage--simplecov is not supported on this platform"
34
+ else
35
+ percent = Float(File.read("./coverage/coverage_percent.txt"))
36
+ if percent < 98.0
37
+ abort "Spec coverage was not high enough: #{percent.round(2)}%"
38
+ else
39
+ puts "Nice job! Spec coverage is still above 98%"
40
+ end
41
+ end
42
+ end
43
+
22
44
  task :default => :spec
@@ -1 +1 @@
1
- 8f0981ae30f8af7a51f73cafe23e764e26ac0a51b6fa99892d306079b52194f754b5045821684a22f34feae5772ab7818761f25fe166781c2497eca5b57770f5
1
+ e71e2ed626a7b3ee170116c5e72d846ba36039b0f016eb31ca87c9815534f27d5c85cf9bb42308bb2b3f539d123aa3ffea8fb7692c9a1c6f2b616a3511bf11f1
@@ -1,6 +1,3 @@
1
- require 'redcarpet'
2
- require 'English'
3
- require 'tmpdir'
4
1
  ROOT_PATH = File.expand_path("..", File.dirname(__FILE__))
5
2
  require File.join(ROOT_PATH, 'spec', 'support', 'usage_test')
6
3
  LIB_PATH = File.join(ROOT_PATH, 'lib')
@@ -20,11 +17,3 @@ task "usage_test" => %w[load_path] do
20
17
  usage_test = UsageTest.new
21
18
  usage_test.test_files(EXAMPLE_FILES)
22
19
  end
23
-
24
- class HTMLRenderAndVerifyCodeBlocks < Redcarpet::Render::HTML
25
-
26
- def block_code(code, language)
27
- SnippetRunner.new(code, language).test!
28
- end
29
-
30
- end
data/lib/metric_fu.rb CHANGED
@@ -8,6 +8,18 @@ module MetricFu
8
8
 
9
9
  module_function
10
10
 
11
+ def root
12
+ @app_root ||= Pathname(APP_ROOT)
13
+ end
14
+
15
+ def metric_url
16
+ 'https://github.com/metricfu/metric_fu'
17
+ end
18
+
19
+ def metric_name
20
+ 'MetricFu'
21
+ end
22
+
11
23
  def run_dir
12
24
  @run_dir ||= Dir.pwd
13
25
  end
@@ -1,4 +1,4 @@
1
- MetricFu.logging_require { 'mf_debugger' }
1
+ MetricFu.lib_require { 'logger' }
2
2
  module MetricFu
3
3
 
4
4
  # Even though the below class methods are defined on the MetricFu module
@@ -63,10 +63,6 @@ module MetricFu
63
63
  reset
64
64
  end
65
65
 
66
- def mf_debug(msg)
67
- MfDebugger.mf_debug msg
68
- end
69
-
70
66
  # TODO review if these code is functionally duplicated in the
71
67
  # base generator initialize
72
68
  attr_reader :formatters
@@ -1,16 +1,16 @@
1
1
  require 'redcard'
2
2
  require 'rbconfig'
3
- MetricFu.logging_require { 'mf_debugger' }
3
+ MetricFu.lib_require { 'logger' }
4
4
  module MetricFu
5
5
  module Environment
6
6
 
7
7
  # TODO: Set log_level here, instead
8
8
  def verbose
9
- MfDebugger::Logger.debug_on
9
+ MetricFu.logger.debug_on
10
10
  end
11
11
 
12
12
  def verbose=(toggle)
13
- MfDebugger::Logger.debug_on = toggle
13
+ MetricFu.logger.debug_on = toggle
14
14
  end
15
15
 
16
16
  # Perform a simple check to try and guess if we're running
@@ -21,7 +21,7 @@ module MetricFu
21
21
  end
22
22
 
23
23
  module Templates
24
- MetricFu.reporting_require { 'templates/awesome/awesome_template' }
24
+ MetricFu.lib_require { 'templates/metrics_template' }
25
25
 
26
26
  module_function
27
27
 
@@ -1,5 +1,6 @@
1
+ require 'launchy'
1
2
  MetricFu.formatter_require { 'yaml' }
2
- MetricFu.metrics_require { 'graph' }
3
+ MetricFu.reporting_require { 'graphs/graph' }
3
4
  module MetricFu
4
5
  module Formatter
5
6
  class HTML
@@ -44,7 +45,7 @@ module MetricFu
44
45
 
45
46
  # Instantiates a new template class based on the configuration set
46
47
  # in MetricFu::Configuration, or through the MetricFu.config block
47
- # in your rake file (defaults to the included AwesomeTemplate),
48
+ # in your rake file (defaults to the included MetricFu::Templates::MetricsTemplate),
48
49
  # assigns the result_hash to the result_hash in the template, and
49
50
  # tells the template to to write itself out.
50
51
  def save_templatized_result
@@ -71,25 +72,24 @@ module MetricFu
71
72
 
72
73
  # Checks to discover whether we should try and open the results
73
74
  # of the report in the browser on this system. We only try and open
74
- # in the browser if we're on OS X and we're not running in a
75
- # CruiseControl.rb environment. See MetricFu.configuration for more
76
- # details about how we make those guesses.
75
+ # in the browser if we're not running in a CruiseControl.rb environment.
76
+ # See MetricFu.configuration for more details about how we make those guesses.
77
77
  #
78
78
  # @return Boolean
79
79
  # Should we open in the browser or not?
80
80
  def open_in_browser?
81
- MetricFu.configuration.osx? &&
82
- ! MetricFu.configuration.is_cruise_control_rb?
81
+ ! MetricFu.configuration.is_cruise_control_rb?
83
82
  end
84
83
 
85
84
  # Shows 'index.html' from the passed directory in the browser
86
85
  # if we're able to open the browser on this platform.
87
86
  #
88
- # @param dir String
87
+ # @param dir Pathname
89
88
  # The directory path where the 'index.html' we want to open is
90
89
  # stored
91
90
  def show_in_browser(dir)
92
- system("open #{dir}/index.html") if open_in_browser?
91
+ uri = URI.join(URI.escape("file://#{dir}/"), 'index.html')
92
+ Launchy.open(uri) if open_in_browser?
93
93
  end
94
94
  end
95
95
  end