Sha256: 21a5d9542dbe66eac1937242696fc08012f6ce37657eb1727da0656606e6ac69

Contents?: true

Size: 664 Bytes

Versions: 6

Compression:

Stored size: 664 Bytes

Contents

module MetricFu

  class Churn < Generator

    def initialize(options={})
      super
    end

    def self.verify_dependencies!
      result = `churn --help`
      raise 'sudo gem install churn # if you want the churn tasks' unless result.match(/churn/)
    end

    
    def emit
      @output = `churn --yaml`
      yaml_start = @output.index("---")
      @output = @output[yaml_start...@output.length] if yaml_start
    end

    def analyze
      if @output.match(/fatal: Not a git repository/)
        @churn = [:churn => {}]
      else
        @churn = YAML::load(@output)
      end
    end

    def to_h
      {:churn => @churn[:churn]}
    end
  end

end

Version data entries

6 entries across 6 versions & 5 rubygems

Version Path
metric_fu-1.4.0 lib/generators/churn.rb
cdd-metric_fu-1.3.1 lib/generators/churn.rb
devver-metric_fu-1.3.3 lib/generators/churn.rb
nielsm-metric_fu-1.3.1 lib/generators/churn.rb
metric_fu-1.3.0 lib/generators/churn.rb
edouard-metric_fu-1.2.1 lib/generators/churn.rb