class Forgitter::Runner
Public Class Methods
new(options = Forgitter::DEFAULT_OPTIONS)
click to toggle source
# File lib/forgitter/runner.rb, line 5 def initialize(options = Forgitter::DEFAULT_OPTIONS) @ignorefiles = Forgitter.filter(options) end
Public Instance Methods
run()
click to toggle source
# 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
Private Instance Methods
get_ignore_file(filename)
click to toggle source
Given a filename on the gitignore repo, return a string with the contents of the file
# File lib/forgitter/runner.rb, line 29 def get_ignore_file(filename) begin IO.read(File.join(DATA_PATH, filename)) rescue Errno::ENOENT STDERR.puts "#{filename} does not exist!" false end end