Sha256: 0178310e36f6a4279a9a40b045c9efa48196b22c7d165c759457043f814e5ada
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module MetricFu class Churn < Generator def emit @output = generate_churn_metrics end def analyze if @output.match(/Churning requires a subversion or git repo/) @churn = [:churn => {}] else @churn = YAML::load(@output) end end # ensure hash only has the :churn key def to_h {:churn => @churn[:churn]} end private def generate_churn_metrics ensure_output_is_valid_yaml(churn_code) end def ensure_output_is_valid_yaml(output) yaml_start = output.index("---") if yaml_start output[yaml_start...output.length] else nil end end def churn_code command = "churn #{build_churn_options}" mf_debug "** #{command}" `#{command}` end def build_churn_options opts = ["--yaml"] churn_options.each do |churn_option, command_flag| if has_option?(churn_option) opts << "#{command_flag}=#{options[churn_option]}" end end opts.join(" ") end def has_option?(churn_option) options.include?(churn_option) end def churn_options { :minimum_churn_count => '--minimum_churn_count' } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
metric_fu-2.1.4.pre | lib/metric_fu/metrics/churn/churn.rb |