Sha256: 70166f40a1da42b21ef85d7d1ed72bbeaee11ef7b3545757dcf2af083e31d3e3

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Bake

  class ProjectFilter

    def initialize(options)
      @@filterList = nil
      @@valid = nil
      @@options = options
    end

    def self.projects
      calcFilter_internal() if @@filterList.nil?
      return @@filterList
    end

    def self.is_valid?
      calcFilter_internal() if @@valid.nil?
      return @@valid
    end

    def self.localFile(str)
      return true if not is_valid?
      projects.any? { |fil| str.include?(fil+"/") and not str.include?(fil+"/test/") and not str.include?(fil+"/mock/") and not str.include?(fil+"/.qacdata/") }
    end

    def self.writeFilter(filter)
      filter_filename = "#{@@options.qacdata}/filter.txt"
      File.open(filter_filename, "w+") do |f|
        filter.uniq!
        filter.delete_if { |f| (f.end_with? "/gtest") or (f.end_with? "/gmock") }
        f.puts(filter)
      end
    end

    def self.calcFilter_internal
      @@filterList = []
      filter_filename = "#{@@options.qacdata}/filter.txt"
      @@valid = File.exist?(filter_filename) && @@options.qacfilter
      if @@valid
        File.open(filter_filename, "r") do |f|
          f.each_line { |line| @@filterList << line.strip }
        end
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bake-toolkit-2.37.14 lib/bakeqac/filter.rb
bake-toolkit-2.37.13 lib/bakeqac/filter.rb
bake-toolkit-2.37.12 lib/bakeqac/filter.rb
bake-toolkit-2.37.11 lib/bakeqac/filter.rb