faker 3.0.0 → 3.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/README.md +171 -101
- data/lib/faker/default/code.rb +1 -1
- data/lib/faker/default/drone.rb +1 -1
- data/lib/faker/default/food.rb +1 -1
- data/lib/faker/default/internet.rb +33 -22
- data/lib/faker/default/invoice.rb +1 -1
- data/lib/faker/default/measurement.rb +8 -8
- data/lib/faker/default/phone_number.rb +1 -1
- data/lib/faker/default/twitter.rb +3 -5
- data/lib/faker/default/vehicle.rb +12 -33
- data/lib/faker/games/clash_of_clans.rb +1 -1
- data/lib/faker/games/minecraft.rb +1 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/sports/sport.rb +9 -3
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/da-DK.yml +0 -1
- data/lib/locales/de-AT.yml +0 -1
- data/lib/locales/de-CH.yml +0 -1
- data/lib/locales/de.yml +0 -1
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/heroes.yml +0 -0
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en-AU.yml +0 -1
- data/lib/locales/en-CA.yml +0 -1
- data/lib/locales/en-GB.yml +0 -1
- data/lib/locales/en-US.yml +0 -1
- data/lib/locales/en-ZA.yml +0 -1
- data/lib/locales/es-MX.yml +0 -1
- data/lib/locales/es.yml +0 -1
- data/lib/locales/fr/address.yml +0 -1
- data/lib/locales/fr-CA.yml +0 -1
- data/lib/locales/fr-CH.yml +0 -1
- data/lib/locales/ja/super_mario.yml +1 -1
- data/lib/locales/lt.yml +0 -1
- data/lib/locales/pl.yml +0 -1
- data/lib/locales/pt.yml +0 -1
- data/lib/locales/uk.yml +1 -1
- metadata +16 -13
- data/lib/faker/default/lorem_pixel.rb +0 -64
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61b4ec829c7b57771a22a4efdc7488d3ffb7833ab3b3ed19c044e022b690c9e6
|
|
4
|
+
data.tar.gz: 798f8d07f165e30b6a84fd9c27d942c79c3157fdee001dd074bb93ba91f10322
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47bbbd3123be42d96bae0c83db2572d696c00e32fa29712c370dce59adea5850f08d8de4116ec00c0d08381a915854d1b4343256df7c1efeee6caa2fc2dcef37
|
|
7
|
+
data.tar.gz: e6c6d174fd957b365ba6c08b84bfa8dc4890d42c443de7b21c07de2c462246399530f5acfd722bfbc4953270c040418fb5369006796da6aa1a80d9e70561c7ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.1.0](https://github.com/faker-ruby/faker/tree/v3.1.0) (2022-12-23)
|
|
4
|
+
|
|
5
|
+
Happy Holidays with a new Faker release! 🎉
|
|
6
|
+
|
|
7
|
+
This version:
|
|
8
|
+
|
|
9
|
+
- adds and removes generators
|
|
10
|
+
- fixes bugs
|
|
11
|
+
- updates dependencies
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
* Simple Japanesemedia::CowboyBebop module by @Ivan-P23994 in https://github.com/faker-ruby/faker/pull/2617
|
|
15
|
+
* added travel folder and airports by @ZionMiller in https://github.com/faker-ruby/faker/pull/2601
|
|
16
|
+
* Spongebob TV show collections by @kleinjm in https://github.com/faker-ruby/faker/pull/2619
|
|
17
|
+
* Add pre-push hook example by @akanshak984 in https://github.com/faker-ruby/faker/pull/2606
|
|
18
|
+
|
|
19
|
+
## Bug fixes
|
|
20
|
+
* fix: ensure generated passwords have correct characters when mix_case & special_characters enabled by @tiff-o in https://github.com/faker-ruby/faker/pull/2533
|
|
21
|
+
* Fix: ensure sport generator produces single sport unless a number of sports is requested by @si-lens in https://github.com/faker-ruby/faker/pull/2616
|
|
22
|
+
* Remove typo in ISSUE_TEMPLATE to check Faker version by @loqimean in https://github.com/faker-ruby/faker/pull/2621
|
|
23
|
+
* Typo in Ukrainian locale, fixes #2620 by @Newman101 in https://github.com/faker-ruby/faker/pull/2622
|
|
24
|
+
* Remove english characters in ja locale file, fixes faker-ruby#2637 by @alextaujenis in https://github.com/faker-ruby/faker/pull/2638
|
|
25
|
+
* Fix country code length for non EN locale by @vbrazo in https://github.com/faker-ruby/faker/pull/2669
|
|
26
|
+
|
|
27
|
+
## What's Changed
|
|
28
|
+
* Removed LoremPixel Files by @uzorjchibuzor in https://github.com/faker-ruby/faker/pull/2664
|
|
29
|
+
* Document IBAN digits validity generator by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2625
|
|
30
|
+
* Create random vehicle vin numbers with the correct check-digit by @alextaujenis in https://github.com/faker-ruby/faker/pull/2633
|
|
31
|
+
* Fix formatting in internet/http.md documentation by @Newman101 in https://github.com/faker-ruby/faker/pull/2647
|
|
32
|
+
* Remove deprecated ru paul documentation by @italopires in https://github.com/faker-ruby/faker/pull/2651
|
|
33
|
+
* Add Ruby as specified language in code block by @luciagirasoles in https://github.com/faker-ruby/faker/pull/2654
|
|
34
|
+
* Fix some typos by @jdufresne in https://github.com/faker-ruby/faker/pull/2662
|
|
35
|
+
* Remove unnecessary executable bit from several files by @jdufresne in https://github.com/faker-ruby/faker/pull/2645
|
|
36
|
+
* Remove broken readme links by @vbrazo in https://github.com/faker-ruby/faker/pull/2668
|
|
37
|
+
* Update minecraft.rb by @lepinejf in https://github.com/faker-ruby/faker/pull/2635
|
|
38
|
+
* Update README and CONTRIBUTING guides by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2630
|
|
39
|
+
* Update dependabot ignore list by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2629
|
|
40
|
+
|
|
41
|
+
## Update local dependencies
|
|
42
|
+
* Update simplecov requirement from = 0.21.0 to = 0.21.2 by @dependabot in https://github.com/faker-ruby/faker/pull/2636
|
|
43
|
+
* Update timecop requirement from = 0.9.5 to = 0.9.6 by @dependabot in https://github.com/faker-ruby/faker/pull/2642
|
|
44
|
+
* Update rubocop-minitest requirement from = 0.23.2 to = 0.25.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2653
|
|
45
|
+
* Update test-unit requirement from = 3.5.6 to = 3.5.7 by @dependabot in https://github.com/faker-ruby/faker/pull/2659
|
|
46
|
+
* Update rubocop requirement from = 1.41.0 to = 1.41.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2667
|
|
47
|
+
|
|
48
|
+
## New Contributors
|
|
49
|
+
* @si-lens made their first contribution in https://github.com/faker-ruby/faker/pull/2616
|
|
50
|
+
* @Ivan-P23994 made their first contribution in https://github.com/faker-ruby/faker/pull/2617
|
|
51
|
+
* @ZionMiller made their first contribution in https://github.com/faker-ruby/faker/pull/2601
|
|
52
|
+
* @loqimean made their first contribution in https://github.com/faker-ruby/faker/pull/2621
|
|
53
|
+
* @kleinjm made their first contribution in https://github.com/faker-ruby/faker/pull/2619
|
|
54
|
+
* @akanshak984 made their first contribution in https://github.com/faker-ruby/faker/pull/2606
|
|
55
|
+
* @lepinejf made their first contribution in https://github.com/faker-ruby/faker/pull/2635
|
|
56
|
+
* @italopires made their first contribution in https://github.com/faker-ruby/faker/pull/2651
|
|
57
|
+
* @luciagirasoles made their first contribution in https://github.com/faker-ruby/faker/pull/2654
|
|
58
|
+
|
|
59
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.0.0...v3.1.0
|
|
60
|
+
|
|
61
|
+
------------------------------------------------------------------------------
|
|
62
|
+
|
|
3
63
|
## [v3.0.0](https://github.com/faker-ruby/faker/tree/v3.0.0) (2022-11-01)
|
|
4
64
|
|
|
5
65
|
### Breaking Changes
|
data/README.md
CHANGED
|
@@ -7,73 +7,106 @@
|
|
|
7
7
|
[](https://codeclimate.com/github/stympy/faker/test_coverage)
|
|
8
8
|
[](https://codeclimate.com/github/stympy/faker/maintainability)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Faker is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker).
|
|
11
|
+
It's a library for generating fake data such as names, addresses, and phone numbers.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
Faker helps you generate realistic test data, and populate your
|
|
14
|
+
database with more than a couple of records while you're doing development.
|
|
15
|
+
|
|
16
|
+
It comes in very handy for taking screenshots (taking screenshots for a personal project)
|
|
17
|
+
and it was the original impetus for the creation of this gem).
|
|
18
|
+
|
|
19
|
+
## Quick links
|
|
20
|
+
|
|
21
|
+
- 📖 **[Read the documentation for the latest version][rubydocs].**
|
|
22
|
+
- 📢 **[See what's changed in recent versions][changelog].**
|
|
23
|
+
|
|
24
|
+
[rubydocs]: https://www.rubydoc.info/gems/faker/
|
|
25
|
+
[changelog]: CHANGELOG.md
|
|
26
|
+
|
|
27
|
+
## Table of Contents
|
|
17
28
|
|
|
18
29
|
- [Faker](#faker)
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
30
|
+
- [Notes](#notes)
|
|
31
|
+
- [Getting Started](#getting-started)
|
|
21
32
|
- [Usage](#usage)
|
|
22
|
-
- [CLI](#cli)
|
|
23
33
|
- [Ensuring unique values](#ensuring-unique-values)
|
|
24
34
|
- [Deterministic Random](#deterministic-random)
|
|
35
|
+
- [Customization](#customization)
|
|
25
36
|
- [Generators](#generators)
|
|
26
|
-
- [Default](#default)
|
|
27
|
-
- [Blockchain](#blockchain)
|
|
28
|
-
- [Books](#books)
|
|
29
|
-
- [Fantasy](#fantasy)
|
|
30
|
-
- [Creature](#creature)
|
|
31
|
-
- [Games](#games)
|
|
32
|
-
- [Japanese Media](#japanese-media)
|
|
33
|
-
- [Movies](#movies)
|
|
34
|
-
- [Music](#music)
|
|
35
|
-
- [Quotes](#quotes)
|
|
36
|
-
- [Sports](#sports)
|
|
37
|
-
- [Tv Shows](#tv-shows)
|
|
38
|
-
- [Customization](#customization)
|
|
39
37
|
- [Contributing](#contributing)
|
|
40
|
-
- [
|
|
38
|
+
- [Versioning](#versioning)
|
|
41
39
|
- [License](#license)
|
|
42
40
|
|
|
43
|
-
###
|
|
41
|
+
### Notes
|
|
42
|
+
|
|
44
43
|
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
|
|
45
|
-
|
|
46
|
-
Values also can be deterministic if you use the deterministic feature, see [
|
|
47
|
-
* Minitest and Faker >= 2.22 users might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
|
48
|
-
`Faker::Config.random = Random.new`. See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
|
44
|
+
To explicitly specify when you require unique values, see [Ensuring Unique Values](#ensuring-unique-values).
|
|
45
|
+
Values also can be deterministic if you use the deterministic feature, see [Deterministic Random](#deterministic-random)
|
|
49
46
|
* This is the `main` branch of Faker and may contain changes that are not yet released.
|
|
50
|
-
Please refer the README of your version for the available methods.
|
|
51
|
-
|
|
47
|
+
Please refer to the README of your version for the available methods.
|
|
48
|
+
The list of all versions is [available here](https://github.com/stympy/faker/releases).
|
|
52
49
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
Note: if you are getting a `uninitialized constant Faker::[some_class]` error, your version of the gem is behind the one documented here. To make sure that your gem is the one documented here, change the line in your Gemfile to:
|
|
50
|
+
## Getting Started
|
|
51
|
+
|
|
52
|
+
Start by including `faker` in your Gemfile:
|
|
58
53
|
|
|
59
54
|
```ruby
|
|
60
|
-
gem 'faker'
|
|
55
|
+
gem 'faker'
|
|
61
56
|
```
|
|
62
57
|
|
|
58
|
+
Then run `bundle install`.
|
|
59
|
+
|
|
63
60
|
## Usage
|
|
61
|
+
|
|
62
|
+
Here are some examples of how to use Faker:
|
|
63
|
+
|
|
64
64
|
```ruby
|
|
65
65
|
require 'faker'
|
|
66
66
|
|
|
67
67
|
Faker::Name.name #=> "Christophe Bartell"
|
|
68
68
|
|
|
69
|
-
Faker::
|
|
69
|
+
Faker::Address.full_address #=> "5479 William Way, East Sonnyhaven, LA 63637"
|
|
70
|
+
|
|
71
|
+
Faker::Markdown.emphasis #=> "Quo qui aperiam. Amet corrupti distinctio. Sit quia *dolor.*"
|
|
72
|
+
|
|
73
|
+
Faker::TvShows::RuPaul.queen #=> "Violet Chachki"
|
|
74
|
+
|
|
75
|
+
Faker::Alphanumeric.alpha(number: 10) #=> "zlvubkrwga"
|
|
76
|
+
|
|
77
|
+
Faker::ProgrammingLanguage.name #=> "Ruby"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For a complete list of the generators, see [Generators](#generators).
|
|
81
|
+
|
|
82
|
+
#### A note about the Generators versions
|
|
83
|
+
|
|
84
|
+
If you get a `uninitialized constant Faker::[some_class]` error, your version of
|
|
85
|
+
the gem is behind main.
|
|
86
|
+
|
|
87
|
+
To make sure that your gem is the one
|
|
88
|
+
documented here, change the line in your Gemfile to:
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
|
70
92
|
```
|
|
71
93
|
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
The generators have the `@faker.version` tag on top of their implementation.
|
|
95
|
+
From the tags, you can identify the version the generator was added:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# Faker::TvShows::ParksAndRec.character
|
|
99
|
+
|
|
100
|
+
# @faker.version 1.9.0
|
|
101
|
+
def character
|
|
102
|
+
fetch('parks_and_rec.characters')
|
|
103
|
+
end
|
|
104
|
+
```
|
|
74
105
|
|
|
75
106
|
### Ensuring unique values
|
|
76
|
-
|
|
107
|
+
|
|
108
|
+
To ensure Faker generates unique values, prefix your method call with `unique`:
|
|
109
|
+
|
|
77
110
|
```ruby
|
|
78
111
|
Faker::Name.unique.name # This will return a unique name every time it is called
|
|
79
112
|
```
|
|
@@ -82,6 +115,7 @@ If too many unique values are requested from a generator that has a limited
|
|
|
82
115
|
number of potential values, a `Faker::UniqueGenerator::RetryLimitExceeded`
|
|
83
116
|
exception may be raised. It is possible to clear the record of unique values
|
|
84
117
|
that have been returned, for example between tests.
|
|
118
|
+
|
|
85
119
|
```ruby
|
|
86
120
|
Faker::Name.unique.clear # Clears used values for Faker::Name
|
|
87
121
|
Faker::UniqueGenerator.clear # Clears used values for all generators
|
|
@@ -100,7 +134,9 @@ Faker::Lorem.unique.exclude :string, [number: 6], %w[azerty wxcvbn]
|
|
|
100
134
|
```
|
|
101
135
|
|
|
102
136
|
### Deterministic Random
|
|
103
|
-
|
|
137
|
+
|
|
138
|
+
Faker supports seeding of its pseudo-random number generator (PRNG)
|
|
139
|
+
to provide deterministic output of repeated method calls.
|
|
104
140
|
|
|
105
141
|
```ruby
|
|
106
142
|
Faker::Config.random = Random.new(42)
|
|
@@ -115,14 +151,49 @@ Faker::Config.random.seed #=> 185180369676275068918401850258677722187
|
|
|
115
151
|
Faker::Company.bs #=> "cultivate viral synergies"
|
|
116
152
|
```
|
|
117
153
|
|
|
154
|
+
### Customization
|
|
155
|
+
|
|
156
|
+
You may want Faker to print information depending on your location in the world.
|
|
157
|
+
To assist you in this, Faker uses the `I18n` gem to store strings and formats to
|
|
158
|
+
represent the names and postal codes of the area of your choosing.
|
|
159
|
+
|
|
160
|
+
Just set the locale you want as shown below, and Faker will take care of the rest.
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
Faker::Config.locale = 'es'
|
|
164
|
+
# or
|
|
165
|
+
Faker::Config.locale = :es
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Note: Overriding the default locale might not be thread-safe. See [Locale setting can be ignored #2563](https://github.com/faker-ruby/faker/issues/2563) for more details.
|
|
169
|
+
|
|
170
|
+
To override Faker's locales,
|
|
171
|
+
check out the [locales README](lib/locales/README.md).
|
|
172
|
+
|
|
173
|
+
### Minitest and Faker >= 2.22
|
|
174
|
+
|
|
175
|
+
To prevent Faker (version >= 2.22) from generating duplicate values when using Minitest,
|
|
176
|
+
you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
|
177
|
+
|
|
178
|
+
```ruby
|
|
179
|
+
Faker::Config.random = Random.new
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
See [Issue #2534](https://github.com/faker-ruby/faker/issues/2534) for more details.
|
|
183
|
+
|
|
118
184
|
## Generators
|
|
185
|
+
|
|
186
|
+
This is the full list of generators available with this gem. If you need details about any of them, make sure to consult the documentation.
|
|
187
|
+
|
|
119
188
|
**NOTE: Some of the generators below aren't released yet. If you want to use them, change the line in your gemfile to:**
|
|
120
189
|
|
|
121
190
|
```ruby
|
|
122
191
|
gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main'
|
|
123
192
|
```
|
|
124
193
|
|
|
125
|
-
|
|
194
|
+
<details>
|
|
195
|
+
<summary>Default</summary>
|
|
196
|
+
|
|
126
197
|
- [Faker::Address](doc/default/address.md)
|
|
127
198
|
- [Faker::Alphanumeric](doc/default/alphanumeric.md)
|
|
128
199
|
- [Faker::Ancient](doc/default/ancient.md)
|
|
@@ -185,7 +256,6 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
185
256
|
- [Faker::Kpop](doc/default/kpop.md)
|
|
186
257
|
- [Faker::Lorem](doc/default/lorem.md)
|
|
187
258
|
- [Faker::LoremFlickr](doc/default/lorem_flickr.md)
|
|
188
|
-
- [Faker::LoremPixel](doc/default/lorem_pixel.md)
|
|
189
259
|
- [Faker::Markdown](doc/default/markdown.md)
|
|
190
260
|
- [Faker::Marketing](doc/default/marketing.md)
|
|
191
261
|
- [Faker::Measurement](doc/default/measurement.md)
|
|
@@ -221,31 +291,46 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
221
291
|
- [Faker::Verbs](doc/default/verbs.md)
|
|
222
292
|
- [Faker::VulnerabilityIdentifier](doc/default/vulnerability_identifier.md)
|
|
223
293
|
- [Faker::WorldCup](doc/default/world_cup.md)
|
|
294
|
+
</details>
|
|
295
|
+
|
|
296
|
+
<details>
|
|
297
|
+
<summary>Blockchain</summary>
|
|
224
298
|
|
|
225
|
-
### Blockchain
|
|
226
299
|
- [Faker::Blockchain::Aeternity](doc/blockchain/aeternity.md)
|
|
227
300
|
- [Faker::Blockchain::Bitcoin](doc/blockchain/bitcoin.md)
|
|
228
301
|
- [Faker::Blockchain::Ethereum](doc/blockchain/ethereum.md)
|
|
229
302
|
- [Faker::Blockchain::Tezos](doc/blockchain/tezos.md)
|
|
303
|
+
</details>
|
|
304
|
+
|
|
305
|
+
<details>
|
|
306
|
+
<summary>Books</summary>
|
|
230
307
|
|
|
231
|
-
### Books
|
|
232
308
|
- [Faker::Book](doc/books/book.md)
|
|
233
309
|
- [Faker::Books::CultureSeries](doc/books/culture_series.md)
|
|
234
310
|
- [Faker::Books::Dune](doc/books/dune.md)
|
|
235
311
|
- [Faker::Books::Lovecraft](doc/books/lovecraft.md)
|
|
236
312
|
- [Faker::Books::TheKingkillerChronicle](doc/books/the_kingkiller_chronicle.md)
|
|
313
|
+
</details>
|
|
314
|
+
|
|
315
|
+
<details>
|
|
316
|
+
<summary>Fantasy</summary>
|
|
237
317
|
|
|
238
|
-
### Fantasy
|
|
239
318
|
- [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
|
|
319
|
+
</details>
|
|
320
|
+
|
|
321
|
+
<details>
|
|
322
|
+
<summary>Creature</summary>
|
|
240
323
|
|
|
241
|
-
### Creature
|
|
242
324
|
- [Faker::Creature::Animal](doc/creature/animal.md)
|
|
243
325
|
- [Faker::Creature::Bird](doc/creature/bird.md)
|
|
244
326
|
- [Faker::Creature::Cat](doc/creature/cat.md)
|
|
245
327
|
- [Faker::Creature::Dog](doc/creature/dog.md)
|
|
246
328
|
- [Faker::Creature::Horse](doc/creature/horse.md)
|
|
329
|
+
</details>
|
|
330
|
+
|
|
331
|
+
<details>
|
|
332
|
+
<summary>Games</summary>
|
|
247
333
|
|
|
248
|
-
### Games
|
|
249
334
|
- [Faker::Game](doc/games/game.md)
|
|
250
335
|
- [Faker::Games::ClashOfClans](doc/games/clash_of_clans.md)
|
|
251
336
|
- [Faker::Games::DnD](doc/games/dnd.md)
|
|
@@ -269,8 +354,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
269
354
|
- [Faker::Games::Witcher](doc/games/witcher.md)
|
|
270
355
|
- [Faker::Games::WorldOfWarcraft](doc/games/world_of_warcraft.md)
|
|
271
356
|
- [Faker::Games::Zelda](doc/games/zelda.md)
|
|
357
|
+
</details>
|
|
358
|
+
|
|
359
|
+
<details>
|
|
360
|
+
<summary>Japanese Media</summary>
|
|
272
361
|
|
|
273
|
-
|
|
362
|
+
- [Faker::JapaneseMedia::CowboyBebop](doc/japanese_media/cowboy_bebop.md)
|
|
274
363
|
- [Faker::JapaneseMedia::DragonBall](doc/japanese_media/dragon_ball.md)
|
|
275
364
|
- [Faker::JapaneseMedia::OnePiece](doc/japanese_media/one_piece.md)
|
|
276
365
|
- [Faker::JapaneseMedia::StudioGhibli](doc/japanese_media/studio_ghibli.md)
|
|
@@ -279,8 +368,11 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
279
368
|
- [Faker::JapaneseMedia::Doraemon](doc/japanese_media/doraemon.md)
|
|
280
369
|
- [Faker::JapaneseMedia::Conan](doc/japanese_media/conan.md)
|
|
281
370
|
- [Faker::JapaneseMedia::FmaBrotherhood](doc/japanese_media/fullmetal_alchemist_brotherhood.md)
|
|
371
|
+
</details>
|
|
372
|
+
|
|
373
|
+
<details>
|
|
374
|
+
<summary>Movies</summary>
|
|
282
375
|
|
|
283
|
-
### Movies
|
|
284
376
|
- [Faker::Movie](doc/movies/movie.md)
|
|
285
377
|
- [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
|
|
286
378
|
- [Faker::Movies::Departed](doc/movies/departed.md)
|
|
@@ -295,8 +387,11 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
295
387
|
- [Faker::Movies::StarWars](doc/movies/star_wars.md)
|
|
296
388
|
- [Faker::Movies::TRON](doc/movies/tron.md)
|
|
297
389
|
- [Faker::Movies::VForVendetta](doc/movies/v_for_vendetta.md)
|
|
390
|
+
</details>
|
|
391
|
+
|
|
392
|
+
<details>
|
|
393
|
+
<summary>Music</summary>
|
|
298
394
|
|
|
299
|
-
### Music
|
|
300
395
|
- [Faker::Music](doc/music/music.md)
|
|
301
396
|
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
|
302
397
|
- [Faker::Music::Hiphop](doc/music/hiphop.md)
|
|
@@ -307,22 +402,30 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
307
402
|
- [Faker::Music::RockBand](doc/music/rock_band.md)
|
|
308
403
|
- [Faker::Music::Rush](doc/music/rush.md)
|
|
309
404
|
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
|
|
405
|
+
</details>
|
|
406
|
+
|
|
407
|
+
<details>
|
|
408
|
+
<summary>Quotes</summary>
|
|
310
409
|
|
|
311
|
-
### Quotes
|
|
312
410
|
- [Faker::Quote](doc/quotes/quote.md)
|
|
313
411
|
- [Faker::Quotes::Chiquito](doc/quotes/chiquito.md)
|
|
314
412
|
- [Faker::Quotes::Rajnikanth](doc/quotes/rajnikanth.md)
|
|
315
413
|
- [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
|
|
414
|
+
</details>
|
|
316
415
|
|
|
416
|
+
<details>
|
|
417
|
+
<summary>Sports</summary>
|
|
317
418
|
|
|
318
|
-
### Sports
|
|
319
419
|
- [Faker::Sports](doc/sports/sports.md)
|
|
320
420
|
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
|
321
421
|
- [Faker::Sports::Football](doc/sports/football.md)
|
|
322
422
|
- [Faker::Sports::Mountaineering](doc/sports/mountaineering.md)
|
|
323
423
|
- [Faker::Sports::Volleyball](doc/sports/volleyball.md)
|
|
424
|
+
</details>
|
|
425
|
+
|
|
426
|
+
<details>
|
|
427
|
+
<summary>Tv Shows</summary>
|
|
324
428
|
|
|
325
|
-
### Tv Shows
|
|
326
429
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
|
327
430
|
- [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
|
|
328
431
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
|
@@ -347,6 +450,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
347
450
|
- [Faker::TvShows::SiliconValley](doc/tv_shows/silicon_valley.md)
|
|
348
451
|
- [Faker::TvShows::Simpsons](doc/tv_shows/simpsons.md)
|
|
349
452
|
- [Faker::TvShows::SouthPark](doc/tv_shows/south_park.md)
|
|
453
|
+
- [Faker::TvShows::Spongebob](doc/tv_shows/spongebob.md)
|
|
350
454
|
- [Faker::TvShows::StarTrek](doc/tv_shows/star_trek.md)
|
|
351
455
|
- [Faker::TvShows::Stargate](doc/tv_shows/stargate.md)
|
|
352
456
|
- [Faker::TvShows::StrangerThings](doc/tv_shows/stranger_things.md)
|
|
@@ -358,59 +462,25 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
|
358
462
|
- [Faker::TvShows::TheThickOfIt](doc/tv_shows/the_thick_of_it.md)
|
|
359
463
|
- [Faker::TvShows::TwinPeaks](doc/tv_shows/twin_peaks.md)
|
|
360
464
|
- [Faker::TvShows::VentureBros](doc/tv_shows/venture_bros.md)
|
|
465
|
+
</details>
|
|
361
466
|
|
|
362
|
-
##
|
|
363
|
-
You may want Faker to print information depending on your location in the world.
|
|
364
|
-
To assist you in this, Faker uses I18n gem to store strings and formats to
|
|
365
|
-
represent the names and postal codes of the area of your choosing.
|
|
366
|
-
Just set the locale you want as shown below, and Faker will take care of the rest.
|
|
467
|
+
## Contributing
|
|
367
468
|
|
|
368
|
-
|
|
369
|
-
Faker::Config.locale = 'es'
|
|
370
|
-
# or
|
|
371
|
-
Faker::Config.locale = :es
|
|
372
|
-
```
|
|
469
|
+
If you have problems, please create a [GitHub Issue](/.github/ISSUE_TEMPLATE/bug-report.md).
|
|
373
470
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
```yaml
|
|
379
|
-
en-au-ocker:
|
|
380
|
-
faker:
|
|
381
|
-
name:
|
|
382
|
-
# Existing faker field, new data
|
|
383
|
-
first_name:
|
|
384
|
-
- Charlotte
|
|
385
|
-
- Ava
|
|
386
|
-
- Chloe
|
|
387
|
-
- Emily
|
|
388
|
-
|
|
389
|
-
# New faker fields
|
|
390
|
-
ocker_first_name:
|
|
391
|
-
- Bazza
|
|
392
|
-
- Bluey
|
|
393
|
-
- Davo
|
|
394
|
-
- Johno
|
|
395
|
-
- Shano
|
|
396
|
-
- Shazza
|
|
397
|
-
region:
|
|
398
|
-
- South East Queensland
|
|
399
|
-
- Wide Bay Burnett
|
|
400
|
-
- Margaret River
|
|
401
|
-
- Port Pirie
|
|
402
|
-
- Gippsland
|
|
403
|
-
- Elizabeth
|
|
404
|
-
- Barossa
|
|
405
|
-
```
|
|
471
|
+
Take a look at the [Contributing](CONTRIBUTING.md) document for
|
|
472
|
+
instructions on setting up the repo on your machine, understanding the codebase,
|
|
473
|
+
and creating a good pull request.
|
|
406
474
|
|
|
407
|
-
|
|
408
|
-
|
|
475
|
+
There is a [Discord channel](https://discord.gg/RMumTwB) to discuss anything
|
|
476
|
+
regarding improvements or feature requests.
|
|
409
477
|
|
|
410
|
-
|
|
411
|
-
Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
|
|
478
|
+
Thank you, contributors!
|
|
412
479
|
|
|
413
|
-
|
|
480
|
+
## Versioning
|
|
481
|
+
|
|
482
|
+
Faker follows Semantic Versioning 2.0 as defined at https://semver.org.
|
|
414
483
|
|
|
415
484
|
## License
|
|
485
|
+
|
|
416
486
|
This code is free to use under the terms of the MIT license.
|
data/lib/faker/default/code.rb
CHANGED
data/lib/faker/default/drone.rb
CHANGED
data/lib/faker/default/food.rb
CHANGED
|
@@ -147,37 +147,48 @@ module Faker
|
|
|
147
147
|
#
|
|
148
148
|
# @faker.version 2.1.3
|
|
149
149
|
def password(min_length: 8, max_length: 16, mix_case: true, special_characters: false)
|
|
150
|
-
raise ArgumentError, '
|
|
150
|
+
raise ArgumentError, 'max_length must be more than min_length' if max_length < min_length
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
diff_length = max_length - min_length
|
|
155
|
-
|
|
156
|
-
if diff_length.positive?
|
|
157
|
-
diff_rand = rand(diff_length + 1)
|
|
158
|
-
temp += Lorem.characters(number: diff_rand)
|
|
159
|
-
end
|
|
152
|
+
character_types = []
|
|
153
|
+
required_min_length = 0
|
|
160
154
|
|
|
161
155
|
if mix_case
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if char =~ /[[:alpha:]]/
|
|
165
|
-
temp[index] = char.upcase if alpha_count.even?
|
|
166
|
-
alpha_count += 1
|
|
167
|
-
end
|
|
168
|
-
end
|
|
156
|
+
character_types << :mix_case
|
|
157
|
+
required_min_length += 2
|
|
169
158
|
end
|
|
170
159
|
|
|
171
160
|
if special_characters
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
161
|
+
character_types << :special_characters
|
|
162
|
+
required_min_length += 1
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
raise ArgumentError, "min_length should be at least #{required_min_length} to enable #{character_types.join(', ')} configuration" if min_length < required_min_length
|
|
166
|
+
|
|
167
|
+
target_length = rand(min_length..max_length)
|
|
168
|
+
|
|
169
|
+
password = []
|
|
170
|
+
character_bag = []
|
|
171
|
+
|
|
172
|
+
# use lower_chars by default and add upper_chars if mix_case
|
|
173
|
+
lower_chars = ('a'..'z').to_a
|
|
174
|
+
password << lower_chars[rand(lower_chars.count - 1)]
|
|
175
|
+
character_bag += lower_chars
|
|
176
|
+
|
|
177
|
+
if character_types.include?(:mix_case)
|
|
178
|
+
upper_chars = ('A'..'Z').to_a
|
|
179
|
+
password << upper_chars[rand(upper_chars.count - 1)]
|
|
180
|
+
character_bag += upper_chars
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if character_types.include?(:special_characters)
|
|
184
|
+
special_chars = %w[! @ # $ % ^ & *]
|
|
185
|
+
password << special_chars[rand(special_chars.count - 1)]
|
|
186
|
+
character_bag += special_chars
|
|
176
187
|
end
|
|
177
188
|
|
|
178
|
-
|
|
189
|
+
password << character_bag[rand(character_bag.count - 1)] while password.length < target_length
|
|
179
190
|
|
|
180
|
-
|
|
191
|
+
shuffle(password).join
|
|
181
192
|
end
|
|
182
193
|
|
|
183
194
|
##
|