Sha256: 2992fba8218059233c6771b19c8ef9fda1491c2c6abd145003e9d934d85f48f8

Contents?: true

Size: 854 Bytes

Versions: 6

Compression:

Stored size: 854 Bytes

Contents

#! /usr/bin/env ruby
require 'main'
require 'yaml'

#example usage. In the root of a project 'churn', or 'churn --help'
Main do
  option('minimum_churn_count', 'c') do
    argument :required
    cast :int
    default 3
  end

  option('yaml', 'y') do
    cast :boolean
    default false
  end

  option('ignore_files', 'i') do
    cast :string
    argument :optional
    default ''
  end

  def report_churn(output_string)
    require File.join(File.dirname(__FILE__), '..', 'lib', 'churn', 'churn_calculator')
    result = Churn::ChurnCalculator.new({:minimum_churn_count => params['minimum_churn_count'].value, :ignore_files => params['ignore_files'].value}).report(output_string)
    unless output_string
      result = YAML::dump(result)
    end
    result
  end

  def run
    report = report_churn(!params['yaml'].value)
    puts report
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
churn-0.0.26 bin/churn
churn-0.0.25 bin/churn
churn-0.0.24 bin/churn
churn-0.0.23 bin/churn
churn-0.0.22 bin/churn
churn-0.0.21 bin/churn