random_name_generator 1.0.3 → 2.0.1

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.
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 [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/).
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
- The big difference between this random name generator and others is that it allows you to create names in various
13
- custom styles such as Elven, and Roman. If you're looking for a quick name for a Goblin NPC, RandomNameGenerator is
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
- $ bundle
34
+ $❯ bundle install
30
35
 
31
36
  Or install it yourself as:
32
37
 
33
- $ gem install random_name_generator
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/random_name_generator/languages/elven.txt),
39
- [Fantasy](https://github.com/folkengine/random_name_generator/blob/master/lib/random_name_generator/languages/fantasy.txt),
40
- [Goblin](https://github.com/folkengine/random_name_generator/blob/master/lib/random_name_generator/languages/goblin.txt),
41
- and [Roman](https://github.com/folkengine/random_name_generator/blob/master/lib/random_name_generator/languages/roman.txt).
42
- By default it uses Fantasy. Instantiate RandomNameGenerator and then call compose on the object to generate a random name.
43
- If you don't pass in the number of syllables you want for your name to compose, it will randomly pick between 3 and 6.
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
- Pass in a reference to specific syllable file to get different styles of random names:
60
+ *Technically, `RandomNameGenerator.new` is a static factory method
61
+ creating a RandomNameGenerator::Generator object.*
53
62
 
54
- ```ruby
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 the syllable file for you.
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,61 @@ puts flip.compose
64
77
  ```
65
78
 
66
79
  You can also pass in your own syllable files. See
67
- [RNGSyllable.rb](https://github.com/folkengine/random_name_generator/blob/master/lib/random_name_generator/rng_syllable.rb)
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 generate a first and last name for you:
83
+ RandomNameGenerator also comes with a command line interface which will
84
+ generate a first and last name for you:
71
85
 
72
- ```ruby
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 to RandomNameGenerator.
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 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:
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.
84
98
 
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).
99
+ Part of the reason for working on this gem was to work on the following
100
+ goals to improve my Ruby craft:
89
101
 
90
- ## Development
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).
91
111
 
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.
93
112
 
94
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
113
+ ## Development
95
114
 
96
- ## Dependencies
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.
97
119
 
98
- * [Mocha](https://github.com/freerange/mocha)
99
- * [Reek](https://github.com/troessner/reek)
100
- * [Rubocop](https://github.com/bbatsov/rubocop)
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).
101
125
 
102
- ## Alternatives
126
+ To run [Reek](https://github.com/troessner/reek) on the codebase, simply
127
+ call `$❯ rake reek`
103
128
 
104
- There are several other great name generator gems. They really aren't designed for fantasy style names.
129
+ ## Contributing
105
130
 
106
- * [Faker](https://github.com/stympy/faker)
107
- * [Namey](https://github.com/muffinista/namey)
108
- * [How To Write A Name Generator (In Ruby)](http://www.skorks.com/2009/07/how-to-write-a-name-generator-in-ruby/)
131
+ Bug reports and pull requests are welcome on GitHub at
132
+ https://github.com/folkengine/random_name_generator.
109
133
 
110
- ## Contributing
134
+ ## License
111
135
 
112
- Bug reports and pull requests are welcome on GitHub at https://github.com/folkengine/random_name_generator.
136
+ The gem is available as open source under the terms of the
137
+ [GNU Lesser General Public License version 3](https://opensource.org/licenses/LGPL-3.0).
data/Rakefile CHANGED
@@ -1,26 +1,17 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
- require 'reek/rake/task'
4
- require 'rubocop/rake_task'
1
+ # frozen_string_literal: true
5
2
 
6
- task default: :test
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "reek/rake/task"
7
6
 
8
- Reek::Rake::Task.new do |t|
9
- t.fail_on_error = false
10
- end
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ require "rubocop/rake_task"
11
10
 
12
11
  RuboCop::RakeTask.new
13
12
 
14
- Rake::TestTask.new do |t|
15
- t.libs << 'test'
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
19
16
 
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
17
+ task default: %i[spec rubocop]
data/bin/console CHANGED
@@ -1,17 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'bundler/setup'
4
- require 'random_name_generator'
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 'pry'
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,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ruby -Ilib/ exe/random_name_generator "$@"
@@ -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
+ +эвар