random_name_generator 0.0.7 → 1.2.1

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
- SHA1:
3
- metadata.gz: c959fbffdb7ee309edcc01531d7bb7be83f4f025
4
- data.tar.gz: 0f7aa83bf9afaceb275a2f4f2e08c934057f6a49
2
+ SHA256:
3
+ metadata.gz: 74d35fcbc2b3d29c404257f11dd5514f78b9f1fd96e543ccbf2db119d3cb9b5c
4
+ data.tar.gz: 92e3a23199ec5b67165e6bc30f4cbca8e9d04ce06b2718d99d28f302fbd230a7
5
5
  SHA512:
6
- metadata.gz: f68dcd0cb6733521769618c73e3f2ce18ef454e2381c9205c40a9da7183a188af1b196df3dda0bb9bfb1da395c60d6dd5212d542dff650f9af19ff97b14d5310
7
- data.tar.gz: 5480e195c271c543c83c7adb4952a82bb1246f8f554b90e3fc8c5441fdff2f1b647629641f04ed12056e0760afe8efc0f8bb9ba802c7efe9fe8ea507b7c33dda
6
+ metadata.gz: 5b0776bb1b2bae49c6fd3d21b8d1ab5a218aa006b296962bd45b3287ac9599bd8a22820965c85e6b3e162ff3c8b1c12386e824fa47e4219064e3af7c5ed62ee4
7
+ data.tar.gz: d4e118fa0a1d60974bd34353350eee29cd930dfb81e5fbd1de81ea0f2613792a0d885cf09089aadf437f7da264f6861cb4baab1defdb06934edf8c7847505ecd
@@ -0,0 +1,18 @@
1
+ engines:
2
+ bundler-audit:
3
+ enabled: true
4
+ duplication:
5
+ enabled: true
6
+ config:
7
+ languages:
8
+ - ruby
9
+ fixme:
10
+ enabled: true
11
+ rubocop:
12
+ enabled: true
13
+ ratings:
14
+ paths:
15
+ - Gemfile.lock
16
+ - "**.rb"
17
+ exclude_paths:
18
+ - test/
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -35,4 +35,5 @@ build/
35
35
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
36
  .rvmrc
37
37
 
38
- /.idea/
38
+ /.idea/
39
+ test/random_name_generator/coverage/
@@ -1,6 +1,9 @@
1
1
  Metrics/AbcSize:
2
2
  Enabled: true
3
- Max: 16
3
+ Max: 22
4
+
5
+ Metrics/BlockLength:
6
+ Max: 30
4
7
 
5
8
  Metrics/ClassLength:
6
9
  Description: 'Avoid classes longer than 100 lines of code.'
@@ -11,6 +14,9 @@ Metrics/LineLength:
11
14
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
12
15
  Enabled: false
13
16
 
17
+ Metrics/MethodLength:
18
+ Max: 12
19
+
14
20
  Style/Documentation:
15
21
  Description: 'Document classes and non-namespace modules.'
16
22
  Enabled: false
@@ -1,5 +1,7 @@
1
+ dist: trusty
2
+ before_install:
3
+ - gem install bundler:2.1.2
1
4
  language: ruby
2
5
  rvm:
3
- - "2.1.5"
4
- - "2.2.0"
5
- - "2.3.0"
6
+ - "2.5.1"
7
+ - "2.6.3"
data/Gemfile CHANGED
@@ -2,15 +2,18 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'pry', '~> 0.10.3'
6
- # gem 'slop', '~> 4.2', '>= 4.2.1'
5
+ gem 'pry'
6
+ gem 'slop', '~> 4.2'
7
7
 
8
8
  group :development do
9
+ gem 'guard'
10
+ gem 'guard-minitest'
9
11
  gem 'minitest'
10
12
  gem 'minitest-reporters'
11
13
  gem 'mocha'
12
- gem 'guard'
13
- gem 'guard-minitest'
14
14
  gem 'reek'
15
15
  gem 'rubocop'
16
16
  end
