random-words 1.0.6 → 1.0.7

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec_status +118 -100
  3. data/.rubocop.yml +4 -1
  4. data/.rubocop_todo.yml +313 -0
  5. data/CHANGELOG.md +26 -1
  6. data/Gemfile +15 -12
  7. data/Gemfile.lock +44 -27
  8. data/README.md +81 -37
  9. data/bin/randw +109 -89
  10. data/lib/random-words/array.rb +27 -7
  11. data/lib/random-words/config.rb +29 -23
  12. data/lib/random-words/generator.rb +42 -25
  13. data/lib/random-words/hash.rb +1 -1
  14. data/lib/random-words/html2markdown.rb +7 -7
  15. data/lib/random-words/lorem-markdown.rb +19 -20
  16. data/lib/random-words/number-to-word.rb +23 -21
  17. data/lib/random-words/source.rb +10 -9
  18. data/lib/random-words/string.rb +22 -17
  19. data/lib/random-words/table-cleanup.rb +3 -3
  20. data/lib/random-words/version.rb +1 -1
  21. data/lib/random-words/words/1984/names.txt +10 -72
  22. data/lib/random-words/words/1984/phrases.txt +16 -0
  23. data/lib/random-words/words/alice/names.txt +10 -74
  24. data/lib/random-words/words/alice/phrases.txt +16 -0
  25. data/lib/random-words/words/bacon/names.txt +53 -73
  26. data/lib/random-words/words/bacon/phrases.txt +20 -0
  27. data/lib/random-words/words/corporate/phrases.txt +29 -0
  28. data/lib/random-words/words/doctor/names.txt +18 -18
  29. data/lib/random-words/words/doctor/phrases.txt +29 -0
  30. data/lib/random-words/words/english/phrases.txt +29 -0
  31. data/lib/random-words/words/foulmouth/articles-plural.txt +3 -1
  32. data/lib/random-words/words/foulmouth/articles-singular.txt +2 -1
  33. data/lib/random-words/words/foulmouth/config.yml +1 -1
  34. data/lib/random-words/words/foulmouth/names.txt +80 -73
  35. data/lib/random-words/words/foulmouth/phrases.txt +30 -0
  36. data/lib/random-words/words/hipster/names.txt +72 -73
  37. data/lib/random-words/words/hipster/phrases.txt +21 -0
  38. data/lib/random-words/words/latin/names.txt +92 -73
  39. data/lib/random-words/words/latin/phrases.txt +16 -0
  40. data/lib/random-words/words/spanish/names.txt +55 -68
  41. data/lib/random-words/words/spanish/phrases.txt +31 -0
  42. data/lib/random-words/words/veggie/names.txt +92 -73
  43. data/lib/random-words/words/veggie/phrases.txt +20 -0
  44. data/lib/random-words.rb +3 -3
  45. data/random-words.gemspec +1 -1
  46. data/src/_README.md +81 -37
  47. metadata +15 -4
data/lib/random-words.rb CHANGED
@@ -12,8 +12,8 @@ require_relative 'random-words/source'
12
12
  require_relative 'random-words/config'
13
13
  require_relative 'random-words/generator'
14
14
  require_relative 'random-words/number-to-word'
15
- require_relative 'random-words/lorem-markdown.rb'
16
- require_relative 'random-words/html2markdown.rb'
15
+ require_relative 'random-words/lorem-markdown'
16
+ require_relative 'random-words/html2markdown'
17
17
 
18
18
  # Main module for RandomWords
19
19
  module RandomWords
@@ -31,4 +31,4 @@ module RandomWords
31
31
  end
32
32
 
33
33
  initialize!
34
- end
34
+ end
data/random-words.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = 'me@brettterpstra.com'
10
10
 
11
11
  spec.summary = 'Random words generator'
12
- spec.description = 'Generate random text (lorem ipsum) from a variety of sources. Can be used to generate random words, sentences, or paragraphs.'
12
+ spec.description = 'Generate random text (lorem ipsum) from a variety of sources.'
13
13
  spec.homepage = 'https://github.com/ttscoff/random-words'
14
14
  spec.license = 'MIT'
15
15
  spec.required_ruby_version = '>= 2.6.0'
