coconductor 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coconductor/code_of_conduct.rb +14 -5
- 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: 49f40e4ec5de8c38e94731f1c5a01c2f9419fe209eaa078a8b81a10afc4c2de2
|
4
|
+
data.tar.gz: cc3c83a43583cb3b2efdf96d031c0412b150637aedf2ca475717e4e7a5dab5b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ee4e36e33a52b2bdaeaeb5455fd3c90cf9ea951c8f46be51526204589615cdc39bf913faf2d0a5b6da3b6eadc5fdb4c46e6bb16ffbc134c72e6cda81a080aa
|
7
|
+
data.tar.gz: 0231a718556b2e366ad06fffd06f7b31efd21c46b2b0a1a14222d1b6b7209f7dc80fcd8947ea0095cb146c05cc6c07a7714c11c81a52498235b5b3ed5865e73f
|
@@ -34,7 +34,7 @@ module Coconductor
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def latest_in_family(family, language:
|
37
|
+
def latest_in_family(family, language: DEFAULT_LANGUAGE)
|
38
38
|
cocs = all.select do |coc|
|
39
39
|
coc.language == language && coc.family == family
|
40
40
|
end
|
@@ -64,6 +64,7 @@ module Coconductor
|
|
64
64
|
/(?<major>\d)/(?<minor>\d)(/(?<patch>\d))?
|
65
65
|
/#{Coconductor::ProjectFiles::CodeOfConductFile::FILENAME_REGEX}
|
66
66
|
}ix
|
67
|
+
DEFAULT_LANGUAGE = 'en'.freeze
|
67
68
|
|
68
69
|
attr_reader :key
|
69
70
|
attr_writer :content
|
@@ -80,14 +81,18 @@ module Coconductor
|
|
80
81
|
def language
|
81
82
|
@language ||= begin
|
82
83
|
parts = key.split('/')
|
83
|
-
|
84
|
+
if parts.last =~ /^[a-z-]{2,5}$/
|
85
|
+
parts.last
|
86
|
+
else
|
87
|
+
DEFAULT_LANGUAGE
|
88
|
+
end
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
87
92
|
def name
|
88
93
|
return @name if defined? @name
|
89
94
|
@name = name_without_version.dup
|
90
|
-
@name << " (#{language.upcase})"
|
95
|
+
@name << " (#{language.upcase})" unless default_language?
|
91
96
|
@name << " v#{version}" if version
|
92
97
|
@name
|
93
98
|
end
|
@@ -144,13 +149,13 @@ module Coconductor
|
|
144
149
|
'CODE_OF_CONDUCT'
|
145
150
|
end
|
146
151
|
|
147
|
-
filename << '.' + language
|
152
|
+
filename << '.' + language unless default_language?
|
148
153
|
filename << '.md'
|
149
154
|
end
|
150
155
|
|
151
156
|
def path
|
152
157
|
parts = key.split('/')
|
153
|
-
parts.pop
|
158
|
+
parts.pop unless default_language?
|
154
159
|
path = File.join(*parts[0...5], filename)
|
155
160
|
path = File.expand_path path, self.class.vendor_dir
|
156
161
|
Pathname.new(path)
|
@@ -178,5 +183,9 @@ module Coconductor
|
|
178
183
|
def parts
|
179
184
|
@parts ||= raw_content.split('+++')
|
180
185
|
end
|
186
|
+
|
187
|
+
def default_language?
|
188
|
+
language == DEFAULT_LANGUAGE
|
189
|
+
end
|
181
190
|
end
|
182
191
|
end
|
data/lib/coconductor/version.rb
CHANGED