faker 3.3.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +89 -0
- data/README.md +11 -3
- data/lib/faker/books/lovecraft.rb +2 -3
- data/lib/faker/default/address.rb +2 -2
- 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/national_health_service.rb +7 -2
- 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/default/vehicle.rb +4 -3
- data/lib/faker/locations/australia.rb +2 -2
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/deprecator.rb +24 -1
- data/lib/locales/en/address.yml +1 -1
- data/lib/locales/en/dog.yml +262 -7
- data/lib/locales/en/dota.yml +120 -67
- data/lib/locales/en/food.yml +2 -1
- data/lib/locales/en/vehicle.yml +1 -1
- data/lib/locales/ja/football.yml +115 -0
- data/lib/locales/ko.yml +1361 -20
- data/lib/locales/sv.yml +99 -0
- 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: cf806bbcecec3b286e05fe7c79f0b4274708a3a7f55add0b3488a3ba8bf574f6
|
4
|
+
data.tar.gz: 688f47f7f92a4b58281ef2e3beb0df72e134e916929d7aa1ff4e6db07af9151d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd84609a1b8b0d846f5185cd544141e22d8296a2bcbe4a613daabcdadde8afa1039a9087dafbf7b7ccba7668ff5c506b1ca25cbebd3520455760a16dea45cd6
|
7
|
+
data.tar.gz: ab939601c6ceeb1f051d708687a61e2a89c3e9da77881159866a73cb5039c9292101cb48d3b19c36607b1cbf25192e8895e7e49b0dde1e88c0e07c0e24e75f01
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,94 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.4.2](https://github.com/faker-ruby/faker/tree/v3.4.2) (2024-07-16)
|
4
|
+
|
5
|
+
Happy July with a new faker-ruby release.
|
6
|
+
|
7
|
+
This version:
|
8
|
+
|
9
|
+
- introduces a breaking change for `Faker::NationalHealthService.british_number` (more details below)
|
10
|
+
- adds translation for some generators
|
11
|
+
- fixes bugs
|
12
|
+
|
13
|
+
### Breaking changes
|
14
|
+
|
15
|
+
The NHS sets aside a range of numbers from 999 000 0000 to 999 999 9999 for test purposes. The old range could
|
16
|
+
produce NHS numbers that were in use by real patients in the UK/England and Wales. In this version, `Faker::NationalHealthService.british_number` uses the test range for creating NHS numbers rather than the previous 400 000 0010 to 499 999 9999 range.
|
17
|
+
|
18
|
+
Breaking change was introduced in "Add test range param to NHS numbers" by @neanias in https://github.com/faker-ruby/faker/pull/2947
|
19
|
+
|
20
|
+
### Improvements & Bug fixes
|
21
|
+
|
22
|
+
* Add Bank and Sport to Swedish locale by @twk-mn in https://github.com/faker-ruby/faker/pull/2961
|
23
|
+
* docs: update with notes about validity for zips by @garrettgregor in https://github.com/faker-ruby/faker/pull/2963
|
24
|
+
* `Faker::Games::Dota` missing quotes and new heroes by @arthurka-o in https://github.com/faker-ruby/faker/pull/2907
|
25
|
+
* Add phone_number.country_code and address.full_address in locale sv by @larkro in https://github.com/faker-ruby/faker/pull/2965
|
26
|
+
* Fix typo by @fynsta in https://github.com/faker-ruby/faker/pull/2968
|
27
|
+
* fix: `Faker::Internet.username` should not generate duplicated punctuation by @thdaraujo in https://github.com/faker-ruby/faker/pull/2970
|
28
|
+
* Update dog breed names for `en-US` locale by @mononoken in https://github.com/faker-ruby/faker/pull/2972
|
29
|
+
* Add `Deprecator.skip_warning?` ability to silence deprecators on tests by @keshavbiswa in https://github.com/faker-ruby/faker/pull/2956
|
30
|
+
|
31
|
+
### Update local dependencies
|
32
|
+
|
33
|
+
* Bump timecop from 0.9.9 to 0.9.10 by @dependabot in https://github.com/faker-ruby/faker/pull/2969
|
34
|
+
* Bump minitest from 5.23.1 to 5.24.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2975
|
35
|
+
* Bump bundler version to `2.4.22` by @thdaraujo in https://github.com/faker-ruby/faker/pull/2978
|
36
|
+
* Bump rubocop from 1.64.1 to 1.65.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2979
|
37
|
+
* Bump rubocop-minitest from 0.35.0 to 0.35.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2980
|
38
|
+
|
39
|
+
## New Contributors
|
40
|
+
* @twk-mn made their first contribution in https://github.com/faker-ruby/faker/pull/2961
|
41
|
+
* @neanias made their first contribution in https://github.com/faker-ruby/faker/pull/2947
|
42
|
+
* @garrettgregor made their first contribution in https://github.com/faker-ruby/faker/pull/2963
|
43
|
+
* @arthurka-o made their first contribution in https://github.com/faker-ruby/faker/pull/2907
|
44
|
+
* @larkro made their first contribution in https://github.com/faker-ruby/faker/pull/2965
|
45
|
+
* @fynsta made their first contribution in https://github.com/faker-ruby/faker/pull/2968
|
46
|
+
* @mononoken made their first contribution in https://github.com/faker-ruby/faker/pull/2972
|
47
|
+
|
48
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v.3.4.1...v3.4.2
|
49
|
+
|
50
|
+
---------------------------------
|
51
|
+
|
52
|
+
## [v3.4.1](https://github.com/faker-ruby/faker/tree/v3.4.1) (2024-05-28)
|
53
|
+
|
54
|
+
### What's changed
|
55
|
+
|
56
|
+
* Performance: Sample arrays instead of performing shuffle and slice by @alextaujenis in https://github.com/faker-ruby/faker/pull/2940
|
57
|
+
* Performance: Reduce the time complexity of `Faker::Crypto` generators by @alextaujenis in https://github.com/faker-ruby/faker/pull/2938
|
58
|
+
* Remove tzinfo dependency by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2952
|
59
|
+
|
60
|
+
### Bug fixes
|
61
|
+
|
62
|
+
* Fix invalid IANA time zone identifier for `Atlantic/Cape_Verde` by @andrelaszlo in https://github.com/faker-ruby/faker/pull/2927
|
63
|
+
* Fix entry in faker.food.ingredients by @matthewmayer in https://github.com/faker-ruby/faker/pull/2933
|
64
|
+
* Docs: add absolute links to CONTRIBUTING from README by @matthewmayer in https://github.com/faker-ruby/faker/pull/2934
|
65
|
+
* 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
|
66
|
+
* Username splits names by space and doesn't regex match them by @keshavbiswa in https://github.com/faker-ruby/faker/pull/2950
|
67
|
+
|
68
|
+
### Features
|
69
|
+
|
70
|
+
* 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
|
71
|
+
* Add adjectives to Korean locale file by @connie-feng in https://github.com/faker-ruby/faker/pull/2930
|
72
|
+
* Add emotions, movies, Pokemon, and Studio Ghibli to the Korean locale by @connie-feng in https://github.com/faker-ruby/faker/pull/2941
|
73
|
+
* Add Japanese translations for `Faker::Sports::Football`. by @yamat47 in https://github.com/faker-ruby/faker/pull/2903
|
74
|
+
|
75
|
+
### Update local dependencies
|
76
|
+
|
77
|
+
* Bump rake from 13.1.0 to 13.2.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2929
|
78
|
+
* Bump i18n from 1.14.4 to 1.14.5 by @dependabot in https://github.com/faker-ruby/faker/pull/2949
|
79
|
+
* Bump minitest from 5.22.3 to 5.23.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2957
|
80
|
+
* Bump rubocop from 1.63.4 to 1.64.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2958
|
81
|
+
|
82
|
+
## New Contributors
|
83
|
+
|
84
|
+
* @connie-feng made their first contribution in https://github.com/faker-ruby/faker/pull/2930
|
85
|
+
* @andrelaszlo made their first contribution in https://github.com/faker-ruby/faker/pull/2927
|
86
|
+
* @matthewmayer made their first contribution in https://github.com/faker-ruby/faker/pull/2933
|
87
|
+
|
88
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.3.1...v.3.4.1
|
89
|
+
|
90
|
+
---------------------------------
|
91
|
+
|
3
92
|
## [v3.3.1](https://github.com/faker-ruby/faker/tree/v3.3.1) (2024-04-02)
|
4
93
|
|
5
94
|
### 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
|
|
@@ -119,8 +119,8 @@ module Faker
|
|
119
119
|
return numerify(letterified_string, leading_zero: true)
|
120
120
|
end
|
121
121
|
|
122
|
-
# provide a zip code that
|
123
|
-
#
|
122
|
+
# provide a zip code that may be valid for the state provided
|
123
|
+
# note: zip code may appear in the correct format for the state provided but may not be an actual state zip.
|
124
124
|
bothify(fetch("address.postcode_by_state.#{state_abbreviation}"))
|
125
125
|
end
|
126
126
|
|
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("'", '').scan(/[[:word:]]+/)
|
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
@@ -6,14 +6,17 @@ module Faker
|
|
6
6
|
##
|
7
7
|
# Produces a random British NHS number.
|
8
8
|
#
|
9
|
+
# The NHS sets aside a range of numbers from 999 000 0000 to 999 999 9999
|
10
|
+
# for test purposes.
|
11
|
+
#
|
9
12
|
# @return [String]
|
10
13
|
#
|
11
14
|
# @example
|
12
|
-
# Faker::NationalHealthService.british_number #=> "
|
15
|
+
# Faker::NationalHealthService.british_number #=> "999 464 0232"
|
13
16
|
#
|
14
17
|
# @faker.version 1.9.2
|
15
18
|
def british_number
|
16
|
-
base_number = rand(
|
19
|
+
base_number = rand(999_000_001...999_999_999)
|
17
20
|
# If the check digit is equivalent to 10, the number is invalid.
|
18
21
|
# See https://en.wikipedia.org/wiki/NHS_number
|
19
22
|
base_number -= 1 if check_digit(number: base_number) == 10
|
@@ -24,6 +27,8 @@ module Faker
|
|
24
27
|
.join
|
25
28
|
end
|
26
29
|
|
30
|
+
private
|
31
|
+
|
27
32
|
##
|
28
33
|
# Produces a random British NHS number's check digit.
|
29
34
|
#
|
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
|
##
|
@@ -48,12 +48,13 @@ module Faker
|
|
48
48
|
# @return [String]
|
49
49
|
#
|
50
50
|
# @example
|
51
|
-
# Faker::Vehicle.
|
51
|
+
# Faker::Vehicle.manufacturer #=> "Lamborghini"
|
52
52
|
#
|
53
53
|
# @faker.version 1.6.4
|
54
|
-
def
|
55
|
-
fetch('vehicle.
|
54
|
+
def manufacturer
|
55
|
+
fetch('vehicle.manufacturer')
|
56
56
|
end
|
57
|
+
alias manufacture manufacturer
|
57
58
|
|
58
59
|
##
|
59
60
|
# Produces a random vehicle make.
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Faker
|
4
|
-
extend Deprecator
|
5
|
-
|
6
4
|
class Locations
|
7
5
|
class Australia < Base
|
8
6
|
class << self
|
@@ -48,5 +46,7 @@ module Faker
|
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
49
|
+
|
50
|
+
include Deprecator
|
51
51
|
deprecate_generator('Australia', Locations::Australia)
|
52
52
|
end
|
data/lib/faker/version.rb
CHANGED
data/lib/helpers/deprecator.rb
CHANGED
@@ -10,7 +10,10 @@ module Faker
|
|
10
10
|
extension = Module.new do
|
11
11
|
def const_missing(missing_const_name)
|
12
12
|
if class_variable_defined?(:@@_deprecated_constants) && (replacement = class_variable_get(:@@_deprecated_constants)[missing_const_name.to_s])
|
13
|
-
|
13
|
+
unless Faker::Deprecator.skip_warning?
|
14
|
+
$stdout.puts("DEPRECATION WARNING: #{name}::#{replacement[:old_generator]} is deprecated. Use #{replacement[:new_constant]} instead.")
|
15
|
+
end
|
16
|
+
|
14
17
|
return replacement[:new_constant]
|
15
18
|
end
|
16
19
|
|
@@ -25,6 +28,26 @@ module Faker
|
|
25
28
|
|
26
29
|
base.singleton_class.prepend extension
|
27
30
|
end
|
31
|
+
|
32
|
+
def self.skip_warning
|
33
|
+
original = Faker::Deprecator.skip
|
34
|
+
Faker::Deprecator.skip = true
|
35
|
+
yield
|
36
|
+
ensure
|
37
|
+
Faker::Deprecator.skip = original
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.skip_warning?
|
41
|
+
skip == true
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.skip
|
45
|
+
@skip ||= false
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.skip=(value)
|
49
|
+
@skip = value
|
50
|
+
end
|
28
51
|
end
|
29
52
|
end
|
30
53
|
# rubocop:enable Style/ClassVars
|