Class: Achoo::VCS

Inherits:
Object
  • Object
show all
Defined in:
lib/achoo/vcs.rb,
lib/achoo/vcs/git.rb,
lib/achoo/vcs/subversion.rb

Defined Under Namespace

Classes: Git, Subversion

Constant Summary collapse

LINE_LENGTH =
80

Class Method Summary collapse

Class Method Details

.factory(dir) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/achoo/vcs.rb', line 11

def self.factory(dir)
  klass = [Git, Subversion].find do |k|
    k.repository?(dir)
  end
  return nil if klass.nil?
  klass.new(dir)
end


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/achoo/vcs.rb', line 19

def self.print_logs_for(date, vcs_dirs, io=$stdout)
  vcs_dirs.each do |dir|
    Dir.glob("#{dir}/*/").each do |dir|
      vcs = factory(dir)
      next if vcs.nil?

      log = vcs.log_for(date)
      print_log(log, dir, io)
    end
  end
end