Class: Modulorails::BundlerauditGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/modulorails/bundleraudit/bundleraudit_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_config_filesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/modulorails/bundleraudit/bundleraudit_generator.rb', line 10

def create_config_files
  gitlab_config_path       = Rails.root.join('.gitlab-ci.yml')

  return if File.read(gitlab_config_path).match?(/\s+extends:\s+.bundleraudit\s*$/)

  append_file gitlab_config_path do
    <<~YAML

      # Scan Gemfile.lock for Common Vulnerabilities and Exposures
      # https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures
      # https://www.cve.org/
      bundleraudit:
        extends: .bundleraudit
    YAML
  end
end