17
+
18
+ gem 'coveralls', require: false
19
+ gem 'simplecov', require: false, group: :test
@@ -1,96 +1,116 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- random_name_generator (0.0.7)
4
+ random_name_generator (1.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ansi (1.5.0)
10
- ast (2.2.0)
11
- axiom-types (0.1.1)
12
- descendants_tracker (~> 0.0.4)
13
- ice_nine (~> 0.11.0)
14
- thread_safe (~> 0.3, >= 0.3.1)
15
- builder (3.2.2)
16
- codeclimate-engine-rb (0.3.1)
17
- virtus (~> 1.0)
18
- coderay (1.1.1)
19
- coercible (1.0.0)
20
- descendants_tracker (~> 0.0.1)
21
- descendants_tracker (0.0.4)
22
- thread_safe (~> 0.3, >= 0.3.1)
23
- equalizer (0.0.11)
24
- ffi (1.9.10)
25
- guard (1.4.0)
26
- listen (>= 0.4.2)
27
- thor (>= 0.14.6)
10
+ ast (2.4.0)
11
+ builder (3.2.4)
12
+ coderay (1.1.2)
13
+ coveralls (0.7.2)
14
+ multi_json (~> 1.3)
15
+ rest-client (= 1.6.7)
16
+ simplecov (>= 0.7)
17
+ term-ansicolor (= 1.2.2)
18
+ thor (= 0.18.1)
19
+ docile (1.3.2)
20
+ ffi (1.12.2)
21
+ formatador (0.2.5)
22
+ guard (2.16.2)
23
+ formatador (>= 0.2.4)
24
+ listen (>= 2.7, < 4.0)
25
+ lumberjack (>= 1.0.12, < 2.0)
26
+ nenv (~> 0.1)
27
+ notiffany (~> 0.0)
28
+ pry (>= 0.9.12)
29
+ shellany (~> 0.0)
30
+ thor (>= 0.18.1)
28
31
  guard-compat (1.2.1)
29
- guard-minitest (2.4.4)
32
+ guard-minitest (2.4.6)
30
33
  guard-compat (~> 1.2)
31
34
  minitest (>= 3.0)
32
- ice_nine (0.11.2)
33
- listen (3.0.6)
34
- rb-fsevent (>= 0.9.3)
35
- rb-inotify (>= 0.9.7)
36
- metaclass (0.0.4)
37
- method_source (0.8.2)
38
- minitest (5.8.4)
39
- minitest-reporters (1.1.8)
35
+ kwalify (0.7.2)
36
+ listen (3.2.1)
37
+ rb-fsevent (~> 0.10, >= 0.10.3)
38
+ rb-inotify (~> 0.9, >= 0.9.10)
39
+ lumberjack (1.2.4)
40
+ method_source (1.0.0)
41
+ mime-types (3.3.1)
42
+ mime-types-data (~> 3.2015)
43
+ mime-types-data (3.2020.0425)
44
+ minitest (5.14.0)
45
+ minitest-reporters (1.4.2)
40
46
  ansi
41
47
  builder
42
48
  minitest (>= 5.0)
43
49
  ruby-progressbar
44
- mocha (1.1.0)
45
- metaclass (~> 0.0.1)
46
- parser (2.3.0.6)
47
- ast (~> 2.2)
48
- powerpack (0.1.1)
49
- pry (0.10.3)
50
- coderay (~> 1.1.0)
51
- method_source (~> 0.8.1)
52
- slop (~> 3.4)
53
- rainbow (2.1.0)
54
- rake (10.5.0)
55
- rb-fsevent (0.9.7)
56
- rb-inotify (0.9.7)
57
- ffi (>= 0.5.0)
58
- reek (4.0.0)
59
- codeclimate-engine-rb (~> 0.3.1)
60
- parser (~> 2.3, >= 2.3.0.6)
61
- rainbow (~> 2.0)
62
- rubocop (0.38.0)
63
- parser (>= 2.3.0.6, < 3.0)
64
- powerpack (~> 0.1)
65
- rainbow (>= 1.99.1, < 3.0)
50
+ mocha (1.11.2)
51
+ multi_json (1.14.1)
52
+ nenv (0.3.0)
53
+ notiffany (0.1.3)
54
+ nenv (~> 0.1)
55
+ shellany (~> 0.0)
56
+ parallel (1.19.1)
57
+ parser (2.7.1.2)
58
+ ast (~> 2.4.0)
59
+ pry (0.13.1)
60
+ coderay (~> 1.1)
61
+ method_source (~> 1.0)
62
+ psych (3.1.0)
63
+ rainbow (3.0.0)
64
+ rake (13.0.1)
65
+ rb-fsevent (0.10.4)
66
+ rb-inotify (0.10.1)
67
+ ffi (~> 1.0)
68
+ reek (6.0.0)
69
+ kwalify (~> 0.7.0)
70
+ parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
71
+ psych (~> 3.1.0)
72
+ rainbow (>= 2.0, < 4.0)
73
+ rest-client (1.6.7)
74
+ mime-types (>= 1.16)
75
+ rexml (3.2.4)
76
+ rubocop (0.83.0)
77
+ parallel (~> 1.10)
78
+ parser (>= 2.7.0.1)
79
+ rainbow (>= 2.2.2, < 4.0)
80
+ rexml
66
81
  ruby-progressbar (~> 1.7)
67
- unicode-display_width (~> 1.0, >= 1.0.1)
68
- ruby-progressbar (1.7.5)
69
- slop (3.6.0)
70
- thor (0.19.1)
71
- thread_safe (0.3.5)
72
- unicode-display_width (1.0.2)
73
- virtus (1.0.5)
74
- axiom-types (~> 0.1)
75
- coercible (~> 1.0)
76
- descendants_tracker (~> 0.0, >= 0.0.3)
77
- equalizer (~> 0.0, >= 0.0.9)
82
+ unicode-display_width (>= 1.4.0, < 2.0)
83
+ ruby-progressbar (1.10.1)
84
+ shellany (0.0.1)
85
+ simplecov (0.18.5)
86
+ docile (~> 1.1)
87
+ simplecov-html (~> 0.11)
88
+ simplecov-html (0.12.2)
89
+ slop (4.8.1)
90
+ term-ansicolor (1.2.2)
91
+ tins (~> 0.8)
92
+ thor (0.18.1)
93
+ tins (0.13.2)
94
+ unicode-display_width (1.7.0)
78
95
 
79
96
  PLATFORMS
80
97
  ruby
81
98
 
82
99
  DEPENDENCIES
83
- bundler (~> 1.11)
100
+ bundler
101
+ coveralls
84
102
  guard
85
103
  guard-minitest
86
104
  minitest
87
105
  minitest-reporters
88
106
  mocha
89
- pry (~> 0.10.3)
90
- rake (~> 10.0)
107
+ pry
108
+ rake
91
109
  random_name_generator!
92
110
  reek
93
111
  rubocop
112
+ simplecov
113
+ slop (~> 4.2)
94
114
 
95
115
  BUNDLED WITH
96
- 1.11.2
116
+ 2.1.2
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # RandomNameGenerator
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/random_name_generator.svg)](https://badge.fury.io/rb/random_name_generator)
3
4
  [![Build Status](https://travis-ci.org/folkengine/random_name_generator.svg?branch=master)](https://travis-ci.org/folkengine/random_name_generator)
5
+ [![Code Climate](https://codeclimate.com/github/folkengine/random_name_generator/badges/gpa.svg)](https://codeclimate.com/github/folkengine/random_name_generator)
6
+ [![Dependency Status](https://gemnasium.com/folkengine/random_name_generator.svg)](https://gemnasium.com/folkengine/random_name_generator)
7
+ [![Coverage Status](https://coveralls.io/repos/github/folkengine/random_name_generator/badge.svg?branch=master)](https://coveralls.io/github/folkengine/random_name_generator?branch=master)
8
+ [![Inline docs](http://inch-ci.org/github/folkengine/random_name_generator.svg?branch=master)](http://inch-ci.org/github/folkengine/random_name_generator)
4
9
 
5
- Ruby port of [java-random-name-generator](https://github.com/folkengine/java-random-name-generator).
10
+ Ruby port of [java-random-name-generator](https://github.com/folkengine/java-random-name-generator), which in turn is a gradle enabled version of [Sinipull's GPL'd post on codecall.net](http://forum.codecall.net/topic/49665-java-random-name-generator/).
6
11
 
7
12
  The big difference between this random name generator and others is that it allows you to create names in various
8
13
  custom styles such as Elven, and Roman. If you're looking for a quick name for a Goblin NPC, RandomNameGenerator is
@@ -70,6 +75,18 @@ bin/random_name_generator [-efgr?]
70
75
 
71
76
  Add the gem's bin directory to you path in order to have instant access to RandomNameGenerator.
72
77
 
78
+ ## Porting and Refactoring Notes
79
+
80
+ The big refactoring over the original Java version is the creation of the RNGSyllable class. It takes
81
+ over most of the complexity of parsing each syllable, greatly simplifying the Random Name Generator code.
82
+
83
+ Part of the reason for working on this gem was to work on the following goals to improve my Ruby craft:
84
+
85
+ * Code confidently in the spirit of Advi Grimm's [Confident Ruby](http://www.confidentruby.com/).
86
+ * Use [Travis-CI](https://travis-ci.org/folkengine/random_name_generator) for build validation.
87
+ * Use [Rubocop](https://github.com/bbatsov/rubocop) and [Reek](https://github.com/troessner/reek) for code quality.
88
+ * Deploy it to [RubyGems.org](https://rubygems.org/gems/random_name_generator).
89
+
73
90
  ## Development
74
91
 
75
92
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -84,6 +101,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
84
101
 
85
102
  ## Alternatives
86
103
 
104
+ There are several other great name generator gems. They really aren't designed for fantasy style names.
105
+
87
106
  * [Faker](https://github.com/stympy/faker)
88
107
  * [Namey](https://github.com/muffinista/namey)
89
108
  * [How To Write A Name Generator (In Ruby)](http://www.skorks.com/2009/07/how-to-write-a-name-generator-in-ruby/)
data/Rakefile CHANGED
@@ -16,3 +16,11 @@ Rake::TestTask.new do |t|
16
16
  t.test_files = FileList['test/**/test*.rb']
17
17
  t.verbose = true
18
18
  end
19
+
20
+ task :boom do
21
+ Rake::Task['test'].execute
22
+ puts 'Running Reek...'
23
+ Rake::Task['reek'].execute
24
+ puts
25
+ Rake::Task['rubocop'].execute
26
+ end
@@ -10,15 +10,27 @@ opts = Slop.parse do |o|
10
10
  o.bool '-g', '--goblin', 'Use Goblin eyllable file'
11
11
  o.bool '-r', '--roman', 'Use Roman eyllable file'
12
12
  o.bool '-f', '--flipmode', 'Flip mode in effect'
13
+ o.bool '-c', '--cyrillic', 'Use Cyrillic mode'
13
14
  o.bool '-?', '--help', 'How to'
14
15
  end
15
16
 
16
- lang = RandomNameGenerator::ELVEN if opts.elven?
17
- lang = RandomNameGenerator::GOBLIN if opts.goblin?
18
- lang = RandomNameGenerator::ROMAN if opts.roman?
17
+ if opts.cyrillic?
18
+ lang = RandomNameGenerator::FANTASY_RU
19
+ lang = RandomNameGenerator::ELVEN_RU if opts.elven?
20
+ lang = RandomNameGenerator::GOBLIN_RU if opts.goblin?
21
+ lang = RandomNameGenerator::ROMAN_RU if opts.roman?
22
+ else
23
+ lang = RandomNameGenerator::ELVEN if opts.elven?
24
+ lang = RandomNameGenerator::GOBLIN if opts.goblin?
25
+ lang = RandomNameGenerator::ROMAN if opts.roman?
26
+ end
19
27
 
20
28
  if opts.flipmode?
21
- puts "#{RandomNameGenerator.flip_mode.compose} #{RandomNameGenerator.flip_mode.compose}"
29
+ if opts.cyrillic?
30
+ puts "#{RandomNameGenerator.flip_mode_cyrillic.compose} #{RandomNameGenerator.flip_mode_cyrillic.compose}"
31
+ else
32
+ puts "#{RandomNameGenerator.flip_mode.compose} #{RandomNameGenerator.flip_mode.compose}"
33
+ end
22
34
  elsif opts.help?
23
35
  puts opts
24
36
  else
@@ -16,6 +16,7 @@
16
16
  -am
17
17
  -an
18
18
  -anc
19
+ -and +c
19
20
  -ang
20
21
  -anti
21
22
  -ap
@@ -30,8 +31,10 @@ ama -c +c
30
31
  ay -c
31
32
  ast -c
32
33
  bat
34
+ dra +c
33
35
  dus
34
36
  ez -c +v
37
+ ha -c +c
35
38
  i -c +c
36
39
  ia -c +c
37
40
  it -c -v
@@ -43,6 +46,7 @@ or
43
46
  ra +c
44
47
  rat
45
48
  rax +v
49
+ real
46
50
  sh
47
51
  thi +c
48
52
 
@@ -53,6 +57,7 @@ thi +c
53
57
  +es -c
54
58
  +ias -c
55
59
  +iel
60
+ +ka
56
61
  +lat
57
62
  +lech
58
63
  +ma
@@ -63,6 +68,7 @@ thi +c
63
68
  +on -c
64
69
  +rept -v
65
70
  +res
71
+ +s -v
66
72
  +van
67
73
  +xas -v
68
74
  +y -c
@@ -71,9 +77,6 @@ thi +c
71
77
 
72
78
  # https://en.wikipedia.org/wiki/The_infernal_names
73
79
 
74
-
75
- Andhaka (Hindu mythology)
76
- Andras (Christian demonology)
77
80
  Andrealphus (Christian demonology)
78
81
  Andromalius (Christian demonology)
79
82
  Antichrist (Christian demonology)
@@ -0,0 +1,84 @@
1
+ -Аэль
2
+ -Аэр
3
+ -аф
4
+
5
+ -ам
6
+ -ама
7
+ -ан
8
+ -анг +v
9
+ -анср +v
10
+ -каэль
11
+ -даэ +c
12
+ -до
13
+ -ейр
14
+ -фи
15
+ -фир
16
+ -ла
17
+ -се
18
+ -сел
19
+ -ев
20
+ -фис
21
+ -ху
22
+ -ха
23
+ -гфр
24
+ -гил
25
+ -ка
26
+ -кан
27
+
28
+ -за
29
+ -зи
30
+ -мара
31
+ -маи +c
32
+ -луэ +c
33
+ -ни
34
+ -ше
35
+ -сум
36
+ -сил
37
+ аэ +c -c
38
+ аэл -c
39
+ дар
40
+ дэт +v
41
+ дре -v
42
+ дрим -v
43
+ дул
44
+ эан -c
45
+ эл
46
+ эмар
47
+ хал
48
+ иат -c
49
+ ма
50
+ тэн
51
+ куэ -v +c
52
+ риа
53
+ риал
54
+ тэр
55
+ тус
56
+ ти
57
+ сан
58
+ +аэль -c
59
+ +дар
60
+ +дэт
61
+ +дре
62
+ +дрим
63
+ +дул
64
+ +эан -c
65
+ +эл
66
+ +эиар
67
+ +нэс
68
+ +нин
69
+ +от
70
+ +хал
71
+ +иат
72
+ +ма
73
+ +тэн
74
+ +тэр
75
+ +тус
76
+ +ти
77
+ +ран
78
+ +ат
79
+ +эсс
80
+ +сан
81
+ +ит
82
+ +лас
83
+ +лиан
84
+ +эвар
@@ -0,0 +1,356 @@
1
+ -а +c
2
+ -аб
3
+ -ак
4
+ -ац
5
+ -ад
6
+ -аф
7
+ -ам
8
+ -ан
9
+ -ап
10
+ -ар
11
+ -ас
12
+ -ат
13
+ -ав
14
+ -аз
15
+ -аэль
16
+ -аэл
17
+ -ао
18
+ -аэр
19
+ -аш
20
+ -арш +v
21
+ -ат
22
+ -арг +v
23
+ -арв +v
24
+ -арт +v
25
+ -арн +v
26
+ -аг
27
+ -анг +v
28
+ -антр +v
29
+ -ба +c
30
+ -бе +c
31
+ -би
32
+ -бо +c
33
+ -бу +c
34
+ -бео +c
35
+ -бра +c
36
+ -бре +c
37
+ -бей
38
+ -бро +c
39
+ -бру
40
+ -брео +c
41
+ -брао +c
42
+ -да +c
43
+ -де +c
44
+ -ди
45
+ -до +c
46
+ -ду +c
47
+ -дае +c
48
+ -даи
49
+ -дао +c
50
+ -дра +c
51
+ -дре +c
52
+ -дри
53
+ -дро +c
54
+ -даш
55
+ -деш
56
+ -дош
57
+ -дарр +v
58
+ -дар
59
+ -дерр +v
60
+ -дер
61
+ -дорр +v
62
+ -дор
63
+ -дурр +v
64
+ -дур
65
+ -дран
66
+ -дрен
67
+ -дрон
68
+ -друн
69
+ -драв
70
+ -древ
71
+ -дров
72
+ -дов
73
+ -дув
74
+ -дарв +v
75
+ -дорв +v
76
+ -дурв +v
77
+ -эо +c
78
+ -эи +c
79
+ -ед
80
+ -га +c
81
+ -го +c
82
+ -гу +c
83
+ -гра +c
84
+ -гро +c
85
+ -гру +c
86
+ -гарл
87
+ -горл
88
+ -ха +c
89
+ -хэ +c
90
+ -хе +c
91
+ -хи +c
92
+ -хо +c
93
+ -ху +c
94
+ -хан
95
+ -хун
96
+ -хон
97
+ -идр +v
98
+ -игр +v
99
+ -ирн +v
100
+ -игн +v
101
+ -ин
102
+ -инс
103
+ -интр +v
104
+ -ка +c
105
+ -ке +c
106
+ -ки
107
+ -ко +c
108
+ -ку +c
109
+ -ков
110
+ -корв +v
111
+ -кран
112
+ -крен
113
+ -крон
114
+ -крун
115
+ -карн
116
+ -керн
117
+ -корн
118
+ -курн
119
+ -лод +v
120
+ -лодд +v
121
+ -ла +c
122
+ -лад +v
123
+ -ладд +v
124
+ -лор
125
+ -лорн +v
126
+ -ллор
127
+ -ллорн +v
128
+ -ллорв +v
129
+ -орв +v
130
+ -орн +v
131
+ -оргл +v
132
+ -ра +c
133
+ -ру +c
134
+ -ро +c
135
+ -ра +c
136
+ -ре +c
137
+ -ру +c
138
+ -раб +v
139
+ -рак
140
+ -роб +v
141
+ -рок
142
+ -руб +v
143
+ -рук
144
+ -стра +c
145
+ -стре +c
146
+ -сто +c
147
+ -сар
148
+ -сор
149
+ -сер
150
+ -ту +c
151
+ -тук
152
+ -тув +v
153
+ -ун
154
+ -унн +v
155
+ -унд
156
+ -уд
157
+ -ук
158
+ -ва
159
+ -ваа +c
160
+ -ве +c
161
+ -во +c
162
+ -ву +c
163
+ -вал
164
+ -вел
165
+ -вол
166
+ -вул
167
+ -враал
168
+ -врал
169
+ -врул
170
+ -враат +v
171
+ -вроот +v
172
+ -врод +v
173
+ -врок +v
174
+ -ворк +v
175
+ -ворт +v
176
+ -за +c
177
+ -заа +c
178
+ -звр
179
+ -зон
180
+ -золл +v
181
+ аб -c
182
+ ац -c
183
+ ад -c
184
+ аф -c
185
+ ак -c
186
+ ам -c
187
+ ан -c
188
+ ап -c
189
+ ар -c
190
+ ас -c
191
+ ат -c
192
+ ав -c
193
+ аз -c
194
+ аэл -c
195
+ аэль c
196
+ ао -c
197
+ аэр -c
198
+ ба
199
+ бе
200
+ би
201
+ бо
202
+ бу
203
+ бео
204
+ бра
205
+ бре
206
+ бей
207
+ бро
208
+ бру
209
+ брео
210
+ брао
211
+ да
212
+ де
213
+ ди
214
+ до
215
+ ду
216
+ даэ
217
+ даи
218
+ дао
219
+ дра
220
+ дре
221
+ дри
222
+ дро
223
+ даш
224
+ деш
225
+ дош
226
+ дарр
227
+ дар
228
+ дерр
229
+ дер
230
+ дорр
231
+ дор
232
+ дурр
233
+ дур
234
+ дран
235
+ дрен
236
+ дрон
237
+ друн
238
+ драв
239
+ древ
240
+ дров
241
+ дов
242
+ дув
243
+ дарв
244
+ дорв
245
+ дурв
246
+ эо -c +c
247
+ эи -c
248
+ ео -c +c
249
+ еи -c
250
+ эд -c
251
+ ед -c
252
+ га -v +c
253
+ го -v +c
254
+ гу -v +c
255
+ гра -v
256
+ гро -v
257
+ гру -v +c
258
+ гарл -v
259
+ горл -v
260
+ ха -v +c
261
+ хэ -v +c
262
+ хи -v
263
+ хо -v +c
264
+ ху -v +c
265
+ хан -v
266
+ хун -v
267
+ хон -v
268
+ идр -c +v
269
+ игр -c +v
270
+ ирн -c +v
271
+ игн -c +v
272
+ ин
273
+ инс
274
+ интр -c
275
+ ка -v +c
276
+ ке -v +c
277
+ ки -v
278
+ ко -v +c
279
+ ку -v +c
280
+ ков -v +v
281
+ корв -v +v
282
+ кран -v +v
283
+ крен -v +v
284
+ крон -v +v
285
+ крун -v +v
286
+ карн -v +v
287
+ курн -v +v
288
+ корн -v +v
289
+ курн -v +v
290
+ лод -v
291
+ лодд -v
292
+ ла -v +c
293
+ лад -v
294
+ ладд -v +v
295
+ лор -v
296
+ лорн -v +v
297
+ орв -c +v
298
+ орн -c +v
299
+ оргл -c +v
300
+ па -v +c
301
+ пу -v +c
302
+ по -v +c
303
+ ра -v +c
304
+ ре -v +c
305
+ рэ -v +c
306
+ ру -v +c
307
+ раб -v +c
308
+ рак -v +c
309
+ роб -v +c
310
+ рок -v
311
+ руб -v +c
312
+ рук -v
313
+ стра -v +c
314
+ стре -v +c
315
+ сто -v +c
316
+ сар -v
317
+ сор -v
318
+ серр -v +c
319
+ ту -v +c
320
+ тук -v
321
+ тув -v +c
322
+ ун -c
323
+ унн -c +v
324
+ унд -c +v
325
+ уд -c +v
326
+ ук -c
327
+ ва -v +c
328
+ ваа -v +c
329
+ ве -v +c
330
+ во -v +c
331
+ ву -v +c
332
+ вал -v
333
+ вел -v
334
+ вол -v
335
+ вул -v
336
+ врал -v +v
337
+ врул -v +v
338
+ +ал -c
339
+ +ол -c
340
+ +ул -c
341
+ +ат -c
342
+ +от -c
343
+ +ан -c
344
+ +ун -c
345
+ +ен -c
346
+ +эн -c
347
+ +иэл -c
348
+ +иол -c
349
+ +иул -c
350
+ +ат -c
351
+ +ут -c
352
+ +лл -v
353
+ +д -v
354
+ +ст -v
355
+ +сс -v
356
+
@@ -0,0 +1,48 @@
1
+ -ваа +c
2
+ -боо +c
3
+ -гар
4
+ -бар
5
+ -дар
6
+ -жар
7
+ -вар
8
+ -кра
9
+ -гра
10
+ -дра
11
+ -зра
12
+ -гоб
13
+ -доб
14
+ -роб
15
+ -фоб
16
+ -зоб
17
+ -раг
18
+ -наг
19
+ -даг
20
+ бра
21
+ га
22
+ да
23
+ до
24
+ го
25
+ зе
26
+ ша
27
+ наз
28
+ зуб
29
+ зу
30
+ на
31
+ гор
32
+ бу +c
33
+ +быр
34
+ +гыр
35
+ +дыр
36
+ +выр
37
+ +зыр
38
+ +ыр -c
39
+ +зог
40
+ +рог
41
+ +гог
42
+ +ог -c
43
+ +гул
44
+ +дул
45
+ +бул
46
+ +рул
47
+ +ул -c
48
+ +ргх -v
@@ -0,0 +1,35 @@
1
+
2
+ -ал
3
+ -ау +c
4
+ -ан
5
+ -ба
6
+ -бе
7
+ -би
8
+ -бр +v
9
+ -да
10
+ -ди
11
+ -до
12
+ -ду
13
+
14
+ -эу +c
15
+ -фа
16
+ би
17
+ бе
18
+ бо
19
+ бу
20
+ нул +v
21
+ гу
22
+ да
23
+ ау +c -c
24
+ фри
25
+ гус
26
+ +тус
27
+ +лус
28
+ +лиус
29
+ +нус
30
+ +эс
31
+ +иус -c
32
+ +кус
33
+ +тор
34
+ +цио
35
+ +тин
@@ -1,5 +1,19 @@
1
1
  require_relative 'rng_syllable'
2
2
 
3
+ # RandomNameGenerator:
4
+ #
5
+ # Examples
6
+ #
7
+ # rng = RandomNameGenerator.new(RandomNameGenerator::GOBLIN)
8
+ # puts rng.compose(3)
9
+ #
10
+ # By default RandomNameGenerator uses the Fantasy syllable file and creates a name with between 2 and 5 syllables.
11
+ #
12
+ # rng = RandomNameGenerator.new
13
+ # puts rng.compose
14
+ #
15
+ # :reek:TooManyInstanceVariables
16
+ # :reek:TooManyStatements
3
17
  class RandomNameGenerator
4
18
  dirname = File.dirname(__FILE__)
5
19
 
@@ -8,10 +22,17 @@ class RandomNameGenerator
8
22
  GOBLIN = File.new("#{dirname}/languages/goblin.txt")
9
23
  ROMAN = File.new("#{dirname}/languages/roman.txt")
10
24
 
25
+ ELVEN_RU = File.new("#{dirname}/languages/elven-ru.txt")
26
+ FANTASY_RU = File.new("#{dirname}/languages/fantasy-ru.txt")
27
+ GOBLIN_RU = File.new("#{dirname}/languages/goblin-ru.txt")
28
+ ROMAN_RU = File.new("#{dirname}/languages/roman-ru.txt")
29
+
11
30
  attr_reader :pre, :pre_syllables, :sur_syllables, :mid_syllables
12
31
 
13
- def initialize(filename = RandomNameGenerator::FANTASY)
32
+ def initialize(filename = RandomNameGenerator::FANTASY, random: Random.new)
33
+ @pre = nil
14
34
  @file = File.new(filename)
35
+ @rnd = random
15
36
  @pre_syllables = []
16
37
  @sur_syllables = []
17
38
  @mid_syllables = []
@@ -19,6 +40,7 @@ class RandomNameGenerator
19
40
  refresh
20
41
  end
21
42
 
43
+ # Public: Static factory method that instantiates a RandomNameGenerator in a random language.
22
44
  def self.flip_mode
23
45
  langs = [RandomNameGenerator::FANTASY,
24
46
  RandomNameGenerator::ELVEN,
@@ -27,6 +49,14 @@ class RandomNameGenerator
27
49
  new(langs.sample)
28
50
  end
29
51
 
52
+ def self.flip_mode_cyrillic
53
+ langs = [RandomNameGenerator::FANTASY_RU,
54
+ RandomNameGenerator::ELVEN_RU,
55
+ RandomNameGenerator::GOBLIN_RU,
56
+ RandomNameGenerator::ROMAN_RU]
57
+ new(langs.sample)
58
+ end
59
+
30
60
  def compose(count = RandomNameGenerator.pick_number_of_syllables)
31
61
  @pre = pre_syllables.sample
32
62
  return @pre.to_s.capitalize if count < 2
@@ -36,6 +66,16 @@ class RandomNameGenerator
36
66
  name.map(&:to_s).join.capitalize
37
67
  end
38
68
 
69
+ def self.pick_number_of_syllables
70
+ [2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5].sample
71
+ end
72
+
73
+ def to_s
74
+ "RandomNameGenerator (#{@file.path})"
75
+ end
76
+
77
+ private
78
+
39
79
  def determine_middle_syllables(count, pre)
40
80
  determine_next_syllables(count, pre, @mid_syllables)
41
81
  end
@@ -47,6 +87,7 @@ class RandomNameGenerator
47
87
  def determine_next_syllables(count, pre, syllables)
48
88
  name = Array(pre)
49
89
  return name if count < 1
90
+
50
91
  next_syllable = pre
51
92
  count.times do
52
93
  next_syllable = determine_next_syllable(next_syllable, syllables)
@@ -58,7 +99,7 @@ class RandomNameGenerator
58
99
  def determine_next_syllable(this_syllable, sampler)
59
100
  next_syllable = ''
60
101
  loop do
61
- next_syllable = sampler.sample
102
+ next_syllable = sampler.sample(random: @rnd)
62
103
  break unless this_syllable.incompatible?(next_syllable)
63
104
  end
64
105
  next_syllable
@@ -76,13 +117,4 @@ class RandomNameGenerator
76
117
  end
77
118
  end
78
119
  end
79
-
80
- def self.pick_number_of_syllables
81
- distribution = [2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5]
82
- distribution.sample
83
- end
84
-
85
- def to_s
86
- "NameGenerator (#{@file.path})"
87
- end
88
120
  end
@@ -1,3 +1,18 @@
1
+ # RNGSyllable: Class for managing properties of individual syllables with in language name file. Each line within a file
2
+ # translates into a syllable object. The reason behind this class is to take over most of the complexity of parsing each
3
+ # syllable, greatly simplifying the work done by RandomNameGenerator. This code is not meant to be called directly as a
4
+ # part of standard usage.
5
+ #
6
+ # Examples
7
+ #
8
+ # syllable = RNGSyllable.new('-foo +c')
9
+ #
10
+ # This creates a foo syllable object that needs to be the first syllable and followed by a constant.
11
+ #
12
+ # For testing purposes, passing in another RNGSyllable object will create a clone:
13
+ #
14
+ # syllable_clone = RNGSyllable.new(syllable)
15
+ #
1
16
  # SYLLABLE CLASSIFICATION:
2
17
  # Name is usually composed from 3 different class of syllables, which include prefix, middle part and suffix.
3
18
  # To declare syllable as a prefix in the file, insert "-" as a first character of the line.
@@ -18,15 +33,18 @@
18
33
  # 2) +c means that next syllable must definitely start with a consonant.
19
34
  # 3) -v means that this syllable can only be added to another syllable, that ends with a vocal.
20
35
  # 4) -c means that this syllable can only be added to another syllable, that ends with a consonant.
21
-
36
+ #
37
+ # :reek:TooManyMethods
38
+ # :reek:TooManyInstanceVariables
22
39
  class RNGSyllable
23
40
  attr_reader :raw, :syllable, :next_syllable_requirement, :previous_syllable_requirement
24
41
 
25
- VOWELS = %w(i y ɨ ʉ ɯ u ɪ ʏ ʊ ɯ ʊ e ø ɘ ɵ ɤ o ø ə ɵ ɤ o ɛ œ ɜ ɞ ʌ ɔ æ ɐ ɞ a ɶ ä ɒ ɑ).freeze
26
- CONSONANTS = %w(b ɓ ʙ β c d ɗ ɖ ð f g h j k l ł m ɱ n ɳ p q r s t v w x y z).freeze
42
+ VOWELS ||= %w[i y ɨ ʉ ɯ u ɪ ʏ ʊ ɯ ʊ e ø ɘ ɵ ɤ o ø ə ɵ ɤ o ɛ œ ɜ ɞ ʌ ɔ æ ɐ ɞ a ɶ ä ɒ ɑ].freeze
43
+ CONSONANTS ||= %w[b ɓ ʙ β c d ɗ ɖ ð f g h j k l ł m ɱ n ɳ p q r s t v w x y z].freeze
27
44
 
28
45
  def initialize(args)
29
46
  @raw = args
47
+ @syllable = ''
30
48
  @is_prefix = false
31
49
  @is_suffix = false
32
50
  @next_syllable_requirement = :letter
@@ -105,8 +123,9 @@ class RNGSyllable
105
123
 
106
124
  private
107
125
 
126
+ # :reek:FeatureEnvy
108
127
  def parse_args(args)
109
- args = raw.to_s.strip.downcase.split(' ')
128
+ args = args.to_s.strip.downcase.split(' ')
110
129
  parse_syllable(args[0])
111
130
  parse_flags(args[1..-1])
112
131
  end
@@ -1,16 +1,15 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
 
5
4
  Gem::Specification.new do |spec|
6
5
  spec.name = 'random_name_generator'
7
- spec.version = '0.0.7'
6
+ spec.version = '1.2.1'
8
7
  spec.authors = ['folkengine']
9
8
  spec.email = ['gaoler@electronicpanopticon.com']
10
9
  spec.licenses = ['GPL-3.0']
11
10
 
12
11
  spec.summary = 'Random Name Generator'
13
- spec.description = 'Generates random names based upon custom collections of syllables. Styles include Elvish, Fantasy, Goblin, and Roman'
12
+ spec.description = 'Generates random names based upon custom collections of syllables. Styles include Elvish, Fantasy, Goblin, and Roman. Has Englich(default) and Cyrillic modes.'
14
13
  spec.homepage = 'https://github.com/folkengine/random_name_generator'
15
14
 
16
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -18,7 +17,7 @@ Gem::Specification.new do |spec|
18
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
18
  spec.require_paths = ['lib']
20
19
 
21
- spec.required_ruby_version = '>= 2.1.5'
22
- spec.add_development_dependency 'bundler', '~> 1.11'
23
- spec.add_development_dependency 'rake', '~> 10.0'
20
+ spec.required_ruby_version = '>= 2.5'
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
24
23
  end
metadata CHANGED
@@ -1,51 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random_name_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - folkengine
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-21 00:00:00.000000000 Z
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  description: Generates random names based upon custom collections of syllables. Styles
42
- include Elvish, Fantasy, Goblin, and Roman
42
+ include Elvish, Fantasy, Goblin, and Roman. Has Englich(default) and Cyrillic modes.
43
43
  email:
44
44
  - gaoler@electronicpanopticon.com
45
45
  executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ".codeclimate.yml"
50
+ - ".coveralls.yml"
49
51
  - ".gitignore"
50
52
  - ".overcommit.yml"
51
53
  - ".rubocop.yml"
@@ -61,9 +63,13 @@ files:
61
63
  - config.reek
62
64
  - lib/random_name_generator.rb
63
65
  - lib/random_name_generator/languages/demonic.txt
66
+ - lib/random_name_generator/languages/elven-ru.txt
64
67
  - lib/random_name_generator/languages/elven.txt
68
+ - lib/random_name_generator/languages/fantasy-ru.txt
65
69
  - lib/random_name_generator/languages/fantasy.txt
70
+ - lib/random_name_generator/languages/goblin-ru.txt
66
71
  - lib/random_name_generator/languages/goblin.txt
72
+ - lib/random_name_generator/languages/roman-ru.txt
67
73
  - lib/random_name_generator/languages/roman.txt
68
74
  - lib/random_name_generator/random_name_generator.rb
69
75
  - lib/random_name_generator/rng_syllable.rb
@@ -80,15 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - ">="
82
88
  - !ruby/object:Gem::Version
83
- version: 2.1.5
89
+ version: '2.5'
84
90
  required_rubygems_version: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - ">="
87
93
  - !ruby/object:Gem::Version
88
94
  version: '0'
89
95
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.4.6
96
+ rubygems_version: 3.0.8
92
97
  signing_key:
93
98
  specification_version: 4
94
99
  summary: Random Name Generator