name_tamer 0.6.0 → 1.0.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 +5 -5
- data/CHANGELOG.md +41 -0
- data/LICENSE +1 -1
- data/README.md +60 -34
- data/lib/name-tamer.rb +2 -0
- data/lib/name_tamer/constants/adfixes_prefix_person +44 -0
- data/lib/name_tamer/constants/adfixes_suffix_organization +213 -0
- data/lib/name_tamer/constants/adfixes_suffix_person +131 -0
- data/lib/name_tamer/constants.rb +28 -60
- data/lib/name_tamer/name/private_methods_nice_name.rb +116 -0
- data/lib/name_tamer/name/private_methods_simple_name.rb +71 -0
- data/lib/name_tamer/name/utilities.rb +84 -0
- data/lib/name_tamer/name.rb +13 -294
- data/lib/name_tamer/strings/approximations.rb +209 -0
- data/lib/name_tamer/strings/bad_encoding.rb +148 -0
- data/lib/name_tamer/strings/capitalization.rb +46 -0
- data/lib/name_tamer/strings/compound_names.rb +34 -0
- data/lib/name_tamer/strings/core.rb +62 -0
- data/lib/name_tamer/strings/name_modifiers.rb +51 -0
- data/lib/name_tamer/strings/spacing.rb +22 -0
- data/lib/name_tamer/strings.rb +9 -0
- data/lib/name_tamer/text.rb +21 -13
- data/lib/name_tamer/version.rb +3 -1
- data/lib/name_tamer.rb +2 -3
- metadata +26 -36
- data/.codeclimate.yml +0 -18
- data/.env +0 -1
- data/.gitignore +0 -26
- data/.hound.yml +0 -6
- data/.rspec +0 -2
- data/.rubocop.yml +0 -63
- data/.travis.yml +0 -13
- data/Gemfile +0 -20
- data/Guardfile +0 -16
- data/Rakefile +0 -14
- data/doc/maintenance.rake +0 -76
- data/doc/prefixes.csv +0 -49
- data/doc/suffixes.csv +0 -345
- data/lib/name_tamer/array.rb +0 -8
- data/lib/name_tamer/string.rb +0 -280
- data/name_tamer.gemspec +0 -19
- data/spec/name_tamer/name_spec.rb +0 -95
- data/spec/name_tamer/string_spec.rb +0 -5
- data/spec/name_tamer/text_spec.rb +0 -40
- data/spec/spec_helper.rb +0 -14
- data/spec/support/names.yml +0 -741
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NameTamer
|
|
4
|
+
module Strings
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
def upcase_first_letter(string)
|
|
8
|
+
string.gsub(/\b\w/, &:upcase)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def downcase_after_apostrophe(string)
|
|
12
|
+
string.gsub(/'\w\b/, &:downcase) # Lowercase 's
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Our list of terminal characters that indicate a non-celtic name used
|
|
16
|
+
# to include o but we removed it because of MacMurdo.
|
|
17
|
+
def fix_mac(string)
|
|
18
|
+
return string unless /\bMac[A-Za-z]{2,}[^acizj]\b/.match?(string) || /\bMc/.match?(string)
|
|
19
|
+
|
|
20
|
+
fixed = string.gsub(/\b(Ma?c)([A-Za-z]+)/) { Regexp.last_match[1] + Regexp.last_match[2].capitalize }
|
|
21
|
+
|
|
22
|
+
# Fix Mac exceptions
|
|
23
|
+
MAC_EXCEPTIONS.reduce(fixed) { |name, mac_name| name.gsub(/\b#{mac_name}/, mac_name.capitalize) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Fix ff wierdybonks
|
|
27
|
+
def fix_ff(string)
|
|
28
|
+
FF_NAMES.reduce(string) { |name, ff_name| name.gsub(ff_name, ff_name.downcase) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Upcase words with no vowels, e.g JPR Williams
|
|
32
|
+
# Except Ng http://en.wikipedia.org/wiki/Ng
|
|
33
|
+
def upcase_initials(string)
|
|
34
|
+
string
|
|
35
|
+
.gsub(/\b([bcdfghjklmnpqrstvwxz]+)\b/i) { Regexp.last_match[1].upcase }
|
|
36
|
+
.gsub(/\b(NG)\b/i) { Regexp.last_match[1].capitalize }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
MAC_EXCEPTIONS = %w[
|
|
40
|
+
MacEdo MacEvicius MacHado MacHar MacHin MacHlin MacIas MacIulis MacKie
|
|
41
|
+
MacKle MacKlin MacKmin MacKmurdo MacQuarie MacLise MacKenzie
|
|
42
|
+
].freeze
|
|
43
|
+
|
|
44
|
+
FF_NAMES = %w[Fforbes Fforde Ffinch Ffrench Ffoulkes].freeze
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NameTamer
|
|
4
|
+
module Strings
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
# Fix known last names that have spaces (not hyphens!)
|
|
8
|
+
def nbsp_in_compound_name(string)
|
|
9
|
+
COMPOUND_NAMES.reduce(string) do |name, compound_name|
|
|
10
|
+
name.gsub(compound_name, compound_name.tr(ASCII_SPACE, NONBREAKING_SPACE))
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
COMPOUND_NAMES = [
|
|
15
|
+
# Known families with a space in their surname
|
|
16
|
+
'Baron Cohen',
|
|
17
|
+
'Bonham Carter',
|
|
18
|
+
'Holmes a Court',
|
|
19
|
+
'Holmes à Court',
|
|
20
|
+
'Lane Fox',
|
|
21
|
+
'Lloyd Webber',
|
|
22
|
+
'Pitt Rivers',
|
|
23
|
+
'Sebag Montefiore',
|
|
24
|
+
'Strang Steel',
|
|
25
|
+
'Wedgwood Benn',
|
|
26
|
+
'Wingfield Digby',
|
|
27
|
+
# Sometimes companies appear as people
|
|
28
|
+
'Corporation Company',
|
|
29
|
+
'Corporation System',
|
|
30
|
+
'Incorporations Limited',
|
|
31
|
+
'Service Company',
|
|
32
|
+
].freeze
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NameTamer
|
|
4
|
+
# Pure string transformations used throughout the gem. Every method
|
|
5
|
+
# takes a string and returns a new string; arguments are never mutated.
|
|
6
|
+
module Strings
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
def presence(string)
|
|
10
|
+
string unless string.empty?
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Change any whitespace into our separator character
|
|
14
|
+
def whitespace_to(string, separator)
|
|
15
|
+
string.gsub(/[[:space:]]+/, separator)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Change some characters embedded in words to our separator character
|
|
19
|
+
# e.g. example.com -> example-com
|
|
20
|
+
def invalid_chars_to(string, separator)
|
|
21
|
+
string.gsub(%r{(?<![[:space:]])[./](?![[:space:]])}, separator)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Remove HTML entities
|
|
25
|
+
def unescape_html(string)
|
|
26
|
+
CGI.unescapeHTML string
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Make sure separators are not where they shouldn't be
|
|
30
|
+
def fix_separators(string, separator)
|
|
31
|
+
return string if separator.nil? || separator.empty?
|
|
32
|
+
|
|
33
|
+
r = Regexp.escape(separator)
|
|
34
|
+
|
|
35
|
+
# No more than one separator in a row, no leading or trailing separator
|
|
36
|
+
string.gsub(/#{r}{2,}/, separator).gsub(/^#{r}|#{r}$/i, '')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def remove_periods_from_initials(string)
|
|
40
|
+
string.gsub(/\b([a-z])\./i) { Regexp.last_match[1] }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Strip unwanted characters out completely
|
|
44
|
+
def strip_unwanted(string, filter)
|
|
45
|
+
string.gsub(filter, '')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Unescape percent-encoded characters
|
|
49
|
+
# This might introduce UTF-8 invalid byte sequence
|
|
50
|
+
# so we take precautions
|
|
51
|
+
def safe_unescape(string)
|
|
52
|
+
unescaped = CGI.unescape(string.gsub('+', '%2B'))
|
|
53
|
+
return string if string == unescaped
|
|
54
|
+
|
|
55
|
+
ensure_safe(unescaped)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def ensure_safe(string)
|
|
59
|
+
string.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NameTamer
|
|
4
|
+
module Strings
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
# Fixes for name modifiers followed by space
|
|
8
|
+
# Also replaces spaces with non-breaking spaces
|
|
9
|
+
# Fixes for name modifiers followed by an apostrophe,
|
|
10
|
+
# e.g. d'Artagnan, Commedia dell'Arte
|
|
11
|
+
def fix_name_modifiers(string)
|
|
12
|
+
fixed = NAME_MODIFIERS.reduce(string) do |name, modifier|
|
|
13
|
+
name.gsub(/((?:[[:space:]]|^)#{modifier})([[:space:]]+|-)/) do
|
|
14
|
+
"#{Regexp.last_match[1].rstrip.downcase}#{Regexp.last_match[2].tr(ASCII_SPACE, NONBREAKING_SPACE)}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
fix_apostrophe_modifiers(fixed)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def fix_apostrophe_modifiers(string)
|
|
22
|
+
%w[Dell D].reduce(string) do |name, modifier|
|
|
23
|
+
name.gsub(/(.#{modifier}')(\w)/) { "#{Regexp.last_match[1].rstrip.downcase}#{Regexp.last_match[2]}" }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def nbsp_in_name_modifier(string)
|
|
28
|
+
NAME_MODIFIERS.reduce(string) do |name, modifier|
|
|
29
|
+
name.gsub(/([[:space:]]#{modifier})([[:space:]])/i) { "#{Regexp.last_match[1]}#{NONBREAKING_SPACE}" }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
NAME_MODIFIERS = [
|
|
34
|
+
'Al',
|
|
35
|
+
'Ap',
|
|
36
|
+
'Ben',
|
|
37
|
+
'D[aeiou]',
|
|
38
|
+
'D[ao]s',
|
|
39
|
+
'De[lrn]',
|
|
40
|
+
'Dell[ae]',
|
|
41
|
+
'El',
|
|
42
|
+
'L[eo]',
|
|
43
|
+
'La',
|
|
44
|
+
'Of',
|
|
45
|
+
'San',
|
|
46
|
+
'St[\.]?',
|
|
47
|
+
'V[ao]n',
|
|
48
|
+
'Zur',
|
|
49
|
+
].freeze
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module NameTamer
|
|
4
|
+
module Strings
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
# Ensure commas have exactly one space after them
|
|
8
|
+
def space_around_comma(string)
|
|
9
|
+
string.gsub(/[[:space:]]*,[[:space:]]*/, ', ')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def remove_spaces_from_initials(string)
|
|
13
|
+
string.gsub(/\b([a-z])(\.)* \b(?![a-z0-9'À-ÿ]{2,})/i) do
|
|
14
|
+
"#{Regexp.last_match[1]}#{Regexp.last_match[2]}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def ensure_space_after_initials(string)
|
|
19
|
+
string.gsub(/\b([a-z]\.)(?=[a-z0-9]{2,})/i) { "#{Regexp.last_match[1]} " }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'strings/core'
|
|
4
|
+
require_relative 'strings/approximations'
|
|
5
|
+
require_relative 'strings/bad_encoding'
|
|
6
|
+
require_relative 'strings/capitalization'
|
|
7
|
+
require_relative 'strings/compound_names'
|
|
8
|
+
require_relative 'strings/name_modifiers'
|
|
9
|
+
require_relative 'strings/spacing'
|
data/lib/name_tamer/text.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module NameTamer
|
|
2
4
|
class Text
|
|
3
5
|
# All the potential slugs from the string
|
|
@@ -8,29 +10,35 @@ module NameTamer
|
|
|
8
10
|
|
|
9
11
|
# Split the string into segments (e.g. sentences)
|
|
10
12
|
def segments
|
|
11
|
-
string.split(%r{(?:[
|
|
13
|
+
string.split(%r{(?:[.?,:;!]|[[:space:]][/-])[[:space:]]})
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
# The string as a slug
|
|
15
17
|
def parameterize
|
|
16
|
-
@parameterize ||=
|
|
17
|
-
string
|
|
18
|
-
.
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
).downcase
|
|
18
|
+
@parameterize ||= begin
|
|
19
|
+
slug = Strings.whitespace_to(string, separator)
|
|
20
|
+
slug = Strings.invalid_chars_to(slug, separator)
|
|
21
|
+
slug = Strings.strip_unwanted(slug, filter)
|
|
22
|
+
slug = Strings.fix_separators(slug, separator)
|
|
23
|
+
slug = Strings.approximate_latin_chars(slug)
|
|
24
|
+
|
|
25
|
+
(Strings.presence(slug) || '_').downcase
|
|
26
|
+
end
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def neighbours
|
|
29
|
-
@neighbours ||= NameTamer[string].array.
|
|
30
|
+
@neighbours ||= contiguous_slices(NameTamer[string].array).map { |words| words.join('-') }
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
private
|
|
33
34
|
|
|
35
|
+
# All the contiguous sub-arrays of an array,
|
|
36
|
+
# e.g. [1, 2] -> [[1], [1, 2], [2]]
|
|
37
|
+
def contiguous_slices(array)
|
|
38
|
+
last_index = array.length - 1
|
|
39
|
+
0.upto(last_index).flat_map { |i| i.upto(last_index).map { |j| array[i..j] } }
|
|
40
|
+
end
|
|
41
|
+
|
|
34
42
|
attr_reader :string, :args
|
|
35
43
|
|
|
36
44
|
def initialize(string, args = {})
|
|
@@ -39,7 +47,7 @@ module NameTamer
|
|
|
39
47
|
end
|
|
40
48
|
|
|
41
49
|
def separator
|
|
42
|
-
@
|
|
50
|
+
@separator ||= args[:sep] || SLUG_DELIMITER
|
|
43
51
|
end
|
|
44
52
|
|
|
45
53
|
def rfc3987
|
data/lib/name_tamer/version.rb
CHANGED
data/lib/name_tamer.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: name_tamer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dominic Sayers
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Useful methods for taming names
|
|
14
13
|
email:
|
|
@@ -17,40 +16,38 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
20
|
-
-
|
|
21
|
-
- ".env"
|
|
22
|
-
- ".gitignore"
|
|
23
|
-
- ".hound.yml"
|
|
24
|
-
- ".rspec"
|
|
25
|
-
- ".rubocop.yml"
|
|
26
|
-
- ".travis.yml"
|
|
27
|
-
- Gemfile
|
|
28
|
-
- Guardfile
|
|
19
|
+
- CHANGELOG.md
|
|
29
20
|
- LICENSE
|
|
30
21
|
- README.md
|
|
31
|
-
- Rakefile
|
|
32
|
-
- doc/maintenance.rake
|
|
33
|
-
- doc/prefixes.csv
|
|
34
|
-
- doc/suffixes.csv
|
|
35
22
|
- lib/name-tamer.rb
|
|
36
23
|
- lib/name_tamer.rb
|
|
37
|
-
- lib/name_tamer/array.rb
|
|
38
24
|
- lib/name_tamer/constants.rb
|
|
25
|
+
- lib/name_tamer/constants/adfixes_prefix_person
|
|
26
|
+
- lib/name_tamer/constants/adfixes_suffix_organization
|
|
27
|
+
- lib/name_tamer/constants/adfixes_suffix_person
|
|
39
28
|
- lib/name_tamer/name.rb
|
|
40
|
-
- lib/name_tamer/
|
|
29
|
+
- lib/name_tamer/name/private_methods_nice_name.rb
|
|
30
|
+
- lib/name_tamer/name/private_methods_simple_name.rb
|
|
31
|
+
- lib/name_tamer/name/utilities.rb
|
|
32
|
+
- lib/name_tamer/strings.rb
|
|
33
|
+
- lib/name_tamer/strings/approximations.rb
|
|
34
|
+
- lib/name_tamer/strings/bad_encoding.rb
|
|
35
|
+
- lib/name_tamer/strings/capitalization.rb
|
|
36
|
+
- lib/name_tamer/strings/compound_names.rb
|
|
37
|
+
- lib/name_tamer/strings/core.rb
|
|
38
|
+
- lib/name_tamer/strings/name_modifiers.rb
|
|
39
|
+
- lib/name_tamer/strings/spacing.rb
|
|
41
40
|
- lib/name_tamer/text.rb
|
|
42
41
|
- lib/name_tamer/version.rb
|
|
43
|
-
- name_tamer.gemspec
|
|
44
|
-
- spec/name_tamer/name_spec.rb
|
|
45
|
-
- spec/name_tamer/string_spec.rb
|
|
46
|
-
- spec/name_tamer/text_spec.rb
|
|
47
|
-
- spec/spec_helper.rb
|
|
48
|
-
- spec/support/names.yml
|
|
49
42
|
homepage: https://github.com/dominicsayers/name_tamer
|
|
50
43
|
licenses:
|
|
51
44
|
- MIT
|
|
52
|
-
metadata:
|
|
53
|
-
|
|
45
|
+
metadata:
|
|
46
|
+
homepage_uri: https://github.com/dominicsayers/name_tamer
|
|
47
|
+
source_code_uri: https://github.com/dominicsayers/name_tamer
|
|
48
|
+
changelog_uri: https://github.com/dominicsayers/name_tamer/blob/main/CHANGELOG.md
|
|
49
|
+
bug_tracker_uri: https://github.com/dominicsayers/name_tamer/issues
|
|
50
|
+
rubygems_mfa_required: 'true'
|
|
54
51
|
rdoc_options: []
|
|
55
52
|
require_paths:
|
|
56
53
|
- lib
|
|
@@ -58,22 +55,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
58
55
|
requirements:
|
|
59
56
|
- - ">="
|
|
60
57
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
58
|
+
version: '3.3'
|
|
62
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
60
|
requirements:
|
|
64
61
|
- - ">="
|
|
65
62
|
- !ruby/object:Gem::Version
|
|
66
63
|
version: '0'
|
|
67
64
|
requirements: []
|
|
68
|
-
|
|
69
|
-
rubygems_version: 2.6.11
|
|
70
|
-
signing_key:
|
|
65
|
+
rubygems_version: 3.6.9
|
|
71
66
|
specification_version: 4
|
|
72
67
|
summary: 'Example: NameTamer[''Mr. John Q. Smith III, MD''].simple_name # => John
|
|
73
68
|
Smith'
|
|
74
|
-
test_files:
|
|
75
|
-
- spec/name_tamer/name_spec.rb
|
|
76
|
-
- spec/name_tamer/string_spec.rb
|
|
77
|
-
- spec/name_tamer/text_spec.rb
|
|
78
|
-
- spec/spec_helper.rb
|
|
79
|
-
- spec/support/names.yml
|
|
69
|
+
test_files: []
|
data/.codeclimate.yml
DELETED
data/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
PATH=/home/build/.rvm/gems/ruby-2.1.1/bin:/home/build/.rvm/gems/ruby-2.1.1@global/bin:/home/build/.rvm/rubies/ruby-2.1.1/bin:/home/build/.rvm/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/build/.rvm/gems/ruby-2.1.1@global/bin/bundle
|
data/.gitignore
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
|
|
3
|
-
*.rbc
|
|
4
|
-
capybara-*.html
|
|
5
|
-
/log
|
|
6
|
-
/tmp
|
|
7
|
-
/db/*.sqlite3
|
|
8
|
-
/public/system
|
|
9
|
-
/coverage/
|
|
10
|
-
/spec/tmp
|
|
11
|
-
**.orig
|
|
12
|
-
rerun.txt
|
|
13
|
-
pickle-email-*.html
|
|
14
|
-
config/initializers/secret_token.rb
|
|
15
|
-
config/secrets.yml
|
|
16
|
-
|
|
17
|
-
## Environment normalisation:
|
|
18
|
-
/.bundle
|
|
19
|
-
/vendor/bundle
|
|
20
|
-
|
|
21
|
-
.ruby-version
|
|
22
|
-
.ruby-gemset
|
|
23
|
-
Gemfile.lock
|
|
24
|
-
|
|
25
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
26
|
-
.rvmrc
|
data/.hound.yml
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
AllCops:
|
|
3
|
-
TargetRubyVersion: 2.0
|
|
4
|
-
DisplayCopNames: true
|
|
5
|
-
Exclude:
|
|
6
|
-
- 'tmp/**/*'
|
|
7
|
-
- '**/*.rake'
|
|
8
|
-
|
|
9
|
-
Metrics/BlockLength:
|
|
10
|
-
CountComments: false # count full line comments?
|
|
11
|
-
Exclude:
|
|
12
|
-
- '**/*_spec.rb'
|
|
13
|
-
|
|
14
|
-
LineLength:
|
|
15
|
-
Description: 'Limit lines to 120 characters.'
|
|
16
|
-
Max: 120
|
|
17
|
-
Enabled: true
|
|
18
|
-
|
|
19
|
-
MethodLength:
|
|
20
|
-
Description: 'Avoid methods longer than 10 lines of code.'
|
|
21
|
-
Max: 23
|
|
22
|
-
Enabled: true
|
|
23
|
-
|
|
24
|
-
Documentation:
|
|
25
|
-
Description: 'Document classes and non-namespace modules.'
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
FileName:
|
|
29
|
-
Description: 'Use snake_case for source file names.'
|
|
30
|
-
Enabled: false
|
|
31
|
-
|
|
32
|
-
DotPosition:
|
|
33
|
-
Description: 'Checks the position of the dot in multi-line method calls.'
|
|
34
|
-
EnforcedStyle: leading
|
|
35
|
-
# EnforcedStyle: trailing
|
|
36
|
-
Enabled: true
|
|
37
|
-
|
|
38
|
-
StringLiterals:
|
|
39
|
-
EnforcedStyle: single_quotes
|
|
40
|
-
Enabled: true
|
|
41
|
-
|
|
42
|
-
CyclomaticComplexity:
|
|
43
|
-
Description: 'Avoid complex methods.'
|
|
44
|
-
Max: 8
|
|
45
|
-
|
|
46
|
-
ClassLength:
|
|
47
|
-
Description: 'Avoid classes longer than 100 lines of code.'
|
|
48
|
-
CountComments: false # count full line comments?
|
|
49
|
-
Max: 334
|
|
50
|
-
|
|
51
|
-
ExtraSpacing:
|
|
52
|
-
Enabled: true
|
|
53
|
-
|
|
54
|
-
Style/PercentLiteralDelimiters:
|
|
55
|
-
# Hound and CodeClimate are currently using an old version of Rubocop with
|
|
56
|
-
# different defaults, so we set them explicitly here.
|
|
57
|
-
PreferredDelimiters:
|
|
58
|
-
default: ()
|
|
59
|
-
'%i': '[]'
|
|
60
|
-
'%I': '[]'
|
|
61
|
-
'%r': '{}'
|
|
62
|
-
'%w': '[]'
|
|
63
|
-
'%W': '[]'
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
gemspec
|
|
3
|
-
ruby RUBY_VERSION
|
|
4
|
-
|
|
5
|
-
group :development do
|
|
6
|
-
gem 'bundler'
|
|
7
|
-
gem 'gem-release'
|
|
8
|
-
gem 'guard'
|
|
9
|
-
gem 'guard-rspec'
|
|
10
|
-
gem 'guard-rubocop'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
group :test do
|
|
14
|
-
gem 'codeclimate-test-reporter'
|
|
15
|
-
gem 'coveralls'
|
|
16
|
-
gem 'fuubar'
|
|
17
|
-
gem 'rspec'
|
|
18
|
-
gem 'rspec_junit_formatter'
|
|
19
|
-
gem 'simplecov', '~> 0.13'
|
|
20
|
-
end
|
data/Guardfile
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
guard :rubocop do
|
|
2
|
-
watch(/.+\.rb$/)
|
|
3
|
-
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
guard(
|
|
7
|
-
:rspec,
|
|
8
|
-
all_after_pass: true,
|
|
9
|
-
all_on_start: true,
|
|
10
|
-
cmd: 'bundle exec rspec --fail-fast --format documentation'
|
|
11
|
-
) do
|
|
12
|
-
watch(%r{^spec/.+_spec\.rb$})
|
|
13
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
14
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
|
15
|
-
watch(%r{^spec/support/.+\.rb$}) { 'spec' }
|
|
16
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
require 'bundler/gem_tasks'
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
require 'rspec/core/rake_task'
|
|
6
|
-
|
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
-
|
|
9
|
-
task default: :spec
|
|
10
|
-
rescue LoadError
|
|
11
|
-
puts 'rspec is not available'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Dir.glob('doc/*.rake').each { |r| load r }
|