data/src/_README.md CHANGED
@@ -17,25 +17,38 @@ you use [Homebrew](https://brew.sh).
17
17
 
18
18
  ### CLI
19
19
 
20
- The gem installs a binary `randw`. It can generate random characters, sentences, paragraphs, and passwords.
20
+ The gem installs a binary `randw`. It can generate random
21
+ characters, sentences, paragraphs, markdown, html, and
22
+ passwords.
21
23
 
22
24
  ```console
23
25
  Usage: randw [options]
24
26
  OPTIONS:
25
- -S, --source [SOURCE] Specify the source language (default: latin)
26
- -l [short|medium|long|very_long],
27
- --length Specify the length of the sentence
28
- --graf-length [NUMBER] Specify the number of sentences in a paragraph
29
- -s, --sentences [NUMBER] Generate random sentences
27
+ -S, --source SOURCE Specify the source language (default: latin)
28
+ -l, --length LENGTH Specify the length of the sentence [short|medium|long|very_long]
29
+ --graf-length NUMBER Specify the number of sentences in a paragraph
30
+ --[no-]extended Specify whether to use extended punctuation in generated text
30
31
  GENERATORS:
31
- -p, --paragraphs [NUMBER] Generate random paragraphs
32
- -w, --words [NUMBER] Generate random words
33
- -c, --characters [NUMBER] Generate random characters
34
- -m, --markdown SETTINGS Generate random markdown text, comma separated string like "latin,10,all"
35
- --password Generate a random password
32
+ -s, --sentences [NUMBER] Generate NUMBER of random sentences (default: 3)
33
+ -p, --paragraphs [NUMBER] Generate NUMBER of random paragraphs (default: 3)
34
+ -w, --words [NUMBER] Generate NUMBER of random words (default: 10)
35
+ -c, --characters [NUMBER] Generate random characters of length (default: 100)
36
+ -m, --markdown [SETTINGS] Generate random markdown text, comma separated string like "latin,10,all"
37
+ dec: add em and strong
38
+ link: add links
39
+ ul: add unordered lists
40
+ ol: add ordered lists
41
+ dl: add definition lists
42
+ bq: add block quotes
43
+ code: add code spans and block
44
+ mark: add ==highlights==
45
+ headers: add headlines
46
+ image: add images
47
+ table: add tables
48
+ -H, --html [SETTINGS] Generate random html text, comma separated string like "latin,10,all"
49
+ --password [LENGTH] Generate a random password of LENGTH (default: 20)
36
50
  PASSWORD OPTIONS:
37
- --separator [CHAR] Specify the separator character for the password
38
- --[no-]extended Specify whether to use extended punctuation in generated text
51
+ --separator CHAR Specify the separator character for the password (default: " ")
39
52
  -n, --[no-]whitespace Specify whether to remove whitespace in generated text (characters only)
40
53
  DICTIONARIES:
41
54
  --list-dictionaries List available dictionaries
@@ -79,9 +92,23 @@ The number of elements inserted depends on the length you specify.
79
92
 
80
93
  Example commands:
81
94
 
82
- $ randw -m "latin/10/ol/dl/table"
83
- $ randw -m "english/5/all"
95
+ ```console
96
+ $ randw -m "latin/1/short/ol"
97
+
98
+ Illa brevis muros potior arcesso, apud multae octo centum nonaginta octo nodum! Haec ruosus misericordia mox contendo, apud nullus fors.
99
+
100
+
101
+ 1. Hoc cognatus opus facile complor latus discendo
102
+ 2. Aliqua apparens census quod nego
103
+ 3. Nullus salvus dux apud habeo spectabilis
104
+ 4. Quaedam sensus regnum cura gaudeo ornatus faeneo mox
105
+
106
+ $ randw -m "english,5,all"
84
107
 
108
+ # Any shiny napkin effectively picks
109
+
110
+ Neither sudden lake exceedingly works, outside a clarity even if which is a source of _an_ strength even if which holds _one subtle horse_ the future. Any lovable tank remarkabl...
111
+ ```
85
112
 
86
113
  #### Creating A New Dictionary
87
114
 
@@ -119,9 +146,11 @@ clauses.txt
119
146
  config.yml
120
147
  conjunctions-coordinating.txt
121
148
  conjunctions-subordinate.txt
149
+ names.txt
122
150
  nouns-plural.txt
123
151
  nouns-singular.txt
124
152
  numbers.txt
153
+ phrases.txt
125
154
  prepositions.txt
126
155
  terminators.txt
127
156
  verbs-passive.txt
@@ -129,8 +158,34 @@ verbs-plural.txt
129
158
  verbs-singular.txt
130
159
  ```
131
160
 
161
+ ##### Language Configuration
162
+
163
+ The `config.yml` file in a language directory is a simple
164
+ YAML configuration. It contains the keys:
165
+
166
+ ```yaml
167
+ ---
168
+ name: english
169
+ description: English words
170
+ triggers: [english]
171
+ ```
172
+
173
+ A default configuration file will be created when running `--create-dictionary` with the CLI.
174
+
175
+ - `name`: The name of the dictionary
176
+
177
+ This should be the same as the directory name in most cases
178
+ - `description`: Just used for display when running `--list-dictionaries`
179
+ - `triggers`: An array of triggers that can be used to trigger the language.
180
+
181
+ For example, the `bacon` language has the triggers `[bacon, meat, carnivore]`, so you can use `randw -S meat` on the command line (or with the library).
182
+
183
+
184
+
185
+ ##### Terminators
186
+
132
187
  The `terminators.txt` file contains pairs of punctuation,
133
- separated by commas, one per line. If a sentene terminator
188
+ separated by commas, one per line. If a sentence terminator
134
189
  doesn't have opening punctuation, start the line with a
135
190
  comma. More than one character can be used in either side of
136
191
  the pair. For example, to create a double quoted sentence
@@ -155,30 +210,19 @@ default terminator.txt files, the period, question mark, and
155
210
  exclamation point are repeated multiple times to make them
156
211
  the most likely to be used.
157
212
 
213
+ ##### Names
158
214
 
159
- ##### Language Configuration
160
-
161
- The `config.yml` file in a language directory is a simple
162
- YAML configuration. It contains the keys:
215
+ The `names.txt` file is just used when creating block quotes
216
+ in Markdown or HTML output. Sections are split by blank
217
+ lines: first names, last names, and optionally full names.
218
+ If the first line contains characters other than letters,
219
+ single quotes, and dashes, it will be assumed that you've
220
+ skipped straight to full names and those will be used
221
+ instead of generating random combinations.
163
222
 
164
- ```yaml
165
- ---
166
- name: english
167
- description: English words
168
- triggers: [english]
169
- ```
170
-
171
- A default configuration file will be created when running `--create-dictionary` with the CLI.
172
-
173
- - `name`: The name of the dictionary
174
-
175
- This should be the same as the directory name in most cases
176
- - `description`: Just used for display when running `--list-dictionaries`
177
- - `triggers`: An array of triggers that can be used to trigger the language.
178
-
179
- For example, the `bacon` language has the triggers `[bacon, meat, carnivore]`, so you can use `randw -S meat` on the command line (or with the library).
223
+ #### Language Notes
180
224
 
181
- > RandomWords loosely uses English rules for sentence construction, so non-English languages will likely generate even more nonsensical strings.
225
+ RandomWords loosely uses English rules for sentence construction, so non-English languages will likely generate even more nonsensical strings.
182
226
 
183
227
  If you create a fun dictionary, please let me know (or make a PR) and I'll gladly include (most) new dictionaries in the main distribution.
184
228
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random-words
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-14 00:00:00.000000000 Z
10
+ date: 2025-04-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri
@@ -23,8 +23,7 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '1.12'
26
- description: Generate random text (lorem ipsum) from a variety of sources. Can be
27
- used to generate random words, sentences, or paragraphs.
26
+ description: Generate random text (lorem ipsum) from a variety of sources.
28
27
  email: me@brettterpstra.com
29
28
  executables:
30
29
  - randw
@@ -36,6 +35,7 @@ files:
36
35
  - ".rspec"
37
36
  - ".rspec_status"
38
37
  - ".rubocop.yml"
38
+ - ".rubocop_todo.yml"
39
39
  - CHANGELOG.md
40
40
  - Gemfile
41
41
  - Gemfile.lock
@@ -66,6 +66,7 @@ files:
66
66
  - lib/random-words/words/1984/nouns-plural.txt
67
67
  - lib/random-words/words/1984/nouns-singular.txt
68
68
  - lib/random-words/words/1984/numbers.yml
69
+ - lib/random-words/words/1984/phrases.txt
69
70
  - lib/random-words/words/1984/prepositions.txt
70
71
  - lib/random-words/words/1984/terminators.txt
71
72
  - lib/random-words/words/1984/verbs-passive.txt
@@ -83,6 +84,7 @@ files:
83
84
  - lib/random-words/words/alice/nouns-plural.txt
84
85
  - lib/random-words/words/alice/nouns-singular.txt
85
86
  - lib/random-words/words/alice/numbers.yml
87
+ - lib/random-words/words/alice/phrases.txt
86
88
  - lib/random-words/words/alice/prepositions.txt
87
89
  - lib/random-words/words/alice/terminators.txt
88
90
  - lib/random-words/words/alice/verbs-passive.txt
@@ -100,6 +102,7 @@ files:
100
102
  - lib/random-words/words/bacon/nouns-plural.txt
101
103
  - lib/random-words/words/bacon/nouns-singular.txt
102
104
  - lib/random-words/words/bacon/numbers.yml
105
+ - lib/random-words/words/bacon/phrases.txt
103
106
  - lib/random-words/words/bacon/prepositions.txt
104
107
  - lib/random-words/words/bacon/terminators.txt
105
108
  - lib/random-words/words/bacon/verbs-passive.txt
@@ -117,6 +120,7 @@ files:
117
120
  - lib/random-words/words/corporate/nouns-plural.txt
118
121
  - lib/random-words/words/corporate/nouns-singular.txt
119
122
  - lib/random-words/words/corporate/numbers.yml
123
+ - lib/random-words/words/corporate/phrases.txt
120
124
  - lib/random-words/words/corporate/prepositions.txt
121
125
  - lib/random-words/words/corporate/terminators.txt
122
126
  - lib/random-words/words/corporate/verbs-passive.txt
@@ -134,6 +138,7 @@ files:
134
138
  - lib/random-words/words/doctor/nouns-plural.txt
135
139
  - lib/random-words/words/doctor/nouns-singular.txt
136
140
  - lib/random-words/words/doctor/numbers.yml
141
+ - lib/random-words/words/doctor/phrases.txt
137
142
  - lib/random-words/words/doctor/prepositions.txt
138
143
  - lib/random-words/words/doctor/terminators.txt
139
144
  - lib/random-words/words/doctor/verbs-passive.txt
@@ -151,6 +156,7 @@ files:
151
156
  - lib/random-words/words/english/nouns-plural.txt
152
157
  - lib/random-words/words/english/nouns-singular.txt
153
158
  - lib/random-words/words/english/numbers.yml
159
+ - lib/random-words/words/english/phrases.txt
154
160
  - lib/random-words/words/english/prepositions.txt
155
161
  - lib/random-words/words/english/terminators.txt
156
162
  - lib/random-words/words/english/verbs-passive.txt
@@ -168,6 +174,7 @@ files:
168
174
  - lib/random-words/words/foulmouth/nouns-plural.txt
169
175
  - lib/random-words/words/foulmouth/nouns-singular.txt
170
176
  - lib/random-words/words/foulmouth/numbers.yml
177
+ - lib/random-words/words/foulmouth/phrases.txt
171
178
  - lib/random-words/words/foulmouth/prepositions.txt
172
179
  - lib/random-words/words/foulmouth/terminators.txt
173
180
  - lib/random-words/words/foulmouth/verbs-passive.txt
@@ -185,6 +192,7 @@ files:
185
192
  - lib/random-words/words/hipster/nouns-plural.txt
186
193
  - lib/random-words/words/hipster/nouns-singular.txt
187
194
  - lib/random-words/words/hipster/numbers.yml
195
+ - lib/random-words/words/hipster/phrases.txt
188
196
  - lib/random-words/words/hipster/prepositions.txt
189
197
  - lib/random-words/words/hipster/terminators.txt
190
198
  - lib/random-words/words/hipster/verbs-passive.txt
@@ -202,6 +210,7 @@ files:
202
210
  - lib/random-words/words/latin/nouns-plural.txt
203
211
  - lib/random-words/words/latin/nouns-singular.txt
204
212
  - lib/random-words/words/latin/numbers.yml
213
+ - lib/random-words/words/latin/phrases.txt
205
214
  - lib/random-words/words/latin/prepositions.txt
206
215
  - lib/random-words/words/latin/terminators.txt
207
216
  - lib/random-words/words/latin/verbs-passive.txt
@@ -219,6 +228,7 @@ files:
219
228
  - lib/random-words/words/spanish/nouns-plural.txt
220
229
  - lib/random-words/words/spanish/nouns-singular.txt
221
230
  - lib/random-words/words/spanish/numbers.yml
231
+ - lib/random-words/words/spanish/phrases.txt
222
232
  - lib/random-words/words/spanish/prepositions.txt
223
233
  - lib/random-words/words/spanish/terminators.txt
224
234
  - lib/random-words/words/spanish/verbs-passive.txt
@@ -236,6 +246,7 @@ files:
236
246
  - lib/random-words/words/veggie/nouns-plural.txt
237
247
  - lib/random-words/words/veggie/nouns-singular.txt
238
248
  - lib/random-words/words/veggie/numbers.yml
249
+ - lib/random-words/words/veggie/phrases.txt
239
250
  - lib/random-words/words/veggie/prepositions.txt
240
251
  - lib/random-words/words/veggie/terminators.txt
241
252
  - lib/random-words/words/veggie/verbs-passive.txt