Class: Gitlab::Bullet::Exclusions

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/bullet/exclusions.rb

Instance Method Summary collapse

Constructor Details

#initialize(config_file = Gitlab.root.join('config/bullet.yml')) ⇒ Exclusions

Returns a new instance of Exclusions.


6
7
8
# File 'lib/gitlab/bullet/exclusions.rb', line 6

def initialize(config_file = Gitlab.root.join('config/bullet.yml'))
  @config_file = config_file
end

Instance Method Details

#executeObject


10
11
12
# File 'lib/gitlab/bullet/exclusions.rb', line 10

def execute
  exclusions.map { |v| v['exclude'] }
end

#validate_paths!Object


14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/bullet/exclusions.rb', line 14

def validate_paths!
  exclusions.each do |properties|
    next unless properties['path_with_method']

    file = properties['exclude'].first

    raise "Bullet: File used by #{config_file} doesn't exist, validate the #{file} exclusion!" unless File.exist?(file)
  end
end