Class: UpdateRepo::WalkRepo

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/update_repo.rb

Overview

An encapsulated class to walk the repo directories and update all Git repositories found therein.

Instance Method Summary collapse

Methods included from Helpers

#trunc_dir

Constructor Details

#initializevoid

Class constructor. No parameters required.



23
24
25
26
27
28
29
30
31
32
# File 'lib/update_repo.rb', line 23

def initialize
  # create a new instance of the CmdConfig class then read the config var
  @cmd = CmdConfig.new
  # set up the output and logging class
  @log = Logger.new(@cmd)
  # create instance of the Metrics class
  @metrics = Metrics.new(@log)
  # instantiate the console output class for header, footer etc
  @cons = ConsoleOutput.new(@log, @metrics, @cmd)
end

Instance Method Details

#startObject

This function will perform the required actions to traverse the Repo.

Examples:

walk_repo = UpdateRepo::WalkRepo.new
walk_repo.start


38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/update_repo.rb', line 38

def start
  String.disable_colorization = !@cmd[:color]
  # check for existence of 'Git' and exit otherwise...
  checkgit
  # print out our header unless we are dumping / importing ...
  @cons.show_header unless dumping?
  config['location'].each do |loc|
    @cmd[:dump_tree] ? dump_tree(File.join(loc)) : recurse_dir(loc)
  end
  # print out an informative footer unless dump / import ...
  @cons.show_footer unless dumping?
end