class Bosh::Cli::SourceControl::GitIgnore

Constants

RELEASE_IGNORE_PATTERNS

Public Class Methods

new(dir) click to toggle source
# File lib/cli/source_control/git_ignore.rb, line 23
def initialize(dir)
  @dir = dir
end

Public Instance Methods

update() click to toggle source
# File lib/cli/source_control/git_ignore.rb, line 27
def update
  file_path = File.join(@dir, '.gitignore')

  found_patterns = []
  if File.exist?(file_path)
    File.open(file_path, 'r').each_line { |line| found_patterns << line.chomp }
  end

  File.open(file_path, 'a') do |f|
    RELEASE_IGNORE_PATTERNS.each do |pattern|
      f.print(pattern + "\n") unless found_patterns.include?(pattern)
    end
  end
end