Class: GitTree::UpdateCommand

Inherits:
AbstractCommand show all
Includes:
Logging
Defined in:
lib/commands/git_update.rb

Constant Summary

Constants included from Logging

Logging::DEBUG, Logging::NORMAL, Logging::QUIET, Logging::VERBOSE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#log, #log_stdout, verbosity, verbosity=

Methods inherited from AbstractCommand

#setup

Constructor Details

#initialize(args = ARGV, options: {}) ⇒ UpdateCommand

Returns a new instance of UpdateCommand.



15
16
17
18
19
20
21
# File 'lib/commands/git_update.rb', line 15

def initialize(args = ARGV, options: {})
  $PROGRAM_NAME = 'git-update'
  super
  # Allow walker and runner to be injected for testing
  @runner = @options.delete(:runner)
  @walker = @options.delete(:walker)
end

Instance Attribute Details

#runner=(value) ⇒ Object (writeonly)

Sets the attribute runner

Parameters:

  • value

    the value to set the attribute runner to.



11
12
13
# File 'lib/commands/git_update.rb', line 11

def runner=(value)
  @runner = value
end

#walker=(value) ⇒ Object (writeonly)

Sets the attribute walker

Parameters:

  • value

    the value to set the attribute walker to.



11
12
13
# File 'lib/commands/git_update.rb', line 11

def walker=(value)
  @walker = value
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
# File 'lib/commands/git_update.rb', line 23

def run
  setup
  @runner ||= CommandRunner.new
  @walker ||= GitTreeWalker.new(@args, options: @options)
  @walker.process do |dir, thread_id, walker|
    process_repo(walker, dir, thread_id)
  end
end