faker 3.3.1 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/README.md +11 -3
- data/lib/faker/books/lovecraft.rb +2 -3
- data/lib/faker/default/crypto.rb +13 -4
- data/lib/faker/default/hipster.rb +2 -3
- data/lib/faker/default/internet.rb +5 -2
- data/lib/faker/default/lorem.rb +1 -1
- data/lib/faker/default/number.rb +1 -1
- data/lib/faker/default/omniauth.rb +4 -4
- data/lib/faker/default/types.rb +2 -4
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en/address.yml +1 -1
- data/lib/locales/en/food.yml +2 -1
- data/lib/locales/ja/football.yml +115 -0
- data/lib/locales/ko.yml +1361 -20
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8af27d99c348c9ae7dc6d06e29566ba78ca5b7f38639697d17dcb4a8403e0497
|
4
|
+
data.tar.gz: bd07375b615d5440b35e6c903a2ca68afcaecb8d0caed7eddac5e2a7d0c34946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b54896707a3b7cd26bed81a5ee99af3e0d7cba59814f977c27d308ade1d56ba7670b83e4404982f1e51d1e42b9e8c229619e0737cd27c44a6922c6798084e04
|
7
|
+
data.tar.gz: 13c40edb228c8bdbbc5ac704775762dc19794c006a6ccd8d75dc7c3528ae19245a7163be4ffe213d11ae99529ad297a1b2ba356dd5ade3c500fa72312db04308
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.4.1](https://github.com/faker-ruby/faker/tree/v3.4.1) (2024-05-28)
|
4
|
+
|
5
|
+
### What's changed
|
6
|
+
|
7
|
+
* Performance: Sample arrays instead of performing shuffle and slice by @alextaujenis in https://github.com/faker-ruby/faker/pull/2940
|
8
|
+
* Performance: Reduce the time complexity of `Faker::Crypto` generators by @alextaujenis in https://github.com/faker-ruby/faker/pull/2938
|
9
|
+
* Remove tzinfo dependency by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2952
|
10
|
+
|
11
|
+
### Bug fixes
|
12
|
+
|
13
|
+
* Fix invalid IANA time zone identifier for `Atlantic/Cape_Verde` by @andrelaszlo in https://github.com/faker-ruby/faker/pull/2927
|
14
|
+
* Fix entry in faker.food.ingredients by @matthewmayer in https://github.com/faker-ruby/faker/pull/2933
|
15
|
+
* Docs: add absolute links to CONTRIBUTING from README by @matthewmayer in https://github.com/faker-ruby/faker/pull/2934
|
16
|
+
* Fix: `Faker::Number.hexadecimal` should include characters within the range of `[0-9a-f]` by @alextaujenis in https://github.com/faker-ruby/faker/pull/2942
|
17
|
+
* Username splits names by space and doesn't regex match them by @keshavbiswa in https://github.com/faker-ruby/faker/pull/2950
|
18
|
+
|
19
|
+
### Features
|
20
|
+
|
21
|
+
* Add animals, desserts, foods, hobbies, house, and k-pop translations to the Korean locale file by @connie-feng in https://github.com/faker-ruby/faker/pull/2935
|
22
|
+
* Add adjectives to Korean locale file by @connie-feng in https://github.com/faker-ruby/faker/pull/2930
|
23
|
+
* Add emotions, movies, Pokemon, and Studio Ghibli to the Korean locale by @connie-feng in https://github.com/faker-ruby/faker/pull/2941
|
24
|
+
* Add Japanese translations for `Faker::Sports::Football`. by @yamat47 in https://github.com/faker-ruby/faker/pull/2903
|
25
|
+
|
26
|
+
### Update local dependencies
|
27
|
+
|
28
|
+
* Bump rake from 13.1.0 to 13.2.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2929
|
29
|
+
* Bump i18n from 1.14.4 to 1.14.5 by @dependabot in https://github.com/faker-ruby/faker/pull/2949
|
30
|
+
* Bump minitest from 5.22.3 to 5.23.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2957
|
31
|
+
* Bump rubocop from 1.63.4 to 1.64.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2958
|
32
|
+
|
33
|
+
## New Contributors
|
34
|
+
|
35
|
+
* @connie-feng made their first contribution in https://github.com/faker-ruby/faker/pull/2930
|
36
|
+
* @andrelaszlo made their first contribution in https://github.com/faker-ruby/faker/pull/2927
|
37
|
+
* @matthewmayer made their first contribution in https://github.com/faker-ruby/faker/pull/2933
|
38
|
+
|
39
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.3.1...v.3.4.1
|
40
|
+
|
41
|
+
---------------------------------
|
42
|
+
|
3
43
|
## [v3.3.1](https://github.com/faker-ruby/faker/tree/v3.3.1) (2024-04-02)
|
4
44
|
|
5
45
|
### Bug fixes
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Faker helps you generate realistic test data, and populate your
|
|
14
14
|
database with more than a couple of records while you're doing development.
|
15
15
|
|
16
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
|
17
|
+
and it was the original impetus for the creation of this gem.
|
18
18
|
|
19
19
|
## Quick links
|
20
20
|
|
@@ -24,6 +24,14 @@ and it was the original impetus for the creation of this gem).
|
|
24
24
|
[rubydocs]: https://www.rubydoc.info/gems/faker/
|
25
25
|
[changelog]: CHANGELOG.md
|
26
26
|
|
27
|
+
## In the media
|
28
|
+
|
29
|
+
- 📰 [With Great Humor Comes Great Developer Engagement] - KTH Royal Institute of Technology research
|
30
|
+
- 🎧 [Computer und Kommunikation 4.5.2024, komplette Sendung] - Deutschland Funk Radio Interview
|
31
|
+
|
32
|
+
[With Great Humor Comes Great Developer Engagement]: https://arxiv.org/pdf/2312.01680
|
33
|
+
[Computer und Kommunikation 4.5.2024, komplette Sendung]: https://www.deutschlandfunk.de/computer-und-kommunikation-4-5-2024-komplette-sendung-dlf-16492b03-100.html
|
34
|
+
|
27
35
|
## Table of Contents
|
28
36
|
|
29
37
|
- [Faker](#faker)
|
@@ -486,9 +494,9 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'main
|
|
486
494
|
|
487
495
|
## Contributing
|
488
496
|
|
489
|
-
**Note**: We are not accepting proposals for new generators and locales. The [Contributing](CONTRIBUTING.md) guide has a few notes about this decision.
|
497
|
+
**Note**: We are not accepting proposals for new generators and locales. The [Contributing](https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md) guide has a few notes about this decision.
|
490
498
|
|
491
|
-
Take a look at the [Contributing](CONTRIBUTING.md) document for
|
499
|
+
Take a look at the [Contributing](https://github.com/faker-ruby/faker/blob/main/CONTRIBUTING.md) document for
|
492
500
|
instructions on setting up the repo on your machine, opening bug reports, understanding the codebase,
|
493
501
|
and creating a good pull request.
|
494
502
|
|
@@ -133,10 +133,9 @@ module Faker
|
|
133
133
|
resolved_num = resolve(number)
|
134
134
|
word_list = translate('faker.lovecraft.words')
|
135
135
|
word_list *= ((resolved_num / word_list.length) + 1)
|
136
|
+
words = sample(word_list, resolved_num)
|
137
|
+
return words if spaces_allowed
|
136
138
|
|
137
|
-
return shuffle(word_list)[0, resolved_num] if spaces_allowed
|
138
|
-
|
139
|
-
words = shuffle(word_list)[0, resolved_num]
|
140
139
|
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
|
141
140
|
end
|
142
141
|
|
data/lib/faker/default/crypto.rb
CHANGED
@@ -5,6 +5,15 @@ require 'openssl'
|
|
5
5
|
module Faker
|
6
6
|
class Crypto < Base
|
7
7
|
class << self
|
8
|
+
# Setting the lorem character number lower than the default of
|
9
|
+
# 255 reduces the time complexity of each hash algorithm while
|
10
|
+
# still returning deterministically unique values. See
|
11
|
+
# https://github.com/faker-ruby/faker/pull/2938 for more info.
|
12
|
+
MD5_MIN_NUMBER_OF_CHARACTERS = 25
|
13
|
+
SHA1_MIN_NUMBER_OF_CHARACTERS = 31
|
14
|
+
SHA256_MIN_NUMBER_OF_CHARACTERS = 50
|
15
|
+
SHA512_MIN_NUMBER_OF_CHARACTERS = 100
|
16
|
+
|
8
17
|
##
|
9
18
|
# Produces an MD5 hash.
|
10
19
|
#
|
@@ -15,7 +24,7 @@ module Faker
|
|
15
24
|
#
|
16
25
|
# @faker.version 1.6.4
|
17
26
|
def md5
|
18
|
-
OpenSSL::Digest::MD5.hexdigest(Lorem.characters)
|
27
|
+
OpenSSL::Digest::MD5.hexdigest(Lorem.characters(number: MD5_MIN_NUMBER_OF_CHARACTERS))
|
19
28
|
end
|
20
29
|
|
21
30
|
##
|
@@ -28,7 +37,7 @@ module Faker
|
|
28
37
|
#
|
29
38
|
# @faker.version 1.6.4
|
30
39
|
def sha1
|
31
|
-
OpenSSL::Digest::SHA1.hexdigest(Lorem.characters)
|
40
|
+
OpenSSL::Digest::SHA1.hexdigest(Lorem.characters(number: SHA1_MIN_NUMBER_OF_CHARACTERS))
|
32
41
|
end
|
33
42
|
|
34
43
|
##
|
@@ -41,7 +50,7 @@ module Faker
|
|
41
50
|
#
|
42
51
|
# @faker.version 1.6.4
|
43
52
|
def sha256
|
44
|
-
OpenSSL::Digest::SHA256.hexdigest(Lorem.characters)
|
53
|
+
OpenSSL::Digest::SHA256.hexdigest(Lorem.characters(number: SHA256_MIN_NUMBER_OF_CHARACTERS))
|
45
54
|
end
|
46
55
|
|
47
56
|
##
|
@@ -54,7 +63,7 @@ module Faker
|
|
54
63
|
#
|
55
64
|
# @faker.version next
|
56
65
|
def sha512
|
57
|
-
OpenSSL::Digest::SHA512.hexdigest(Lorem.characters)
|
66
|
+
OpenSSL::Digest::SHA512.hexdigest(Lorem.characters(number: SHA512_MIN_NUMBER_OF_CHARACTERS))
|
58
67
|
end
|
59
68
|
end
|
60
69
|
end
|
@@ -39,10 +39,9 @@ module Faker
|
|
39
39
|
(supplemental ? translate('faker.lorem.words') : [])
|
40
40
|
)
|
41
41
|
word_list *= ((resolved_num / word_list.length) + 1)
|
42
|
+
words = sample(word_list, resolved_num)
|
43
|
+
return words if spaces_allowed
|
42
44
|
|
43
|
-
return shuffle(word_list)[0, resolved_num] if spaces_allowed
|
44
|
-
|
45
|
-
words = shuffle(word_list)[0, resolved_num]
|
46
45
|
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
|
47
46
|
end
|
48
47
|
|
@@ -63,9 +63,12 @@ module Faker
|
|
63
63
|
# Faker::Internet.username(specifier: 20, separators: ['_']) #=> "nikki_sawaynnikki_saway"
|
64
64
|
def username(specifier: nil, separators: %w[. _])
|
65
65
|
with_locale(:en) do
|
66
|
-
return shuffle(specifier.scan(/[[:word:]]+/)).join(sample(separators)).downcase if specifier.respond_to?(:scan)
|
67
|
-
|
68
66
|
case specifier
|
67
|
+
when ::String
|
68
|
+
names = specifier&.gsub("'", '')&.split
|
69
|
+
shuffled_names = shuffle(names)
|
70
|
+
|
71
|
+
return shuffled_names.join(sample(separators)).downcase
|
69
72
|
when Integer
|
70
73
|
# If specifier is Integer and has large value, Argument error exception is raised to overcome memory full error
|
71
74
|
raise ArgumentError, 'Given argument is too large' if specifier > 10**6
|
data/lib/faker/default/lorem.rb
CHANGED
data/lib/faker/default/number.rb
CHANGED
@@ -444,11 +444,11 @@ module Faker
|
|
444
444
|
private
|
445
445
|
|
446
446
|
def gender
|
447
|
-
|
447
|
+
sample(%w[male female])
|
448
448
|
end
|
449
449
|
|
450
450
|
def timezone
|
451
|
-
|
451
|
+
sample((-12..12).to_a)
|
452
452
|
end
|
453
453
|
|
454
454
|
def image
|
@@ -460,11 +460,11 @@ module Faker
|
|
460
460
|
end
|
461
461
|
|
462
462
|
def random_number_from_range(range)
|
463
|
-
|
463
|
+
sample(range.to_a)
|
464
464
|
end
|
465
465
|
|
466
466
|
def random_boolean
|
467
|
-
|
467
|
+
sample([true, false])
|
468
468
|
end
|
469
469
|
end
|
470
470
|
end
|
data/lib/faker/default/types.rb
CHANGED
@@ -18,11 +18,9 @@ module Faker
|
|
18
18
|
# @faker.version 1.8.6
|
19
19
|
def rb_string(words: 1)
|
20
20
|
resolved_num = resolve(words)
|
21
|
-
word_list =
|
22
|
-
translate('faker.lorem.words')
|
23
|
-
|
21
|
+
word_list = translate('faker.lorem.words')
|
24
22
|
word_list *= ((resolved_num / word_list.length) + 1)
|
25
|
-
|
23
|
+
sample(word_list, resolved_num).join(' ')
|
26
24
|
end
|
27
25
|
|
28
26
|
##
|
data/lib/faker/version.rb
CHANGED
data/lib/locales/en/address.yml
CHANGED
data/lib/locales/en/food.yml
CHANGED
@@ -0,0 +1,115 @@
|
|
1
|
+
ja:
|
2
|
+
faker:
|
3
|
+
football:
|
4
|
+
teams:
|
5
|
+
- レアル・マドリード
|
6
|
+
- FCバルセロナ
|
7
|
+
- バレンシアCF
|
8
|
+
- アトレティコ・マドリード
|
9
|
+
- マンチェスター・ユナイテッド
|
10
|
+
- チェルシー
|
11
|
+
- リヴァプール
|
12
|
+
- アーセナル
|
13
|
+
- トッテナム・ホットスパー
|
14
|
+
- ACミラン
|
15
|
+
- インテル・ミラノ
|
16
|
+
- ASローマ
|
17
|
+
- ユヴェントス
|
18
|
+
- バイエルン・ミュンヘン
|
19
|
+
- ボルシア・ドルトムント
|
20
|
+
- シャルケ04
|
21
|
+
- ベンフィカ
|
22
|
+
- ガラタサライ
|
23
|
+
- PSVアイントホーフェン
|
24
|
+
- LAギャラクシー
|
25
|
+
- パリ・サンジェルマン
|
26
|
+
players:
|
27
|
+
- リオネル・メッシ
|
28
|
+
- ジェラール・ピケ
|
29
|
+
- セルヒオ・ラモス
|
30
|
+
- クリスティアーノ・ロナウド
|
31
|
+
- ダビド・デ・ヘア
|
32
|
+
- ポール・ポグバ
|
33
|
+
- アントワーヌ・グリーズマン
|
34
|
+
- アルバロ・モラタ
|
35
|
+
- アンドレス・イニエスタ
|
36
|
+
- ロベルト・フィルミーノ
|
37
|
+
- モハメド・サラー
|
38
|
+
- ハリー・ケイン
|
39
|
+
- デレ・アリ
|
40
|
+
- アリエン・ロッベン
|
41
|
+
- フランク・リベリー
|
42
|
+
- マルコ・ロイス
|
43
|
+
- ロベルト・レヴァンドフスキ
|
44
|
+
- ズラタン・イブラヒモビッチ
|
45
|
+
- エディンソン・カバーニ
|
46
|
+
- セルヒオ・アグエロ
|
47
|
+
- ネイマール
|
48
|
+
- メスト・エジル
|
49
|
+
- ジャンルイジ・ブッフォン
|
50
|
+
- ウィリアン
|
51
|
+
- マヌエル・ノイアー
|
52
|
+
- ファン・マタ
|
53
|
+
- マヌエル・ノイアー
|
54
|
+
- セスク・ファブレガス
|
55
|
+
- ガレス・ベイル
|
56
|
+
- エデン・アザール
|
57
|
+
- マリオ・マンジュキッチ
|
58
|
+
- キリアン・ムバッペ
|
59
|
+
coaches:
|
60
|
+
- エルネスト・バルベルデ
|
61
|
+
- ジネディーヌ・ジダン
|
62
|
+
- ジョゼ・モウリーニョ
|
63
|
+
- アントニオ・コンテ
|
64
|
+
- ユルゲン・クロップ
|
65
|
+
- マウリシオ・ポチェッティーノ
|
66
|
+
- ディエゴ・シメオネ
|
67
|
+
- マッシミリアーノ・アッレグリ
|
68
|
+
- ユップ・ハインケス
|
69
|
+
- アーセン・ベンゲル
|
70
|
+
- ホルヘ・サンパオリ
|
71
|
+
- フェルナンド・サントス
|
72
|
+
- ディディエ・デシャン
|
73
|
+
- ヨアヒム・レーヴ
|
74
|
+
- フレン・ロペテギ
|
75
|
+
- マウリシオ・ポチェッティーノ
|
76
|
+
- ウナイ・エメリ
|
77
|
+
- マッシミリアーノ・アッレグリ
|
78
|
+
- トーマス・トゥヘル
|
79
|
+
competitions:
|
80
|
+
- UEFAヨーロッパ選手権
|
81
|
+
- アジアカップ
|
82
|
+
- アフリカネイションズカップ
|
83
|
+
- コパ・アメリカ
|
84
|
+
- UEFAチャンピオンズリーグ
|
85
|
+
- FIFAワールドカップ
|
86
|
+
- UEFAヨーロッパリーグ
|
87
|
+
- セリエA
|
88
|
+
- バークレイズ・プレミアリーグ
|
89
|
+
- ブンデスリーガ
|
90
|
+
- リーガ・サンタンデール
|
91
|
+
- FAカップ
|
92
|
+
- リーグ・アン
|
93
|
+
- プリメイラ・リーガ
|
94
|
+
- エールディヴィジ
|
95
|
+
- スーパーリーグ
|
96
|
+
- メジャーリーグサッカー
|
97
|
+
- コッパ・イタリア
|
98
|
+
- DFBポカール
|
99
|
+
- CONCACAFゴールドカップ
|
100
|
+
- ネーションズカップ
|
101
|
+
- コパ・デル・レイ
|
102
|
+
positions:
|
103
|
+
- ゴールキーパー
|
104
|
+
- フルバック
|
105
|
+
- ライトバック
|
106
|
+
- レフトバック
|
107
|
+
- ディフェンシブミッドフィールダー
|
108
|
+
- ミッドフィールダー
|
109
|
+
- アタッキングミッドフィールダー
|
110
|
+
- ライトミッドフィールダー
|
111
|
+
- レフトミッドフィールダー
|
112
|
+
- ライトウィング
|
113
|
+
- レフトウィング
|
114
|
+
- セカンドストライカー
|
115
|
+
- センターフォワード
|