coconductor 0.6.2 → 0.7.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/lib/coconductor/code_of_conduct.rb +17 -6
- data/lib/coconductor/version.rb +1 -1
- 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: c5c5ff9d7faba7e4fdad45cacddaffcfee361aaa1382f2d607b846959d1547a0
|
4
|
+
data.tar.gz: a453031ce32a2926e4695b03611b4a538bc23009f06f6ca7183367abb0c3a468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c59d42852ddfb4c84fba34b895e0bcb691f14833d15447c5b189d6a9485876ce338f7359e1bce8b9047ccd33f3a1b3464413fc3f25dd77a2334ef90aaea8af83
|
7
|
+
data.tar.gz: ccc6b1b5b353e6c9601d4dcc85ead0826c83494dbc8c683e37562bf0c4603b8d1a261bc5ec0f2465b03a9b64555e748fc7b602411d920f6052e8b07f00774091
|
@@ -15,7 +15,7 @@ module Coconductor
|
|
15
15
|
# Returns the code of conduct specified by the key with version,
|
16
16
|
# or the latest in the family if only the family is specified
|
17
17
|
def find(key_or_family)
|
18
|
-
return new(
|
18
|
+
return new(key_or_family) if new(key_or_family).pseudo?
|
19
19
|
match = all.find { |coc| coc.key == key_or_family }
|
20
20
|
match || latest_in_family(key_or_family)
|
21
21
|
end
|
@@ -32,7 +32,7 @@ module Coconductor
|
|
32
32
|
key = path.relative_path_from(vendor_dir)
|
33
33
|
matches = KEY_REGEX.match(key.to_path)
|
34
34
|
matches.to_a.compact[1..-1].insert(1, 'version').join('/') if matches
|
35
|
-
end
|
35
|
+
end.compact
|
36
36
|
end
|
37
37
|
|
38
38
|
def latest_in_family(family, language: DEFAULT_LANGUAGE)
|
@@ -82,7 +82,7 @@ module Coconductor
|
|
82
82
|
def language
|
83
83
|
@language ||= begin
|
84
84
|
parts = key.split('/')
|
85
|
-
if
|
85
|
+
if pseudo?
|
86
86
|
nil
|
87
87
|
elsif parts.last =~ /^[a-z-]{2,5}$/
|
88
88
|
parts.last
|
@@ -124,7 +124,7 @@ module Coconductor
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def family
|
127
|
-
@family ||= key.split('/').first
|
127
|
+
@family ||= key.split('/').first unless none?
|
128
128
|
end
|
129
129
|
|
130
130
|
def contributor_covenant?
|
@@ -139,10 +139,21 @@ module Coconductor
|
|
139
139
|
family == 'no-code-of-conduct'
|
140
140
|
end
|
141
141
|
|
142
|
+
# The "other" code of conduct represents an unidentifiable code of conduct
|
142
143
|
def other?
|
143
144
|
key == 'other'
|
144
145
|
end
|
145
146
|
|
147
|
+
# The "none" code of conduct represents the lack of a code of conduct
|
148
|
+
def none?
|
149
|
+
key == 'none'
|
150
|
+
end
|
151
|
+
|
152
|
+
# Code of conduct is an pseudo code of conduct (e.g., none, other)
|
153
|
+
def pseudo?
|
154
|
+
other? || none?
|
155
|
+
end
|
156
|
+
|
146
157
|
def fields
|
147
158
|
@fields ||= Field.from_code_of_conduct(self)
|
148
159
|
end
|
@@ -178,7 +189,7 @@ module Coconductor
|
|
178
189
|
|
179
190
|
# Raw content of code of conduct file, including TOML front matter
|
180
191
|
def raw_content
|
181
|
-
return if
|
192
|
+
return if pseudo?
|
182
193
|
unless File.exist?(filepath)
|
183
194
|
msg = "'#{key}' is not a valid code of conduct key"
|
184
195
|
raise Coconductor::InvalidCodeOfConduct, msg
|
@@ -201,7 +212,7 @@ module Coconductor
|
|
201
212
|
end
|
202
213
|
|
203
214
|
def default_language?
|
204
|
-
|
215
|
+
pseudo? || language == DEFAULT_LANGUAGE
|
205
216
|
end
|
206
217
|
end
|
207
218
|
end
|
data/lib/coconductor/version.rb
CHANGED