Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use bundler as gem builder

  • Loading branch information...
commit 8be762bb1672e84bd8eed5e1076b86db2522ac85 1 parent 22237cd
@iain authored
View
4 .gitignore
@@ -1 +1,5 @@
*.gem
+.bundle
+Gemfile.lock
+pkg/*
+.rvmrc
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in metrical.gemspec
+gemspec
View
30 README.md
@@ -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.
View
31 README.rdoc
@@ -1,31 +0,0 @@
-= 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 <tt>.metrics</tt> 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 <tt>.metrics</tt> 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, Iain Hecker (iain@iain.nl) - Released under the MIT License.
View
1  Rakefile
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
View
44 bin/metrical
@@ -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)
View
66 lib/metrical.rb
@@ -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
View
3  lib/metrical/version.rb
@@ -0,0 +1,3 @@
+module Metrical
+ VERSION = "0.0.6"
+end
View
35 metrical.gemspec
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.