Sha256: 1c749fa667d6c6ee0769f1f8e5ba18064c45f1d0eecebdeda4199de72a0edbab
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
# frozen_string_literal: true module GitlabCodeownersChecks class Project def initialize(root_path:, codeowners_path: nil, paths: [''], ignore_paths: [], file_ext: '') @root_path = root_path @paths = paths @ignore_paths = ignore_paths @file_ext = file_ext codeowners_path ||= 'CODEOWNERS' @codeowners = GitlabCodeownersChecker::CodeownersFile.new( Pathname.new(codeowners_path).absolute? ? codeowners_path : File.join(@root_path, codeowners_path) ) end attr_reader :root_path, :codeowners def file_paths @file_paths ||= @paths.flat_map do |ptc| abs_path = File.join(@root_path, ptc, "**/*#{@file_ext}") Dir.glob(abs_path).map { |path| path.sub(@root_path, '') }.reject do |path| @ignore_paths.any? { |pti| path.start_with?(pti) } end end.sort end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gitab_codeowners_checker-0.1.0 | lib/gitab_codeowners_checker/project.rb |