Module: Job::Tagging

Included in:
Test
Defined in:
lib/travis/model/job/tagging.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rulesObject



6
7
8
# File 'lib/travis/model/job/tagging.rb', line 6

def rules
  @@rules ||= YAML.load_file('./config/tagging.yml') rescue []
end

Instance Method Details

#add_tagsObject



11
12
13
14
15
16
17
18
# File 'lib/travis/model/job/tagging.rb', line 11

def add_tags
  subject = log.to_s + config.to_s
  tags = Tagging.rules.inject([]) do |result, rule|
    result << rule['tag'] if subject =~ /#{rule['pattern']}/
    result
  end
  self.tags = tags.uniq.join(',')
end