Class: CodeOwnership::Private::OwnershipMappers::DirectoryOwnership
- Inherits:
-
Object
- Object
- CodeOwnership::Private::OwnershipMappers::DirectoryOwnership
show all
- Extended by:
- T::Sig
- Includes:
- Mapper
- Defined in:
- lib/code_ownership/private/ownership_mappers/directory_ownership.rb
Constant Summary
collapse
- CODEOWNERS_DIRECTORY_FILE_NAME =
'.codeowner'
- @@directory_cache =
rubocop:disable Style/ClassVars
T.let({}, T::Hash[String, T.nilable(CodeTeams::Team)])
Instance Method Summary
collapse
Methods included from Mapper
all, included, to_glob_cache
Instance Method Details
#bust_caches! ⇒ Object
62
63
64
|
# File 'lib/code_ownership/private/ownership_mappers/directory_ownership.rb', line 62
def bust_caches!
@@directory_cache = {} end
|
#description ⇒ Object
57
58
59
|
# File 'lib/code_ownership/private/ownership_mappers/directory_ownership.rb', line 57
def description
'Owner in .codeowner'
end
|
#globs_to_owner(files) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/code_ownership/private/ownership_mappers/directory_ownership.rb', line 43
def globs_to_owner(files)
T
.unsafe(Pathname)
.glob(File.join('**/', CODEOWNERS_DIRECTORY_FILE_NAME))
.map(&:cleanpath)
.each_with_object({}) do |pathname, res|
owner = owner_for_codeowners_file(pathname)
glob = glob_for_codeowners_file(pathname)
res[glob] = owner
end
end
|
#map_file_to_owner(file) ⇒ Object
20
21
22
|
# File 'lib/code_ownership/private/ownership_mappers/directory_ownership.rb', line 20
def map_file_to_owner(file)
map_file_to_relevant_owner(file)
end
|
#update_cache(cache, files) ⇒ Object
27
28
29
|
# File 'lib/code_ownership/private/ownership_mappers/directory_ownership.rb', line 27
def update_cache(cache, files)
globs_to_owner(files)
end
|