Class: LessonsIndexer::Starter

Inherits:
Messenger show all
Defined in:
lib/lessons_indexer/starter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Starter

Returns a new instance of Starter.



5
6
7
# File 'lib/lessons_indexer/starter.rb', line 5

def initialize(argv)
  @options = Options.new(argv)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/lessons_indexer/starter.rb', line 3

def options
  @options
end

Instance Method Details

#start!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lessons_indexer/starter.rb', line 9

def start!
  with_messages(pou('starter.welcome', version: LessonsIndexer::VERSION), pou('starter.done'), false) do
    indexer = Indexer.new(options)

    within options.path do
      if options.all
        brancher = GitManager::Brancher.new
        brancher.get_branches.each do |branch|
          brancher.within_branch branch do
            indexer.do_work!
          end
        end
      else
        indexer.do_work!
      end
    end
  end
end