Class: Forgitter::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/forgitter/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = Forgitter::DEFAULT_OPTIONS) ⇒ Runner

Returns a new instance of Runner.



5
6
7
# File 'lib/forgitter/runner.rb', line 5

def initialize(options = Forgitter::DEFAULT_OPTIONS)
  @ignorefiles = Forgitter.filter(options)
end

Instance Method Details

#runObject



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

def run
  failcnt = 0
  output = ''
  @ignorefiles.each do |ignorefile|
    ignore_file = get_ignore_file(ignorefile[:path])
    if ignore_file
      output += "# #{ignorefile[:path]}\n"
      output += ignore_file
    else
      failcnt += 1
    end
  end
  exit(1) if failcnt == @ignorefiles.length

  puts output
end