cleo_codeowners 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -5
- data/lib/cleo_codeowners/version.rb +1 -1
- data/lib/codeowners/generator.rb +14 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3da6d91b323d359c5906252cef6cf83727342be78baca1dcf576f5d43ac01be7
|
|
4
|
+
data.tar.gz: d4092679171b3762a76ac338546cf31c02a0b158fb50eecb7d1c8d818ef9b239
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c847488207f368367a95244a5cd025449961b1df3f8454658144898d552761463bf5d97c07018c1813ccb89e088a1360fa7d9c3614ac9368aa5aa3decedcf93
|
|
7
|
+
data.tar.gz: e2b9f252b9054559deb915e2f68ed6d526b4953438d5457ae6249cdd189daae688cc329ac3c37b8b52994efc81bffb06a889239f99b94e2981c0310847f556cf
|
data/README.md
CHANGED
|
@@ -60,27 +60,35 @@ Create YAML files under `.cleo/codeowners/`.
|
|
|
60
60
|
# .cleo/codeowners/features.yml
|
|
61
61
|
features:
|
|
62
62
|
session management:
|
|
63
|
+
session administration:
|
|
63
64
|
session expiry:
|
|
64
65
|
billing:
|
|
65
66
|
```
|
|
66
67
|
|
|
68
|
+
Child features inherit their parent's owners, or can override with their own.
|
|
69
|
+
An owner can be one or more teams.
|
|
70
|
+
|
|
67
71
|
```yaml
|
|
68
72
|
# .cleo/codeowners/owners.yml
|
|
69
73
|
owners:
|
|
74
|
+
session administration:
|
|
75
|
+
- operations
|
|
70
76
|
session management: identity-platform
|
|
71
|
-
billing:
|
|
77
|
+
billing:
|
|
78
|
+
- payments
|
|
79
|
+
- finance
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
Child features inherit their parent owner unless they define one.
|
|
75
|
-
|
|
76
82
|
```yaml
|
|
77
83
|
# .cleo/codeowners/files/session_management.yml
|
|
78
84
|
files:
|
|
85
|
+
session administration:
|
|
86
|
+
- /app/controllers/admin/sessions/
|
|
87
|
+
session expiry:
|
|
88
|
+
- /app/services/session_expiry/
|
|
79
89
|
session management:
|
|
80
90
|
- /app/controllers/sessions/
|
|
81
91
|
- /app/models/session.rb
|
|
82
|
-
session expiry:
|
|
83
|
-
- /app/services/session_expiry/
|
|
84
92
|
|
|
85
93
|
# .cleo/codeowners/files/billing.yml
|
|
86
94
|
files:
|
data/lib/codeowners/generator.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: false
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require 'active_support/core_ext/array/conversions'
|
|
4
5
|
require 'pathname'
|
|
5
6
|
|
|
6
7
|
module Codeowners
|
|
@@ -59,15 +60,18 @@ module Codeowners
|
|
|
59
60
|
@files ||= definitions_file.file_config
|
|
60
61
|
end
|
|
61
62
|
|
|
62
|
-
def calculate_owners_and_output_in_human_format(features:,
|
|
63
|
+
def calculate_owners_and_output_in_human_format(features:, current_owners: [], depth: 0)
|
|
63
64
|
return unless present?(features)
|
|
64
65
|
|
|
65
66
|
features.sort_by(&:first).each do |feature, children|
|
|
66
67
|
output(feature.upcase, depth:)
|
|
67
|
-
|
|
68
|
+
feature_owners = Array(
|
|
69
|
+
owners.fetch(feature, current_owners)
|
|
70
|
+
).reject { |owner| blank?(owner) }
|
|
71
|
+
|
|
68
72
|
feature_files = files[feature]
|
|
69
73
|
|
|
70
|
-
if
|
|
74
|
+
if feature_owners.empty?
|
|
71
75
|
raise "Please assign an owner for #{feature} in owners.yaml!"
|
|
72
76
|
elsif blank?(feature_files) && blank?(children)
|
|
73
77
|
raise "Please assign files or child features to #{feature}, or remove it!"
|
|
@@ -75,20 +79,22 @@ module Codeowners
|
|
|
75
79
|
all_features << feature
|
|
76
80
|
end
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
long_names = feature_owners.map { |owner| Owner.new(owner).long_name }.uniq
|
|
83
|
+
|
|
84
|
+
if feature_owners == ['unowned']
|
|
79
85
|
output('Currently unowned', depth:)
|
|
80
86
|
else
|
|
81
|
-
output("Currently owned by
|
|
87
|
+
output("Currently owned by #{long_names.to_sentence}", depth:)
|
|
82
88
|
end
|
|
83
89
|
|
|
84
90
|
if present?(feature_files)
|
|
85
91
|
feature_files.sort.uniq.each do |file|
|
|
86
|
-
record_calculated_owner(file,
|
|
87
|
-
output("#{file} #{
|
|
92
|
+
long_names.each { |long_name| record_calculated_owner(file, long_name) }
|
|
93
|
+
output("#{file} #{long_names.join(' ')}", depth:, comment: false)
|
|
88
94
|
end
|
|
89
95
|
end
|
|
90
96
|
|
|
91
|
-
calculate_owners_and_output_in_human_format(features: children,
|
|
97
|
+
calculate_owners_and_output_in_human_format(features: children, current_owners: feature_owners, depth: depth + 1)
|
|
92
98
|
end
|
|
93
99
|
end
|
|
94
100
|
|