Class: Bosh::Cli::SourceControl::GitIgnore
- Defined in:
- lib/cli/source_control/git_ignore.rb
Constant Summary collapse
- RELEASE_IGNORE_PATTERNS =
[ 'config/dev.yml', 'config/private.yml', 'releases/*.tgz', 'releases/**/*.tgz', 'dev_releases', '.blobs', 'blobs', '.dev_builds', '.idea', '.DS_Store', '.final_builds/jobs/**/*.tgz', '.final_builds/packages/**/*.tgz', '*.swp', '*~', '*#', '#*', ]
Instance Method Summary collapse
-
#initialize(dir) ⇒ GitIgnore
constructor
A new instance of GitIgnore.
- #update ⇒ Object
Constructor Details
#initialize(dir) ⇒ GitIgnore
Returns a new instance of GitIgnore.
23 24 25 |
# File 'lib/cli/source_control/git_ignore.rb', line 23 def initialize(dir) @dir = dir end |
Instance Method Details
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# 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 |