Sha256: 17d53ee29f92c29840642aa88230cb90964fb5c1c8ccbd6ef729859700ade903

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

require 'active_support/concern'

class Job
  module Tagging
    class << self
      def rules
        @@rules ||= YAML.load_file('./config/tagging.yml') rescue []
      end
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/model/job/tagging.rb