haikunate 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +6 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +62 -0
- data/LICENSE.txt +21 -0
- data/README.md +119 -0
- data/Rakefile +15 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/data/adjectives.txt +350 -0
- data/data/nouns.txt +137 -0
- data/haikunate.gemspec +36 -0
- data/lib/haikunate.rb +48 -0
- data/lib/haikunate/version.rb +5 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5999d983145955bb2c6cfcf6c867df63f5c1e3d74479509d60baec2b5befe898
|
4
|
+
data.tar.gz: f9f9d18f76ad30d40f96de4dd213d63a264d6edcda24ddc6fbc130de735db96d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90e6598920305726c8e06fbbdad31c3374b9ab9063e31494c378c63e5e9836536eeefc3b25d261ff8aa582aacb357ffe8a4576b4b1269b726494648fb01813d8
|
7
|
+
data.tar.gz: d6a72c093c2d40c2b2d095cdc6b5c92e0b49a2fa3cc14211f2fc7f522ed29d5314597f694d4ae814ec95d62737ca1448418f3cdfe1c0789bd34e77fc8330b575
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at me@fnando.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
haikunate (0.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
awesome_print (1.8.0)
|
11
|
+
byebug (11.1.1)
|
12
|
+
coderay (1.1.2)
|
13
|
+
jaro_winkler (1.5.4)
|
14
|
+
method_source (0.9.2)
|
15
|
+
minitest (5.14.0)
|
16
|
+
minitest-utils (0.4.6)
|
17
|
+
minitest
|
18
|
+
parallel (1.19.1)
|
19
|
+
parser (2.7.0.2)
|
20
|
+
ast (~> 2.4.0)
|
21
|
+
pry (0.12.2)
|
22
|
+
coderay (~> 1.1.0)
|
23
|
+
method_source (~> 0.9.0)
|
24
|
+
pry-byebug (3.8.0)
|
25
|
+
byebug (~> 11.0)
|
26
|
+
pry (~> 0.10)
|
27
|
+
pry-meta (0.0.10)
|
28
|
+
awesome_print
|
29
|
+
pry
|
30
|
+
pry-byebug
|
31
|
+
pry-remote
|
32
|
+
pry-remote (0.1.8)
|
33
|
+
pry (~> 0.9)
|
34
|
+
slop (~> 3.0)
|
35
|
+
rainbow (3.0.0)
|
36
|
+
rake (12.3.2)
|
37
|
+
rubocop (0.79.0)
|
38
|
+
jaro_winkler (~> 1.5.1)
|
39
|
+
parallel (~> 1.10)
|
40
|
+
parser (>= 2.7.0.1)
|
41
|
+
rainbow (>= 2.2.2, < 4.0)
|
42
|
+
ruby-progressbar (~> 1.7)
|
43
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
44
|
+
rubocop-fnando (0.0.6)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
slop (3.6.0)
|
47
|
+
unicode-display_width (1.6.1)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
haikunate!
|
54
|
+
minitest (~> 5.0)
|
55
|
+
minitest-utils
|
56
|
+
pry-meta
|
57
|
+
rake (~> 12.0)
|
58
|
+
rubocop
|
59
|
+
rubocop-fnando
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
2.1.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Nando Vieira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# Haikunate
|
2
|
+
|
3
|
+
Generate Heroku-like memorable random names like `adorable-ox-1234`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "haikunate"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install haikunate
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
You generate random haiku names by calling `Haikunate.call` (or its alias
|
24
|
+
`Haiku.call`).
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Haiku.call
|
28
|
+
#=> satisfied-eagle-7977
|
29
|
+
```
|
30
|
+
|
31
|
+
You can change the joiner string by provider the option `joiner`.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Haiku.call(joiner: ".")
|
35
|
+
#=> passionate.alpaca.7619
|
36
|
+
```
|
37
|
+
|
38
|
+
A haiku composed by `adjective-noun-variant`, where variant is a random number
|
39
|
+
within `1000..9999` range. You can override the range by setting
|
40
|
+
`Haiku.default_range`.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Haiku.default_range = 10_000..99_999
|
44
|
+
#=> abundant-panda-57702
|
45
|
+
```
|
46
|
+
|
47
|
+
Alternatively, you can provide a `variant` option, which can be any object that
|
48
|
+
responds to `.call()`.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require "securerandom"
|
52
|
+
|
53
|
+
Haiku.call(variant: -> { SecureRandom.alphanumeric(5).downcase })
|
54
|
+
#=> tidy-skunk-s8ln0
|
55
|
+
```
|
56
|
+
|
57
|
+
To override the dictionary list, use `Haiku.adjectives=(list)` and
|
58
|
+
`Haiku.nouns=(list)`.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Haiku.adjectives = %w[awful terrible crazy]
|
62
|
+
Haiku.nouns = %w[lawyer judge politian]
|
63
|
+
|
64
|
+
Haiku.call
|
65
|
+
#=> terrible-politian-8116
|
66
|
+
```
|
67
|
+
|
68
|
+
If you're planning to use a haiku as some unique value on your database, you can
|
69
|
+
use `Haiku.next(options, &block)`; a new haiku will be generate until
|
70
|
+
`block.call(haiku)` returns `false`. For instance, this is how you'd use it with
|
71
|
+
ActiveRecord:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
site = Site.new
|
75
|
+
site.slug = Haiku.next {|slug| Site.where(slug: slug).exists? }
|
76
|
+
site.save!
|
77
|
+
```
|
78
|
+
|
79
|
+
That can be a problem for databases with lots and lots of records. If that's the
|
80
|
+
case, you can then use a more random variant like 6 random alphanumeric
|
81
|
+
characters.
|
82
|
+
|
83
|
+
You can override the default variant generator by setting
|
84
|
+
`Haiku.default_variant=(new_variant)`.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
Haiku.default_variant = -> { SecureRandom.alphanumeric(6).downcase }
|
88
|
+
```
|
89
|
+
|
90
|
+
## Development
|
91
|
+
|
92
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
93
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
94
|
+
prompt that will allow you to experiment.
|
95
|
+
|
96
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
97
|
+
release a new version, update the version number in `version.rb`, and then run
|
98
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
99
|
+
git commits and tags, and push the `.gem` file to
|
100
|
+
[rubygems.org](https://rubygems.org).
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
Bug reports and pull requests are welcome on GitHub at
|
105
|
+
https://github.com/fnando/haikunate. This project is intended to be a safe,
|
106
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
107
|
+
the [code of conduct](https://github.com/fnando/haikunate/blob/master/CODE_OF_CONDUCT.md).
|
108
|
+
|
109
|
+
|
110
|
+
## License
|
111
|
+
|
112
|
+
The gem is available as open source under the terms of the
|
113
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
114
|
+
|
115
|
+
## Code of Conduct
|
116
|
+
|
117
|
+
Everyone interacting in the Haikunate project's codebases, issue trackers, chat
|
118
|
+
rooms and mailing lists is expected to follow the
|
119
|
+
[code of conduct](https://github.com/fnando/haikunate/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.libs << "lib"
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
end
|
12
|
+
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i[test rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "haikunate"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/data/adjectives.txt
ADDED
@@ -0,0 +1,350 @@
|
|
1
|
+
abundant
|
2
|
+
adaptable
|
3
|
+
adorable
|
4
|
+
adored
|
5
|
+
adventurous
|
6
|
+
affable
|
7
|
+
affectionate
|
8
|
+
agreeable
|
9
|
+
allowing
|
10
|
+
altruistic
|
11
|
+
amaranth
|
12
|
+
amazing
|
13
|
+
amber
|
14
|
+
ambitious
|
15
|
+
amethyst
|
16
|
+
amiable
|
17
|
+
amicable
|
18
|
+
amusing
|
19
|
+
appreciated
|
20
|
+
appreciative
|
21
|
+
apricot
|
22
|
+
aquamarine
|
23
|
+
authentic
|
24
|
+
aware
|
25
|
+
awesome
|
26
|
+
azure
|
27
|
+
balanced
|
28
|
+
beautiful
|
29
|
+
beige
|
30
|
+
beloved
|
31
|
+
best
|
32
|
+
black
|
33
|
+
blessed
|
34
|
+
blissful
|
35
|
+
blithesome
|
36
|
+
blue
|
37
|
+
bold
|
38
|
+
brave
|
39
|
+
breathtaking
|
40
|
+
bright
|
41
|
+
brilliant
|
42
|
+
bronze
|
43
|
+
brown
|
44
|
+
burgundy
|
45
|
+
calm
|
46
|
+
capable
|
47
|
+
careful
|
48
|
+
caring
|
49
|
+
carmine
|
50
|
+
centered
|
51
|
+
cerise
|
52
|
+
cerulean
|
53
|
+
champagne
|
54
|
+
charismatic
|
55
|
+
charming
|
56
|
+
cheerful
|
57
|
+
cherished
|
58
|
+
chocolate
|
59
|
+
clean
|
60
|
+
cobalt
|
61
|
+
coffee
|
62
|
+
comfortable
|
63
|
+
communicative
|
64
|
+
compassionate
|
65
|
+
confident
|
66
|
+
conscientious
|
67
|
+
considerate
|
68
|
+
content
|
69
|
+
convivial
|
70
|
+
copper
|
71
|
+
coral
|
72
|
+
courageous
|
73
|
+
courteous
|
74
|
+
creative
|
75
|
+
crimson
|
76
|
+
cute
|
77
|
+
cyan
|
78
|
+
dandy
|
79
|
+
daring
|
80
|
+
dazzled
|
81
|
+
decisive
|
82
|
+
dedicated
|
83
|
+
delightful
|
84
|
+
determined
|
85
|
+
diligent
|
86
|
+
diplomatic
|
87
|
+
discreet
|
88
|
+
divine
|
89
|
+
dynamic
|
90
|
+
eager
|
91
|
+
easygoing
|
92
|
+
emerald
|
93
|
+
emotional
|
94
|
+
empathetic
|
95
|
+
empathic
|
96
|
+
empowered
|
97
|
+
enchanted
|
98
|
+
endless
|
99
|
+
energetic
|
100
|
+
energized
|
101
|
+
enlightened
|
102
|
+
enlivened
|
103
|
+
enthusiastic
|
104
|
+
erin
|
105
|
+
eternal
|
106
|
+
excellent
|
107
|
+
excited
|
108
|
+
exhilarated
|
109
|
+
expanded
|
110
|
+
expansive
|
111
|
+
exquisite
|
112
|
+
extraordinary
|
113
|
+
exuberant
|
114
|
+
fabulous
|
115
|
+
faithful
|
116
|
+
fantastic
|
117
|
+
favorable
|
118
|
+
fearless
|
119
|
+
flourished
|
120
|
+
flowing
|
121
|
+
focused
|
122
|
+
forceful
|
123
|
+
forgiving
|
124
|
+
fortuitous
|
125
|
+
frank
|
126
|
+
free
|
127
|
+
friendly
|
128
|
+
fulfilled
|
129
|
+
fun
|
130
|
+
funny
|
131
|
+
generous
|
132
|
+
genial
|
133
|
+
genius
|
134
|
+
gentle
|
135
|
+
genuine
|
136
|
+
giving
|
137
|
+
glad
|
138
|
+
glorious
|
139
|
+
glowing
|
140
|
+
gold
|
141
|
+
good
|
142
|
+
good health
|
143
|
+
goodness
|
144
|
+
graceful
|
145
|
+
gracious
|
146
|
+
grateful
|
147
|
+
gray
|
148
|
+
great
|
149
|
+
green
|
150
|
+
gregarious
|
151
|
+
grounded
|
152
|
+
happy
|
153
|
+
harlequin
|
154
|
+
harmonious
|
155
|
+
healthy
|
156
|
+
heartfull
|
157
|
+
heartwarming
|
158
|
+
heaven
|
159
|
+
helpful
|
160
|
+
holy
|
161
|
+
honest
|
162
|
+
hopeful
|
163
|
+
humorous
|
164
|
+
illuminated
|
165
|
+
imaginative
|
166
|
+
impartial
|
167
|
+
incomparable
|
168
|
+
incredible
|
169
|
+
independent
|
170
|
+
indigo
|
171
|
+
ineffable
|
172
|
+
innovative
|
173
|
+
inspirational
|
174
|
+
inspired
|
175
|
+
intellectual
|
176
|
+
intelligent
|
177
|
+
intuitive
|
178
|
+
inventive
|
179
|
+
invigorated
|
180
|
+
involved
|
181
|
+
ivory
|
182
|
+
jade
|
183
|
+
jazzed
|
184
|
+
jolly
|
185
|
+
jovial
|
186
|
+
joyful
|
187
|
+
joyous
|
188
|
+
jubilant
|
189
|
+
juicy
|
190
|
+
just
|
191
|
+
juvenescent
|
192
|
+
kalon
|
193
|
+
kind
|
194
|
+
kissable
|
195
|
+
knowledgeable
|
196
|
+
lavender
|
197
|
+
lemon
|
198
|
+
lilac
|
199
|
+
lime
|
200
|
+
lively
|
201
|
+
lovable
|
202
|
+
lovely
|
203
|
+
loving
|
204
|
+
loyal
|
205
|
+
lucky
|
206
|
+
luxurious
|
207
|
+
magenta
|
208
|
+
magical
|
209
|
+
magnificent
|
210
|
+
maroon
|
211
|
+
marvelous
|
212
|
+
mauve
|
213
|
+
memorable
|
214
|
+
mindful
|
215
|
+
miracle
|
216
|
+
miraculous
|
217
|
+
mirthful
|
218
|
+
modest
|
219
|
+
neat
|
220
|
+
nice
|
221
|
+
noble
|
222
|
+
nourished
|
223
|
+
nurtured
|
224
|
+
ochre
|
225
|
+
olive
|
226
|
+
open
|
227
|
+
optimistic
|
228
|
+
opulent
|
229
|
+
orange
|
230
|
+
orchid
|
231
|
+
original
|
232
|
+
outstanding
|
233
|
+
passionate
|
234
|
+
patient
|
235
|
+
peaceful
|
236
|
+
peach
|
237
|
+
pear
|
238
|
+
perfect
|
239
|
+
periwinkle
|
240
|
+
persistent
|
241
|
+
philosophical
|
242
|
+
pink
|
243
|
+
pioneering
|
244
|
+
placid
|
245
|
+
playful
|
246
|
+
plucky
|
247
|
+
plum
|
248
|
+
polite
|
249
|
+
positive
|
250
|
+
powerful
|
251
|
+
practical
|
252
|
+
precious
|
253
|
+
propitious
|
254
|
+
prosperous
|
255
|
+
puce
|
256
|
+
purple
|
257
|
+
quiet
|
258
|
+
radiant
|
259
|
+
raspberry
|
260
|
+
rational
|
261
|
+
receptive
|
262
|
+
red
|
263
|
+
refreshed
|
264
|
+
rejuvenated
|
265
|
+
relaxed
|
266
|
+
reliable
|
267
|
+
relieved
|
268
|
+
remarkable
|
269
|
+
renewed
|
270
|
+
reserved
|
271
|
+
resilient
|
272
|
+
resourceful
|
273
|
+
rich
|
274
|
+
romantic
|
275
|
+
rose
|
276
|
+
ruby
|
277
|
+
sacred
|
278
|
+
safe
|
279
|
+
sangria
|
280
|
+
sapphire
|
281
|
+
satisfied
|
282
|
+
scarlet
|
283
|
+
secured
|
284
|
+
sensational
|
285
|
+
sensible
|
286
|
+
sensitive
|
287
|
+
serene
|
288
|
+
shining
|
289
|
+
shy
|
290
|
+
silver
|
291
|
+
sincere
|
292
|
+
smart
|
293
|
+
sociable
|
294
|
+
spectacular
|
295
|
+
splendid
|
296
|
+
stellar
|
297
|
+
straightforward
|
298
|
+
strong
|
299
|
+
stupendous
|
300
|
+
successful
|
301
|
+
super
|
302
|
+
sustained
|
303
|
+
sympathetic
|
304
|
+
tan
|
305
|
+
taupe
|
306
|
+
teal
|
307
|
+
thankful
|
308
|
+
thoughtful
|
309
|
+
thrilled
|
310
|
+
thriving
|
311
|
+
tidy
|
312
|
+
tough
|
313
|
+
tranquil
|
314
|
+
triumphant
|
315
|
+
trusting
|
316
|
+
turquoise
|
317
|
+
ultimate
|
318
|
+
ultramarine
|
319
|
+
unassuming
|
320
|
+
unbelievable
|
321
|
+
understanding
|
322
|
+
unique
|
323
|
+
unlimited
|
324
|
+
unreal
|
325
|
+
uplifted
|
326
|
+
valuable
|
327
|
+
versatile
|
328
|
+
vibrant
|
329
|
+
victorious
|
330
|
+
violet
|
331
|
+
viridian
|
332
|
+
vivacious
|
333
|
+
warm
|
334
|
+
warmhearted
|
335
|
+
wealthy
|
336
|
+
welcomed
|
337
|
+
white
|
338
|
+
wholeheartedly
|
339
|
+
willing
|
340
|
+
wise
|
341
|
+
witty
|
342
|
+
wonderful
|
343
|
+
wondrous
|
344
|
+
worthy
|
345
|
+
yellow
|
346
|
+
youthful
|
347
|
+
zappiest
|
348
|
+
zappy
|
349
|
+
zestful
|
350
|
+
zing
|
data/data/nouns.txt
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
aardvark
|
2
|
+
alligator
|
3
|
+
alpaca
|
4
|
+
ant
|
5
|
+
antelope
|
6
|
+
ape
|
7
|
+
armadillo
|
8
|
+
ass
|
9
|
+
baboon
|
10
|
+
badger
|
11
|
+
bat
|
12
|
+
bear
|
13
|
+
beaver
|
14
|
+
bee
|
15
|
+
beetle
|
16
|
+
buffalo
|
17
|
+
butterfly
|
18
|
+
camel
|
19
|
+
carabao
|
20
|
+
caribou
|
21
|
+
cat
|
22
|
+
cattle
|
23
|
+
cheetah
|
24
|
+
chicken
|
25
|
+
chimpanzee
|
26
|
+
chinchilla
|
27
|
+
cicada
|
28
|
+
clam
|
29
|
+
cockroach
|
30
|
+
cod
|
31
|
+
coyote
|
32
|
+
crab
|
33
|
+
cricket
|
34
|
+
crow
|
35
|
+
deer
|
36
|
+
dinosaur
|
37
|
+
dog
|
38
|
+
dolphin
|
39
|
+
duck
|
40
|
+
eagle
|
41
|
+
echidna
|
42
|
+
eel
|
43
|
+
elephant
|
44
|
+
elk
|
45
|
+
ferret
|
46
|
+
fish
|
47
|
+
fly
|
48
|
+
fox
|
49
|
+
frog
|
50
|
+
gerbil
|
51
|
+
giraffe
|
52
|
+
gnat
|
53
|
+
gnu
|
54
|
+
goat
|
55
|
+
goldfish
|
56
|
+
goose
|
57
|
+
gorilla
|
58
|
+
grasshopper
|
59
|
+
guinea
|
60
|
+
hamster
|
61
|
+
hare
|
62
|
+
hedgehog
|
63
|
+
herring
|
64
|
+
hippopotamus
|
65
|
+
hornet
|
66
|
+
horse
|
67
|
+
hound
|
68
|
+
house
|
69
|
+
human
|
70
|
+
hyena
|
71
|
+
impala
|
72
|
+
insect
|
73
|
+
jackal
|
74
|
+
jellyfish
|
75
|
+
kangaroo
|
76
|
+
koala
|
77
|
+
leopard
|
78
|
+
lion
|
79
|
+
lizard
|
80
|
+
llama
|
81
|
+
locust
|
82
|
+
louse
|
83
|
+
macaw
|
84
|
+
mallard
|
85
|
+
mammoth
|
86
|
+
manatee
|
87
|
+
marten
|
88
|
+
mink
|
89
|
+
minnow
|
90
|
+
mole
|
91
|
+
monkey
|
92
|
+
moose
|
93
|
+
mosquito
|
94
|
+
mouse
|
95
|
+
mule
|
96
|
+
muskrat
|
97
|
+
otter
|
98
|
+
ox
|
99
|
+
oyster
|
100
|
+
panda
|
101
|
+
pig
|
102
|
+
platypus
|
103
|
+
porcupine
|
104
|
+
prairie
|
105
|
+
pug
|
106
|
+
rabbit
|
107
|
+
raccoon
|
108
|
+
reindeer
|
109
|
+
rhinoceros
|
110
|
+
salmon
|
111
|
+
sardine
|
112
|
+
scorpion
|
113
|
+
seal
|
114
|
+
serval
|
115
|
+
shark
|
116
|
+
sheep
|
117
|
+
skunk
|
118
|
+
snail
|
119
|
+
snake
|
120
|
+
spider
|
121
|
+
squirrel
|
122
|
+
swan
|
123
|
+
termite
|
124
|
+
tiger
|
125
|
+
trout
|
126
|
+
turtle
|
127
|
+
walrus
|
128
|
+
wasp
|
129
|
+
weasel
|
130
|
+
whale
|
131
|
+
wolf
|
132
|
+
wombat
|
133
|
+
woodchuck
|
134
|
+
worm
|
135
|
+
yak
|
136
|
+
yellowjacket
|
137
|
+
zebra
|
data/haikunate.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/haikunate/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "haikunate"
|
7
|
+
spec.version = Haikunate::VERSION
|
8
|
+
spec.authors = ["Nando Vieira"]
|
9
|
+
spec.email = ["me@fnando.com"]
|
10
|
+
|
11
|
+
spec.summary =
|
12
|
+
"Generate Heroku-like memorable random names like adorable-ox-1234."
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/fnando/haikunate"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`
|
23
|
+
.split("\x0")
|
24
|
+
.reject {|f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "minitest"
|
32
|
+
spec.add_development_dependency "minitest-utils"
|
33
|
+
spec.add_development_dependency "pry-meta"
|
34
|
+
spec.add_development_dependency "rubocop"
|
35
|
+
spec.add_development_dependency "rubocop-fnando"
|
36
|
+
end
|
data/lib/haikunate.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
module Haikunate
|
7
|
+
require "haikunate/version"
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :default_range
|
11
|
+
attr_accessor :default_variant
|
12
|
+
end
|
13
|
+
|
14
|
+
self.default_range = 1000..9999
|
15
|
+
self.default_variant = -> { rand(default_range) }
|
16
|
+
|
17
|
+
def self.data_dir
|
18
|
+
@data_dir ||= Pathname.new(File.expand_path("#{__dir__}/../data"))
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.nouns
|
22
|
+
@nouns ||= data_dir.join("nouns.txt").read.lines.map(&:chomp)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.nouns=(nouns)
|
26
|
+
@nouns = nouns.map(&:chomp)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.adjectives
|
30
|
+
@adjectives ||= data_dir.join("adjectives.txt").read.lines.map(&:chomp)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.adjectives=(adjectives)
|
34
|
+
@adjectives = adjectives.map(&:chomp)
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.call(joiner: "-", variant: default_variant)
|
38
|
+
[adjectives.sample, nouns.sample, variant.call].join(joiner)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.next(joiner: "-", variant: default_variant, &block)
|
42
|
+
options = {joiner: joiner, variant: variant}
|
43
|
+
name = call(**options) while !name || block.call(name)
|
44
|
+
name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Haiku = Haikunate
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: haikunate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nando Vieira
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest-utils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-meta
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-fnando
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Generate Heroku-like memorable random names like adorable-ox-1234.
|
84
|
+
email:
|
85
|
+
- me@fnando.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rubocop.yml"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- data/adjectives.txt
|
102
|
+
- data/nouns.txt
|
103
|
+
- haikunate.gemspec
|
104
|
+
- lib/haikunate.rb
|
105
|
+
- lib/haikunate/version.rb
|
106
|
+
homepage: https://github.com/fnando/haikunate
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata:
|
110
|
+
homepage_uri: https://github.com/fnando/haikunate
|
111
|
+
source_code_uri: https://github.com/fnando/haikunate
|
112
|
+
changelog_uri: https://github.com/fnando/haikunate
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubygems_version: 3.1.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Generate Heroku-like memorable random names like adorable-ox-1234.
|
132
|
+
test_files: []
|