coconductor 0.9.2 → 0.9.3
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 +4 -4
- data/lib/coconductor/field.rb +1 -1
- data/lib/coconductor/matchers/field_aware.rb +1 -1
- data/lib/coconductor/project_files/code_of_conduct_file.rb +4 -4
- data/lib/coconductor/vendorer.rb +2 -2
- data/lib/coconductor/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 128e9599d1f48bd95bc530efd9bfb7c52105dfedadf5a7e044fe51da248b1f1b
|
4
|
+
data.tar.gz: 7c99d8bf7af1e1f3cc1b56cafd7376362ee1231789c61e7824bfe180376b480b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e2dac680fd08c0a514019b88e11bd44da54bfb7fccf1e0062c50973792d6a07a810d62ae8210e28eb582ceeb4988be4b87b36a81742aa2e9513dec25f3be2fe
|
7
|
+
data.tar.gz: 86746e9255b5063ef3761d0d8c2884528171e9e15b0652c2c950d20ccb20be812a6eac4ab19d353c47d687c5170868e23d18695158e38b0a916558b8531f39e3
|
@@ -37,7 +37,7 @@ module Coconductor
|
|
37
37
|
[
|
38
38
|
matches['family'], 'version', matches['version'], matches['lang']
|
39
39
|
].compact.join('/')
|
40
|
-
end.compact
|
40
|
+
end.compact.sort
|
41
41
|
end
|
42
42
|
|
43
43
|
def latest_in_family(family, language: DEFAULT_LANGUAGE)
|
@@ -50,7 +50,7 @@ module Coconductor
|
|
50
50
|
def families
|
51
51
|
@families ||= begin
|
52
52
|
families = Dir["#{vendor_dir}/*"].map { |dir| File.basename(dir) }
|
53
|
-
families - ['bundle']
|
53
|
+
(families - ['bundle']).sort
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -70,7 +70,7 @@ module Coconductor
|
|
70
70
|
/version
|
71
71
|
/(?<version>(?<major>\d)/(?<minor>\d)(/(?<patch>\d))?|(longer|shorter))
|
72
72
|
/#{Coconductor::ProjectFiles::CodeOfConductFile::FILENAME_REGEX}
|
73
|
-
}ix
|
73
|
+
}ix.freeze
|
74
74
|
DEFAULT_LANGUAGE = 'en'.freeze
|
75
75
|
|
76
76
|
attr_reader :key
|
@@ -130,7 +130,7 @@ module Coconductor
|
|
130
130
|
alias body content
|
131
131
|
|
132
132
|
def inspect
|
133
|
-
"#<
|
133
|
+
"#<Coconductor::CodeOfConduct key=#{key}>"
|
134
134
|
end
|
135
135
|
|
136
136
|
def family
|
data/lib/coconductor/field.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Coconductor
|
2
2
|
# Represents a fillable field in a code of conduct
|
3
3
|
class Field
|
4
|
-
REGEX = /\[(?<name>[A-Z_ ]{2,})[\s:-]*(?<description>.*?)\]
|
4
|
+
REGEX = /\[(?<name>[A-Z_ ]{2,})[\s:-]*(?<description>.*?)\]/.freeze
|
5
5
|
|
6
6
|
# the matchable raw text within the code of conduct including brackets
|
7
7
|
attr_reader :raw_text
|
@@ -18,7 +18,7 @@ module Coconductor
|
|
18
18
|
private
|
19
19
|
|
20
20
|
FIELD_PLACEHOLDER = 'COCONDUCTOR_FIELD_COCONDUCTOR'.freeze
|
21
|
-
FIELD_PLACEHOLDER_REGEX = /coconductor\\ field\\ coconductor
|
21
|
+
FIELD_PLACEHOLDER_REGEX = /coconductor\\ field\\ coconductor/.freeze
|
22
22
|
|
23
23
|
def regex_for(code_of_conduct)
|
24
24
|
coc = code_of_conduct.dup
|
@@ -4,11 +4,11 @@ module Coconductor
|
|
4
4
|
include Licensee::ContentHelper
|
5
5
|
|
6
6
|
EXTENSIONS = %w[md markdown txt].freeze
|
7
|
-
EXT_REGEX = /\.#{Regexp.union(EXTENSIONS)}/i
|
8
|
-
BASENAME_REGEX = /(citizen[_-])?code[_-]of[_-]conduct/i
|
7
|
+
EXT_REGEX = /\.#{Regexp.union(EXTENSIONS)}/i.freeze
|
8
|
+
BASENAME_REGEX = /(citizen[_-])?code[_-]of[_-]conduct/i.freeze
|
9
9
|
# LANG_REGEX must contain extension to avoid matching .md as the lang
|
10
|
-
LANG_REGEX = /(\.(?<lang>[a-z]{2}(-[a-z]{2})?)#{EXT_REGEX})?/i
|
11
|
-
FILENAME_REGEX = /#{BASENAME_REGEX}#{LANG_REGEX}#{EXT_REGEX}?/i
|
10
|
+
LANG_REGEX = /(\.(?<lang>[a-z]{2}(-[a-z]{2})?)#{EXT_REGEX})?/i.freeze
|
11
|
+
FILENAME_REGEX = /#{BASENAME_REGEX}#{LANG_REGEX}#{EXT_REGEX}?/i.freeze
|
12
12
|
|
13
13
|
def self.name_score(filename)
|
14
14
|
filename =~ /\A#{FILENAME_REGEX}/ ? 1.0 : 0.0
|
data/lib/coconductor/vendorer.rb
CHANGED
@@ -14,8 +14,8 @@ module Coconductor
|
|
14
14
|
|
15
15
|
OPTIONS = %i[filename url repo replacements html source_path wiki].freeze
|
16
16
|
INVALID_CHARS = ["\u202D", "\u202C", "\u200E", "\u200F"].freeze
|
17
|
-
UPPERCASE_WORD_REGEX = /(?:[A-Z]{3,}+ ?)+[A-Z_]
|
18
|
-
UNMARKED_FIELD_REGEX = /(?<= |^)#{UPPERCASE_WORD_REGEX}(?= |\.|,)
|
17
|
+
UPPERCASE_WORD_REGEX = /(?:[A-Z]{3,}+ ?)+[A-Z_]+/.freeze
|
18
|
+
UNMARKED_FIELD_REGEX = /(?<= |^)#{UPPERCASE_WORD_REGEX}(?= |\.|,)/.freeze
|
19
19
|
|
20
20
|
def initialize(family, options = {})
|
21
21
|
@family = family
|
data/lib/coconductor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coconductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: licensee
|
@@ -297,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
297
|
- !ruby/object:Gem::Version
|
298
298
|
version: '0'
|
299
299
|
requirements: []
|
300
|
-
|
301
|
-
rubygems_version: 2.7.7
|
300
|
+
rubygems_version: 3.0.2
|
302
301
|
signing_key:
|
303
302
|
specification_version: 4
|
304
303
|
summary: work-in-progress code of conduct detector based off Licensee
|