Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use bundler as gem builder

  • Loading branch information...
commit 8be762bb1672e84bd8eed5e1076b86db2522ac85 1 parent 22237cd
Iain Hecker authored
4 .gitignore
... ... @@ -1 +1,5 @@
1 1 *.gem
  2 +.bundle
  3 +Gemfile.lock
  4 +pkg/*
  5 +.rvmrc
4 Gemfile
... ... @@ -0,0 +1,4 @@
  1 +source "http://rubygems.org"
  2 +
  3 +# Specify your gem's dependencies in metrical.gemspec
  4 +gemspec
30 README.md
Source Rendered
... ... @@ -0,0 +1,30 @@
  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 `.metrics` file in the
  15 + root directory of your project. In here you can configure MetricFu as you
  16 + 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
  24 +you see there can be done in the `.metrics` 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 +Copyright 2010-2011, [Iain Hecker](http://iain.nl) - Released under the MIT License.
31 README.rdoc
Source Rendered
... ... @@ -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.
1  Rakefile
... ... @@ -0,0 +1 @@
  1 +require "bundler/gem_tasks"
44 bin/metrical
... ... @@ -1,44 +1,4 @@
1 1 #!/usr/bin/env ruby
2   -require 'rubygems'
3   -require 'json'
4   -require 'metric_fu'
5 2
6   -# Required for RCOV
7   -require 'active_support'
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)
66 lib/metrical.rb
... ... @@ -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
3  lib/metrical/version.rb
... ... @@ -0,0 +1,3 @@
  1 +module Metrical
  2 + VERSION = "0.0.6"
  3 +end
35 metrical.gemspec
... ... @@ -1,19 +1,24 @@
  1 +# -*- encoding: utf-8 -*-
  2 +$:.push File.expand_path("../lib", __FILE__)
  3 +require "metrical/version"
  4 +
1 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"
2 15
3   - s.name = "metrical"
4   - s.version = "0.0.6"
5   - s.summary = "Run metric_fu without making it a project dependency"
6   - s.email = "iain@iain.nl"
7   - s.homepage = "http://github.com/iain/metrical/"
8   - 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."
9   - s.authors = ["Iain Hecker"]
10   - s.files = [ "README.rdoc", 'bin/metrical' ]
11   - s.has_rdoc = true
12   - s.rdoc_options = ["--main", "README.rdoc"]
13   - s.extra_rdoc_files = []
14   - s.executables = ["metrical"]
  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"]
15 20
16   - s.add_dependency "metric_fu", "~> 2.1.1"
17   - s.add_dependency "activesupport"
18   - s.add_dependency "main", "~> 4.6.0"
  21 + s.add_runtime_dependency "metric_fu", "~> 2.1.1"
  22 + s.add_runtime_dependency "activesupport"
  23 + s.add_runtime_dependency "main", "~> 4.6.0"
19 24 end

0 comments on commit 8be762b

Please sign in to comment.
Something went wrong with that request. Please try again.