random_name_generator 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +22 -0
- data/.gitignore +3 -2
- data/.rspec +3 -0
- data/.rubocop.yml +18 -19
- data/CHANGELOG.md +16 -0
- data/Gemfile +13 -13
- data/Gemfile.lock +78 -95
- data/LICENSE +160 -669
- data/README.md +76 -42
- data/Rakefile +11 -12
- data/bin/console +5 -6
- data/bin/run +3 -0
- data/exe/random_name_generator +43 -0
- data/lib/{random_name_generator/languages → languages}/demonic.txt +19 -11
- data/lib/languages/elven-ru.txt +84 -0
- data/lib/{random_name_generator/languages → languages}/elven.txt +0 -0
- data/lib/languages/experimental/curse.txt +63 -0
- data/lib/languages/experimental/demonic.txt +350 -0
- data/lib/languages/fantasy-ru.txt +356 -0
- data/lib/{random_name_generator/languages → languages}/fantasy.txt +0 -0
- data/lib/languages/goblin-ru.txt +48 -0
- data/lib/{random_name_generator/languages → languages}/goblin.txt +0 -0
- data/lib/languages/roman-ru.txt +35 -0
- data/lib/{random_name_generator/languages → languages}/roman.txt +0 -0
- data/lib/random_name_generator.rb +150 -2
- data/lib/random_name_generator/syllable.rb +181 -0
- data/lib/random_name_generator/version.rb +5 -0
- data/random_name_generator.gemspec +29 -18
- metadata +34 -50
- data/.travis.yml +0 -5
- data/bin/random_name_generator +0 -27
- data/lib/random_name_generator/random_name_generator.rb +0 -103
- data/lib/random_name_generator/rng_syllable.rb +0 -170
data/README.md
CHANGED
@@ -3,18 +3,23 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/random_name_generator.svg)](https://badge.fury.io/rb/random_name_generator)
|
4
4
|
[![Build Status](https://travis-ci.org/folkengine/random_name_generator.svg?branch=master)](https://travis-ci.org/folkengine/random_name_generator)
|
5
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
6
|
[![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
7
|
[![Inline docs](http://inch-ci.org/github/folkengine/random_name_generator.svg?branch=master)](http://inch-ci.org/github/folkengine/random_name_generator)
|
9
8
|
|
10
|
-
Ruby port of
|
9
|
+
Ruby port of
|
10
|
+
[java-random-name-generator](https://github.com/folkengine/java-random-name-generator),
|
11
|
+
which in turn is a gradle enabled version of
|
12
|
+
[Sinipull's GPL'd post on codecall.net](http://forum.codecall.net/topic/49665-java-random-name-generator/).
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
your gem.
|
14
|
+
**For other languages see
|
15
|
+
[RandomNameGeneratorHub](https://github.com/folkengine/RandomNameGeneratorHub)**.
|
15
16
|
|
16
|
-
|
17
|
+
The big difference between this random name generator and others is that
|
18
|
+
it allows you to create names in various custom styles such as Elven,
|
19
|
+
and Roman. If you're looking for a quick name for a Goblin NPC,
|
20
|
+
RandomNameGenerator is your gem.
|
17
21
|
|
22
|
+
------
|
18
23
|
|
19
24
|
## Installation
|
20
25
|
|
@@ -26,21 +31,24 @@ gem 'random_name_generator'
|
|
26
31
|
|
27
32
|
And then execute:
|
28
33
|
|
29
|
-
|
34
|
+
$❯ bundle install
|
30
35
|
|
31
36
|
Or install it yourself as:
|
32
37
|
|
33
|
-
|
38
|
+
$❯ gem install random_name_generator
|
34
39
|
|
35
40
|
## Usage
|
36
41
|
|
37
42
|
RandomNameGenerator comes with several styles of syllable files:
|
38
|
-
[Elven](https://github.com/folkengine/random_name_generator/blob/master/lib/
|
39
|
-
[Fantasy](https://github.com/folkengine/random_name_generator/blob/master/lib/
|
40
|
-
[Goblin](https://github.com/folkengine/random_name_generator/blob/master/lib/
|
41
|
-
and
|
42
|
-
|
43
|
-
|
43
|
+
[Elven](https://github.com/folkengine/random_name_generator/blob/master/lib/languages/elven.txt),
|
44
|
+
[Fantasy](https://github.com/folkengine/random_name_generator/blob/master/lib/languages/fantasy.txt),
|
45
|
+
[Goblin](https://github.com/folkengine/random_name_generator/blob/master/lib/languages/goblin.txt),
|
46
|
+
and
|
47
|
+
[Roman](https://github.com/folkengine/random_name_generator/blob/master/lib/languages/roman.txt).
|
48
|
+
By default it uses Fantasy. Instantiate RandomNameGenerator and then
|
49
|
+
call compose on the object to generate a random name. If you don't pass
|
50
|
+
in the number of syllables you want for your name to compose, it will
|
51
|
+
randomly pick between 3 and 6.
|
44
52
|
|
45
53
|
```ruby
|
46
54
|
require 'random_name_generator'
|
@@ -49,14 +57,19 @@ rng = RandomNameGenerator.new
|
|
49
57
|
puts rng.compose(3)
|
50
58
|
```
|
51
59
|
|
52
|
-
|
60
|
+
*Technically, `RandomNameGenerator.new` is a static factory method
|
61
|
+
creating a RandomNameGenerator::Generator object.*
|
53
62
|
|
54
|
-
|
63
|
+
Pass in a reference to specific syllable file to get different styles of
|
64
|
+
random names:
|
65
|
+
|
66
|
+
```
|
55
67
|
rng = RandomNameGenerator.new(RandomNameGenerator::GOBLIN)
|
56
68
|
puts rng.compose(3)
|
57
69
|
```
|
58
70
|
|
59
|
-
Flip mode will create a RandomNameGenerator object, randomly assigning
|
71
|
+
Flip mode will create a RandomNameGenerator object, randomly assigning
|
72
|
+
the syllable file for you.
|
60
73
|
|
61
74
|
```ruby
|
62
75
|
flip = RandomNameGenerator.flip_mode
|
@@ -64,49 +77,70 @@ puts flip.compose
|
|
64
77
|
```
|
65
78
|
|
66
79
|
You can also pass in your own syllable files. See
|
67
|
-
[
|
80
|
+
[Syllable.rb](https://github.com/folkengine/random_name_generator/blob/master/lib/random_name_generator/syllable.rb)
|
68
81
|
for the required specification.
|
69
82
|
|
70
|
-
RandomNameGenerator also comes with a command line interface which will
|
83
|
+
RandomNameGenerator also comes with a command line interface which will
|
84
|
+
generate a first and last name for you:
|
71
85
|
|
72
|
-
```
|
86
|
+
```
|
73
87
|
bin/random_name_generator [-efgr?]
|
74
88
|
```
|
75
89
|
|
76
|
-
Add the gem's bin directory to you path in order to have instant access
|
90
|
+
Add the gem's bin directory to you path in order to have instant access
|
91
|
+
to RandomNameGenerator.
|
77
92
|
|
78
93
|
## Porting and Refactoring Notes
|
79
94
|
|
80
|
-
The big refactoring over the original Java version is the creation of
|
81
|
-
over most of the complexity of parsing each
|
82
|
-
|
83
|
-
|
95
|
+
The big refactoring over the original Java version is the creation of
|
96
|
+
the Syllable class. It takes over most of the complexity of parsing each
|
97
|
+
syllable, greatly simplifying the Random Name Generator code.
|
98
|
+
|
99
|
+
Part of the reason for working on this gem was to work on the following
|
100
|
+
goals to improve my Ruby craft:
|
101
|
+
|
102
|
+
* Code confidently in the spirit of Advi Grimm's
|
103
|
+
[Confident Ruby](http://www.confidentruby.com/).
|
104
|
+
* ~~Use
|
105
|
+
[Travis-CI](https://travis-ci.org/folkengine/random_name_generator)
|
106
|
+
for build validation.~~ Moved to GitHub Actions.
|
107
|
+
* Use [Rubocop](https://github.com/bbatsov/rubocop) and
|
108
|
+
[Reek](https://github.com/troessner/reek) for code quality.
|
109
|
+
* Deploy it to
|
110
|
+
[RubyGems.org](https://rubygems.org/gems/random_name_generator).
|
84
111
|
|
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
112
|
|
90
113
|
## Development
|
91
114
|
|
92
|
-
After checking out the repo, run
|
115
|
+
After checking out the repo, run `$❯ bin/setup` to install dependencies.
|
116
|
+
Then, run `$❯ rake spec` to run the tests. You can also run `$❯
|
117
|
+
bin/console` for an interactive prompt that will allow you to
|
118
|
+
experiment.
|
93
119
|
|
94
|
-
To install this gem onto your local machine, run `bundle exec rake
|
120
|
+
To install this gem onto your local machine, run `bundle exec rake
|
121
|
+
install`. To release a new version, update the version number in
|
122
|
+
`version.rb`, and then run `bundle exec rake release`, which will create
|
123
|
+
a git tag for the version, push git commits and the created tag, and
|
124
|
+
push the `.gem` file to [rubygems.org](https://rubygems.org).
|
95
125
|
|
96
|
-
|
126
|
+
To run [Reek](https://github.com/troessner/reek) on the codebase, simply
|
127
|
+
call `$❯ rake reek`
|
97
128
|
|
98
|
-
|
99
|
-
* [Reek](https://github.com/troessner/reek)
|
100
|
-
* [Rubocop](https://github.com/bbatsov/rubocop)
|
129
|
+
## Contributing
|
101
130
|
|
102
|
-
|
131
|
+
Bug reports and pull requests are welcome on GitHub at
|
132
|
+
https://github.com/folkengine/random_name_generator. This project is
|
133
|
+
intended to be a safe, welcoming space for collaboration, and
|
134
|
+
contributors are expected to adhere to the
|
135
|
+
[code of conduct](https://github.com/folkengine/random_name_generator/blob/main/CODE_OF_CONDUCT.md).
|
103
136
|
|
104
|
-
|
137
|
+
## License
|
105
138
|
|
106
|
-
|
107
|
-
|
108
|
-
* [How To Write A Name Generator (In Ruby)](http://www.skorks.com/2009/07/how-to-write-a-name-generator-in-ruby/)
|
139
|
+
The gem is available as open source under the terms of the
|
140
|
+
[GNU Lesser General Public License version 3](https://opensource.org/licenses/LGPL-3.0).
|
109
141
|
|
110
|
-
##
|
142
|
+
## Code of Conduct
|
111
143
|
|
112
|
-
|
144
|
+
Everyone interacting in the RandomNameGenerator project's codebases,
|
145
|
+
issue trackers, chat rooms and mailing lists is expected to follow the
|
146
|
+
[code of conduct](https://github.com/[USERNAME]/random_name_generator/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
-
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'reek/rake/task'
|
4
|
-
require 'rubocop/rake_task'
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "reek/rake/task"
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
require "rubocop/rake_task"
|
11
10
|
|
12
11
|
RuboCop::RakeTask.new
|
13
12
|
|
14
|
-
Rake::
|
15
|
-
t.
|
16
|
-
t.test_files = FileList['test/**/test*.rb']
|
17
|
-
t.verbose = true
|
13
|
+
Reek::Rake::Task.new do |t|
|
14
|
+
t.fail_on_error = true
|
18
15
|
end
|
16
|
+
|
17
|
+
task default: %i[spec rubocop]
|
data/bin/console
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require "bundler/setup"
|
6
|
+
require "random_name_generator"
|
5
7
|
|
6
8
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
9
|
# with your gem easier. You can also use a different console, if you like.
|
8
10
|
|
9
11
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
require
|
12
|
+
require "pry"
|
11
13
|
|
12
14
|
# Override default value.inspect
|
13
15
|
Pry.config.print = proc { |output, value| output.puts "=> #{value}" }
|
14
16
|
Pry.start
|
15
|
-
|
16
|
-
# require 'irb'
|
17
|
-
# IRB.start
|
data/bin/run
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require "random_name_generator"
|
6
|
+
require "slop"
|
7
|
+
|
8
|
+
lang = RandomNameGenerator::FANTASY
|
9
|
+
|
10
|
+
opts = Slop.parse do |o|
|
11
|
+
o.bool "-e", "--elven", "Use Elven eyllable file"
|
12
|
+
o.bool "-g", "--goblin", "Use Goblin eyllable file"
|
13
|
+
o.bool "-r", "--roman", "Use Roman eyllable file"
|
14
|
+
o.bool "-f", "--flipmode", "Flip mode in effect"
|
15
|
+
o.bool "-c", "--cyrillic", "Use Cyrillic mode"
|
16
|
+
o.bool "-x", "--xrated", "Generate Curse words [NEEDS WORK]"
|
17
|
+
o.bool "-?", "--help", "How to"
|
18
|
+
end
|
19
|
+
|
20
|
+
if opts.cyrillic?
|
21
|
+
lang = RandomNameGenerator::FANTASY_RU
|
22
|
+
lang = RandomNameGenerator::ELVEN_RU if opts.elven?
|
23
|
+
lang = RandomNameGenerator::GOBLIN_RU if opts.goblin?
|
24
|
+
lang = RandomNameGenerator::ROMAN_RU if opts.roman?
|
25
|
+
else
|
26
|
+
lang = RandomNameGenerator::ELVEN if opts.elven?
|
27
|
+
lang = RandomNameGenerator::GOBLIN if opts.goblin?
|
28
|
+
lang = RandomNameGenerator::ROMAN if opts.roman?
|
29
|
+
lang = RandomNameGenerator::CURSE if opts.xrated?
|
30
|
+
end
|
31
|
+
|
32
|
+
if opts.flipmode?
|
33
|
+
if opts.cyrillic?
|
34
|
+
puts "#{RandomNameGenerator.flip_mode_cyrillic.compose} #{RandomNameGenerator.flip_mode_cyrillic.compose}"
|
35
|
+
else
|
36
|
+
puts "#{RandomNameGenerator.flip_mode.compose} #{RandomNameGenerator.flip_mode.compose}"
|
37
|
+
end
|
38
|
+
elsif opts.help?
|
39
|
+
puts opts
|
40
|
+
else
|
41
|
+
rndgen = RandomNameGenerator.new(lang)
|
42
|
+
puts "#{rndgen.compose} #{rndgen.compose}"
|
43
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
-a +c
|
1
2
|
-æ +c
|
2
3
|
-aa +c
|
3
4
|
-ab
|
@@ -20,6 +21,8 @@
|
|
20
21
|
-ang
|
21
22
|
-anti
|
22
23
|
-ap
|
24
|
+
-ar
|
25
|
+
-as
|
23
26
|
-hab
|
24
27
|
-mai
|
25
28
|
-mal
|
@@ -40,6 +43,7 @@ ia -c +c
|
|
40
43
|
it -c -v
|
41
44
|
loc +v
|
42
45
|
ma +c
|
46
|
+
mo -c +c
|
43
47
|
oc
|
44
48
|
olly -c +v
|
45
49
|
or
|
@@ -47,12 +51,20 @@ ra +c
|
|
47
51
|
rat
|
48
52
|
rax +v
|
49
53
|
real
|
54
|
+
roma -c +c
|
50
55
|
sh
|
51
56
|
thi +c
|
57
|
+
una -c +c
|
52
58
|
|
53
59
|
+al
|
60
|
+
+akku -c
|
54
61
|
+as
|
62
|
+
+b'el -c
|
55
63
|
+bou -v
|
64
|
+
+chon
|
65
|
+
+christ -v
|
66
|
+
+dai
|
67
|
+
+deus
|
56
68
|
+er -c
|
57
69
|
+es -c
|
58
70
|
+ias -c
|
@@ -60,34 +72,30 @@ thi +c
|
|
60
72
|
+ka
|
61
73
|
+lat
|
62
74
|
+lech
|
75
|
+
+lius
|
63
76
|
+ma
|
64
77
|
+man
|
65
78
|
+mon
|
66
79
|
+nah
|
67
80
|
+nyu
|
68
81
|
+on -c
|
82
|
+
+phus -c
|
69
83
|
+rept -v
|
70
84
|
+res
|
85
|
+
+ros
|
71
86
|
+s -v
|
87
|
+
+sag
|
88
|
+
+sakku -v
|
89
|
+
+sura
|
72
90
|
+van
|
73
91
|
+xas -v
|
74
92
|
+y -c
|
75
93
|
+ym
|
76
94
|
+zou
|
95
|
+
+xu
|
77
96
|
|
78
97
|
# https://en.wikipedia.org/wiki/The_infernal_names
|
79
98
|
|
80
|
-
Andrealphus (Christian demonology)
|
81
|
-
Andromalius (Christian demonology)
|
82
|
-
Antichrist (Christian demonology)
|
83
|
-
Anzu (Sumerian mythology)
|
84
|
-
Armaros (Jewish demonology)
|
85
|
-
Archon (Gnosticism)
|
86
|
-
Arunasura [Hindu mythology]
|
87
|
-
Asag (Sumerian demonology)
|
88
|
-
Asakku (Babylonian mythology)
|
89
|
-
Asb'el (Jewish mythology)
|
90
|
-
Asmodai/Asmodeus (Jewish folklore and Christian demonology)
|
91
99
|
Astaroth (Christian demonology)
|
92
100
|
Asura (Hindu mythology)
|
93
101
|
Azazel / Azaz'el (Jewish 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
|
+
+эвар
|