metrical 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.metrics +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +86 -0
- data/README.md +79 -0
- data/Rakefile +1 -0
- data/bin/metrical +2 -42
- data/lib/metrical.rb +66 -0
- data/lib/metrical/version.rb +3 -0
- data/metrical.gemspec +24 -0
- metadata +29 -22
- data/README.rdoc +0 -31
data/.metrics
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
metrical (0.0.7)
|
5
|
+
main (~> 4.6.0)
|
6
|
+
metric_fu (~> 2.1.1)
|
7
|
+
rake
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
Saikuro (1.1.0)
|
13
|
+
activesupport (3.1.0)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
arrayfields (4.7.4)
|
16
|
+
chronic (0.3.0)
|
17
|
+
churn (0.0.13)
|
18
|
+
chronic (>= 0.2.3)
|
19
|
+
hirb
|
20
|
+
json_pure
|
21
|
+
main
|
22
|
+
ruby_parser (~> 2.0.4)
|
23
|
+
sexp_processor (~> 3.0.3)
|
24
|
+
colored (1.2)
|
25
|
+
erubis (2.7.0)
|
26
|
+
fattr (2.2.0)
|
27
|
+
flay (1.4.3)
|
28
|
+
ruby_parser (~> 2.0)
|
29
|
+
sexp_processor (~> 3.0)
|
30
|
+
flog (2.5.2)
|
31
|
+
ruby_parser (~> 2.0)
|
32
|
+
sexp_processor (~> 3.0)
|
33
|
+
haml (3.1.3)
|
34
|
+
hirb (0.5.0)
|
35
|
+
i18n (0.6.0)
|
36
|
+
json_pure (1.5.4)
|
37
|
+
spruz (~> 0.2.8)
|
38
|
+
main (4.6.0)
|
39
|
+
arrayfields (>= 4.7.4)
|
40
|
+
fattr (>= 2.1.0)
|
41
|
+
map (>= 2.0.0)
|
42
|
+
map (4.5.0)
|
43
|
+
metric_fu (2.1.1)
|
44
|
+
Saikuro (>= 1.1.0)
|
45
|
+
activesupport (>= 2.0.0)
|
46
|
+
chronic (~> 0.3.0)
|
47
|
+
churn (>= 0.0.7)
|
48
|
+
flay (>= 1.2.1)
|
49
|
+
flog (>= 2.3.0)
|
50
|
+
rails_best_practices (>= 0.6.4)
|
51
|
+
rcov (>= 0.8.3.3)
|
52
|
+
reek (>= 1.2.6)
|
53
|
+
roodi (>= 2.1.0)
|
54
|
+
syntax
|
55
|
+
multi_json (1.0.3)
|
56
|
+
rails_best_practices (0.10.1)
|
57
|
+
activesupport
|
58
|
+
colored
|
59
|
+
erubis
|
60
|
+
haml
|
61
|
+
i18n
|
62
|
+
ruby-progressbar
|
63
|
+
ruby_parser
|
64
|
+
rake (0.9.2)
|
65
|
+
rcov (0.9.10)
|
66
|
+
reek (1.2.8)
|
67
|
+
ruby2ruby (~> 1.2)
|
68
|
+
ruby_parser (~> 2.0)
|
69
|
+
sexp_processor (~> 3.0)
|
70
|
+
roodi (2.1.0)
|
71
|
+
ruby_parser
|
72
|
+
ruby-progressbar (0.0.10)
|
73
|
+
ruby2ruby (1.3.0)
|
74
|
+
ruby_parser (~> 2.0)
|
75
|
+
sexp_processor (~> 3.0)
|
76
|
+
ruby_parser (2.0.6)
|
77
|
+
sexp_processor (~> 3.0)
|
78
|
+
sexp_processor (3.0.6)
|
79
|
+
spruz (0.2.13)
|
80
|
+
syntax (1.0.0)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
metrical!
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Metrical
|
2
|
+
|
3
|
+
MetricFu is awesome! Metrical strives to make it a little bit easier to get working.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
### Metrical doesn't intrude on your project
|
8
|
+
|
9
|
+
Metrical makes it easy to run MetricFu without making it a project dependency. Bundler requires
|
10
|
+
that everything you need go inside the Gemfile. MetricFu is rather big project with a ton of
|
11
|
+
dependencies. Including that inside your Gemfile just clutters it up.
|
12
|
+
|
13
|
+
Also, MetricFu wants to be installed inside your Rakefile. With Metrical, you can configure MetricFu
|
14
|
+
in a separate file, `.metrics` in the root of your project.
|
15
|
+
|
16
|
+
### Cleverer defaults
|
17
|
+
|
18
|
+
Normally, RCov would work on a black-listing basis. This means that your coverage reports would
|
19
|
+
occasionally be flooded with code outside your project. No longer, because the default is now to
|
20
|
+
exclude everything and only include your `lib` and `app` directories. It also fixes some issues with
|
21
|
+
loading RSpec.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Install:
|
26
|
+
|
27
|
+
gem install metrical
|
28
|
+
|
29
|
+
Run:
|
30
|
+
|
31
|
+
metrical
|
32
|
+
|
33
|
+
## Configuration
|
34
|
+
|
35
|
+
You can configure MetricFu in a `.metrics` file in the root of your project.
|
36
|
+
|
37
|
+
MetricFu::Configuration.run do |config|
|
38
|
+
config.metrics -= [ :rcov ]
|
39
|
+
end
|
40
|
+
|
41
|
+
For more information on configuring your metrics, please visit the
|
42
|
+
[MetricFu homepage](http://metric-fu.rubyforge.org/).
|
43
|
+
|
44
|
+
And that's all there is too it. If you have any suggestions, ideas or bug fixes,
|
45
|
+
please drop me a line, or make a github issue.
|
46
|
+
|
47
|
+
## Known issues
|
48
|
+
|
49
|
+
### RCov and Ruby 1.9
|
50
|
+
|
51
|
+
RCov doesn't work with Ruby 1.9. You should use something like
|
52
|
+
[SimpleCov](https://github.com/colszowka/simplecov). Unfortunately, it hasn't been included into
|
53
|
+
MetricFu yet. Until then, make sure to remove RCov from MetricFu, as the example above shows.
|
54
|
+
|
55
|
+
### New syntax in Ruby 1.9
|
56
|
+
|
57
|
+
Most metrics can't cope with the new syntax in Ruby 1.9. There is nothing I can do about that, or
|
58
|
+
the creator of these metrics, because the root lie in the code parser they use. Either don't use the
|
59
|
+
new syntax or exclude these metrics in your `.metrics` file.
|
60
|
+
|
61
|
+
### Roodi vs. Psych
|
62
|
+
|
63
|
+
If you're running Ruby 1.9 with Psych as your default YAML parser (possible in 1.9.2, and the
|
64
|
+
default in 1.9.3), you might get an error message. I have no clue what to do about it. Some help on
|
65
|
+
this would be greatly appreciated.
|
66
|
+
|
67
|
+
### Gem dependency issues
|
68
|
+
|
69
|
+
Metrical depends on a lot of other gems. Not all gem authors adhere to guidelines such as
|
70
|
+
[SemVer](http://semver.org/). This means that sometimes, when a new version of a gem is released,
|
71
|
+
things break. I try to fix the issues I come across inside Metrical, by making a dependency of a
|
72
|
+
dependency a fixed dependency of Metrical. It's difficult to do this right.
|
73
|
+
|
74
|
+
If you get a message like `can't activate X, already activated Y`, or something similar, you can
|
75
|
+
open an issue. Please include the entire error message and the output of `gem list` and the version
|
76
|
+
of Ruby you are using.
|
77
|
+
|
78
|
+
---
|
79
|
+
Copyright 2010-2011, [Iain Hecker](http://iain.nl) - Released under the MIT License.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/metrical
CHANGED
@@ -1,44 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
require 'json'
|
4
|
-
require 'metric_fu'
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
require 'active_support/core_ext'
|
9
|
-
|
10
|
-
# Load default configuration
|
11
|
-
MetricFu::Configuration.run {}
|
12
|
-
|
13
|
-
# RCov fixes (should be okay for everybody)
|
14
|
-
test_files = Dir['{spec,test}/**/*_{spec,test}.rb']
|
15
|
-
MetricFu::Configuration.run do |config|
|
16
|
-
config.rcov[:test_files] = test_files
|
17
|
-
config.rcov[:rcov_opts] = [
|
18
|
-
"--sort coverage",
|
19
|
-
"--no-html",
|
20
|
-
"--text-coverage",
|
21
|
-
"--no-color",
|
22
|
-
"--profile",
|
23
|
-
"--exclude-only '.*'",
|
24
|
-
'--include-file "\Aapp,\Alib"'
|
25
|
-
]
|
26
|
-
config.rcov[:rcov_opts] << "-Ispec" if File.exist?("spec")
|
27
|
-
end
|
28
|
-
|
29
|
-
# Load local metrics settings
|
30
|
-
file = File.join(Dir.pwd, '.metrics')
|
31
|
-
load file if File.exist?(file)
|
32
|
-
|
33
|
-
# Run metric fu!
|
34
|
-
MetricFu.metrics.each {|metric| MetricFu.report.add(metric) }
|
35
|
-
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.base_directory, "report.yml")
|
36
|
-
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.data_directory, "#{Time.now.strftime("%Y%m%d")}.yml")
|
37
|
-
MetricFu.report.save_templatized_report
|
38
|
-
|
39
|
-
MetricFu.graphs.each {|graph| MetricFu.graph.add(graph, MetricFu.graph_engine) }
|
40
|
-
MetricFu.graph.generate
|
41
|
-
|
42
|
-
if MetricFu.report.open_in_browser?
|
43
|
-
MetricFu.report.show_in_browser(MetricFu.output_directory)
|
44
|
-
end
|
3
|
+
require "metrical"
|
4
|
+
Metrical.run(*ARGV)
|
data/lib/metrical.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require "metrical/version"
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'json'
|
5
|
+
require 'metric_fu'
|
6
|
+
|
7
|
+
# Required for RCOV
|
8
|
+
require 'active_support'
|
9
|
+
require 'active_support/core_ext'
|
10
|
+
|
11
|
+
module Metrical
|
12
|
+
extend self
|
13
|
+
|
14
|
+
def run(*)
|
15
|
+
load_defaults
|
16
|
+
set_new_rcov_defaults
|
17
|
+
load_user_configuration
|
18
|
+
run_metric_fu
|
19
|
+
open_in_browser
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def load_defaults
|
25
|
+
MetricFu::Configuration.run {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_new_rcov_defaults
|
29
|
+
test_files = Dir['{spec,test}/**/*_{spec,test}.rb']
|
30
|
+
MetricFu::Configuration.run do |config|
|
31
|
+
config.rcov[:test_files] = test_files
|
32
|
+
config.rcov[:rcov_opts] = [
|
33
|
+
"--sort coverage",
|
34
|
+
"--no-html",
|
35
|
+
"--text-coverage",
|
36
|
+
"--no-color",
|
37
|
+
"--profile",
|
38
|
+
"--exclude-only '.*'",
|
39
|
+
'--include-file "\Aapp,\Alib"'
|
40
|
+
]
|
41
|
+
config.rcov[:rcov_opts] << "-Ispec" if File.exist?("spec")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def load_user_configuration
|
46
|
+
file = File.join(Dir.pwd, '.metrics')
|
47
|
+
load file if File.exist?(file)
|
48
|
+
end
|
49
|
+
|
50
|
+
def run_metric_fu
|
51
|
+
MetricFu.metrics.each {|metric| MetricFu.report.add(metric) }
|
52
|
+
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.base_directory, "report.yml")
|
53
|
+
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.data_directory, "#{Time.now.strftime("%Y%m%d")}.yml")
|
54
|
+
MetricFu.report.save_templatized_report
|
55
|
+
|
56
|
+
MetricFu.graphs.each {|graph| MetricFu.graph.add(graph, MetricFu.graph_engine) }
|
57
|
+
MetricFu.graph.generate
|
58
|
+
end
|
59
|
+
|
60
|
+
def open_in_browser
|
61
|
+
if MetricFu.report.open_in_browser?
|
62
|
+
MetricFu.report.show_in_browser(MetricFu.output_directory)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
data/metrical.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "metrical/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "metrical"
|
7
|
+
s.version = Metrical::VERSION
|
8
|
+
s.authors = ["iain"]
|
9
|
+
s.email = ["iain@iain.nl"]
|
10
|
+
s.homepage = "https://github.com/iain/metrical"
|
11
|
+
s.summary = %q{Run metric_fu without making it a project dependency}
|
12
|
+
s.description = %q{MetricFu is awesome! The only problem is that it's kinda obtrusive. Metrical provides a executable so you can run metric fu on any project without making changes to the project.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "metrical"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "metric_fu", "~> 2.1.1"
|
22
|
+
s.add_runtime_dependency "main", "~> 4.6.0"
|
23
|
+
s.add_runtime_dependency "rake"
|
24
|
+
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metrical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- iain
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: metric_fu
|
16
|
-
requirement: &
|
16
|
+
requirement: &2173451920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,46 +21,53 @@ dependencies:
|
|
21
21
|
version: 2.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2173451920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: main
|
27
|
+
requirement: &2173451400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 4.6.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2173451400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: rake
|
38
|
+
requirement: &2173450960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2173450960
|
47
47
|
description: MetricFu is awesome! The only problem is that it's kinda obtrusive. Metrical
|
48
48
|
provides a executable so you can run metric fu on any project without making changes
|
49
49
|
to the project.
|
50
|
-
email:
|
50
|
+
email:
|
51
|
+
- iain@iain.nl
|
51
52
|
executables:
|
52
53
|
- metrical
|
53
54
|
extensions: []
|
54
55
|
extra_rdoc_files: []
|
55
56
|
files:
|
56
|
-
-
|
57
|
+
- .gitignore
|
58
|
+
- .metrics
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
57
63
|
- bin/metrical
|
58
|
-
|
64
|
+
- lib/metrical.rb
|
65
|
+
- lib/metrical/version.rb
|
66
|
+
- metrical.gemspec
|
67
|
+
homepage: https://github.com/iain/metrical
|
59
68
|
licenses: []
|
60
69
|
post_install_message:
|
61
|
-
rdoc_options:
|
62
|
-
- --main
|
63
|
-
- README.rdoc
|
70
|
+
rdoc_options: []
|
64
71
|
require_paths:
|
65
72
|
- lib
|
66
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -76,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
83
|
- !ruby/object:Gem::Version
|
77
84
|
version: '0'
|
78
85
|
requirements: []
|
79
|
-
rubyforge_project:
|
86
|
+
rubyforge_project: metrical
|
80
87
|
rubygems_version: 1.8.6
|
81
88
|
signing_key:
|
82
89
|
specification_version: 3
|
data/README.rdoc
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
= Metrical
|
2
|
-
|
3
|
-
MetricFu is awesome! Metrical strives to make it a little bit easier to get working.
|
4
|
-
|
5
|
-
* Don't make MetricFu or any metrics part of the dependencies of your project;
|
6
|
-
so you don't need to add anything to your Gemfile.
|
7
|
-
|
8
|
-
* You can run MetricFu in any project:
|
9
|
-
|
10
|
-
$ gem install metrical
|
11
|
-
$ cd /path/of/your/project
|
12
|
-
$ metrical
|
13
|
-
|
14
|
-
* Per project configuration can be done in a simple <tt>.metrics</tt> file in
|
15
|
-
the root directory of your project. In here you can configure MetricFu as
|
16
|
-
you normally would. Example:
|
17
|
-
|
18
|
-
MetricFu::Configuration.run do
|
19
|
-
config.graph_engine = :gchart
|
20
|
-
end
|
21
|
-
|
22
|
-
For more information on configuring your metrics, please visit the
|
23
|
-
{MetricFu homepage}[http://metric-fu.rubyforge.org/]. Any configuration options you
|
24
|
-
see there can be done in the <tt>.metrics</tt> file.
|
25
|
-
|
26
|
-
And that's all there is too it. If you have any suggestions, ideas or bug fixes,
|
27
|
-
please drop me a line, or make a github issue.
|
28
|
-
|
29
|
-
---
|
30
|
-
|
31
|
-
Copyright 2010, Iain Hecker (iain@iain.nl) - Released under the MIT License.
|