lib/generators/churn.rb in edouard-metric_fu-1.0.4.5 vs lib/generators/churn.rb in edouard-metric_fu-1.1.1

- old
+ new

@@ -2,21 +2,26 @@ require 'generator' module MetricFu class Churn < Generator + def initialize(options={}) super - if File.exist?(".git") + if self.class.git? @source_control = Git.new(MetricFu.churn[:start_date]) elsif File.exist?(".svn") @source_control = Svn.new(MetricFu.churn[:start_date]) else raise "Churning requires a subversion or git repo" end @minimum_churn_count = MetricFu.churn[:minimum_churn_count] || 5 end + def self.git? + system("git branch") + end + def emit @changes = parse_log_for_changes.reject {|file, change_count| change_count < @minimum_churn_count} end def analyze