This repository has been archived by the owner on Jul 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in metrical.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Metrical | ||
|
||
MetricFu is awesome! Metrical strives to make it a little bit easier to get working. | ||
|
||
* Don't make MetricFu or any metrics part of the dependencies of your project; | ||
so you don't need to add anything to your Gemfile. | ||
|
||
* You can run MetricFu in any project: | ||
|
||
$ gem install metrical | ||
$ cd /path/of/your/project | ||
$ metrical | ||
|
||
* Per project configuration can be done in a simple `.metrics` file in the | ||
root directory of your project. In here you can configure MetricFu as you | ||
normally would. Example: | ||
|
||
MetricFu::Configuration.run do | ||
config.graph_engine = :gchart | ||
end | ||
|
||
For more information on configuring your metrics, please visit the | ||
[MetricFu homepage](http://metric-fu.rubyforge.org/). Any configuration options | ||
you see there can be done in the `.metrics` file. | ||
|
||
And that's all there is too it. If you have any suggestions, ideas or bug fixes, | ||
please drop me a line, or make a github issue. | ||
|
||
--- | ||
Copyright 2010-2011, [Iain Hecker](http://iain.nl) - Released under the MIT License. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
require 'rubygems' | ||
require 'json' | ||
require 'metric_fu' | ||
|
||
# Required for RCOV | ||
require 'active_support' | ||
require 'active_support/core_ext' | ||
|
||
# Load default configuration | ||
MetricFu::Configuration.run {} | ||
|
||
# RCov fixes (should be okay for everybody) | ||
test_files = Dir['{spec,test}/**/*_{spec,test}.rb'] | ||
MetricFu::Configuration.run do |config| | ||
config.rcov[:test_files] = test_files | ||
config.rcov[:rcov_opts] = [ | ||
"--sort coverage", | ||
"--no-html", | ||
"--text-coverage", | ||
"--no-color", | ||
"--profile", | ||
"--exclude-only '.*'", | ||
'--include-file "\Aapp,\Alib"' | ||
] | ||
config.rcov[:rcov_opts] << "-Ispec" if File.exist?("spec") | ||
end | ||
|
||
# Load local metrics settings | ||
file = File.join(Dir.pwd, '.metrics') | ||
load file if File.exist?(file) | ||
|
||
# Run metric fu! | ||
MetricFu.metrics.each {|metric| MetricFu.report.add(metric) } | ||
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.base_directory, "report.yml") | ||
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.data_directory, "#{Time.now.strftime("%Y%m%d")}.yml") | ||
MetricFu.report.save_templatized_report | ||
|
||
MetricFu.graphs.each {|graph| MetricFu.graph.add(graph, MetricFu.graph_engine) } | ||
MetricFu.graph.generate | ||
|
||
if MetricFu.report.open_in_browser? | ||
MetricFu.report.show_in_browser(MetricFu.output_directory) | ||
end | ||
require "metrical" | ||
Metrical.run(*ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require "metrical/version" | ||
|
||
require 'rubygems' | ||
require 'json' | ||
require 'metric_fu' | ||
|
||
# Required for RCOV | ||
require 'active_support' | ||
require 'active_support/core_ext' | ||
|
||
module Metrical | ||
extend self | ||
|
||
def run(*) | ||
load_defaults | ||
set_new_rcov_defaults | ||
load_user_configuration | ||
run_metric_fu | ||
open_in_browser | ||
end | ||
|
||
private | ||
|
||
def load_defaults | ||
MetricFu::Configuration.run {} | ||
end | ||
|
||
def set_new_rcov_defaults | ||
test_files = Dir['{spec,test}/**/*_{spec,test}.rb'] | ||
MetricFu::Configuration.run do |config| | ||
config.rcov[:test_files] = test_files | ||
config.rcov[:rcov_opts] = [ | ||
"--sort coverage", | ||
"--no-html", | ||
"--text-coverage", | ||
"--no-color", | ||
"--profile", | ||
"--exclude-only '.*'", | ||
'--include-file "\Aapp,\Alib"' | ||
] | ||
config.rcov[:rcov_opts] << "-Ispec" if File.exist?("spec") | ||
end | ||
end | ||
|
||
def load_user_configuration | ||
file = File.join(Dir.pwd, '.metrics') | ||
load file if File.exist?(file) | ||
end | ||
|
||
def run_metric_fu | ||
MetricFu.metrics.each {|metric| MetricFu.report.add(metric) } | ||
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.base_directory, "report.yml") | ||
MetricFu.report.save_output(MetricFu.report.to_yaml, MetricFu.data_directory, "#{Time.now.strftime("%Y%m%d")}.yml") | ||
MetricFu.report.save_templatized_report | ||
|
||
MetricFu.graphs.each {|graph| MetricFu.graph.add(graph, MetricFu.graph_engine) } | ||
MetricFu.graph.generate | ||
end | ||
|
||
def open_in_browser | ||
if MetricFu.report.open_in_browser? | ||
MetricFu.report.show_in_browser(MetricFu.output_directory) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Metrical | ||
VERSION = "0.0.6" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "metrical/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "metrical" | ||
s.version = Metrical::VERSION | ||
s.authors = ["iain"] | ||
s.email = ["iain@iain.nl"] | ||
s.homepage = "https://github.com/iain/metrical" | ||
s.summary = %q{Run metric_fu without making it a project dependency} | ||
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.} | ||
|
||
s.rubyforge_project = "metrical" | ||
|
||
s.name = "metrical" | ||
s.version = "0.0.6" | ||
s.summary = "Run metric_fu without making it a project dependency" | ||
s.email = "iain@iain.nl" | ||
s.homepage = "http://github.com/iain/metrical/" | ||
s.description = "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." | ||
s.authors = ["Iain Hecker"] | ||
s.files = [ "README.rdoc", 'bin/metrical' ] | ||
s.has_rdoc = true | ||
s.rdoc_options = ["--main", "README.rdoc"] | ||
s.extra_rdoc_files = [] | ||
s.executables = ["metrical"] | ||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_dependency "metric_fu", "~> 2.1.1" | ||
s.add_dependency "activesupport" | ||
s.add_dependency "main", "~> 4.6.0" | ||
s.add_runtime_dependency "metric_fu", "~> 2.1.1" | ||
s.add_runtime_dependency "activesupport" | ||
s.add_runtime_dependency "main", "~> 4.6.0" | ||
end |