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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8725d64da7ff1760672eb24da2aee460a56581f43836268f73930f751527bc4
4
- data.tar.gz: 23b88934abf556ff7b4ceaf598ebcdd072a24d2d18052bc5c861100c2845864d
3
+ metadata.gz: 49f40e4ec5de8c38e94731f1c5a01c2f9419fe209eaa078a8b81a10afc4c2de2
4
+ data.tar.gz: cc3c83a43583cb3b2efdf96d031c0412b150637aedf2ca475717e4e7a5dab5b8
5
5
  SHA512:
6
- metadata.gz: cceff26ff5ecbfb61cd6fd1da75e3a81c7110d782589876b265390ea21080af7a83892d91b49ea74e84cc3cf99ee58d6b606b09fda8864165441c06f1f5b88ab
7
- data.tar.gz: fa3d4f2b18ca86d220b722d78301c14760e644341e8863bb9ddddbfce9c0ff759d29a9f4a63dd164cd8347bc3184e1e138b4f6ed489cd2fdeff2012f418339b5
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: nil)
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
- parts.last if parts.last =~ /^[a-z-]{2,5}$/
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})" if language
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 if 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 if language
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
@@ -1,3 +1,3 @@
1
1
  module Coconductor
2
- VERSION = '0.5.5'.freeze
2
+ VERSION = '0.5.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coconductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter