faker 1.9.3 → 1.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -1
- data/README.md +30 -10
- data/bin/faker +19 -0
- data/lib/cli.rb +53 -0
- data/lib/cli/README.md +55 -0
- data/lib/cli/command.rb +24 -0
- data/lib/cli/commands/list.rb +17 -0
- data/lib/cli/commands/search.rb +29 -0
- data/lib/cli/reflector.rb +48 -0
- data/lib/cli/reflectors/list.rb +39 -0
- data/lib/cli/reflectors/search.rb +46 -0
- data/lib/cli/renderer.rb +93 -0
- data/lib/faker/blockchain/tezos.rb +10 -5
- data/lib/faker/creature/horse.rb +19 -0
- data/lib/faker/default/coffee.rb +2 -0
- data/lib/faker/default/company.rb +4 -0
- data/lib/faker/default/internet.rb +14 -2
- data/lib/faker/default/json.rb +4 -4
- data/lib/faker/deprecate/unreleased/football.rb +35 -0
- data/lib/faker/deprecate/unreleased/movies/grateful_dead.rb +22 -0
- data/lib/faker/games/game.rb +21 -0
- data/lib/faker/{movies → music}/grateful_dead.rb +3 -1
- data/lib/faker/music/opera.rb +26 -0
- data/lib/faker/sports/basketball.rb +25 -0
- data/lib/faker/sports/football.rb +29 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-AU.yml +1 -1
- data/lib/locales/en/animal.yml +2 -2
- data/lib/locales/en/basketball.yml +99 -0
- data/lib/locales/en/company.yml +1 -0
- data/lib/locales/en/crypto_coin.yml +22 -6
- data/lib/locales/en/dc_comics.yml +5 -5
- data/lib/locales/en/dota.yml +3 -1
- data/lib/locales/en/food.yml +1 -1
- data/lib/locales/en/game.yml +283 -0
- data/lib/locales/en/grateful_dead.yml +2 -1
- data/lib/locales/en/heroes_of_the_storm.yml +2 -2
- data/lib/locales/en/horse.yml +6 -0
- data/lib/locales/en/kpop.yml +1 -1
- data/lib/locales/en/league_of_legends.yml +2 -2
- data/lib/locales/en/music.yml +1 -1
- data/lib/locales/en/nation.yml +1 -1
- data/lib/locales/en/opera.yml +172 -0
- data/lib/locales/en/phish.yml +1 -1
- data/lib/locales/en/rupaul.yml +51 -21
- data/lib/locales/en/space.yml +1 -1
- data/lib/locales/en/stargate.yml +1 -2
- data/lib/locales/en/subscription.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +4 -0
- data/lib/locales/fr-CA.yml +0 -5
- data/lib/locales/fr-CH.yml +0 -1
- data/lib/locales/fr.yml +1 -1
- data/lib/locales/hy.yml +47 -2
- data/lib/locales/ja.yml +16 -0
- data/lib/locales/pt-BR.yml +4 -1
- data/lib/locales/zh-CN.yml +3 -6
- data/lib/locales/zh-TW.yml +2 -2
- metadata +137 -98
- data/lib/faker/default/football.rb +0 -27
- data/lib/faker/deprecate/aqua_teen_hunger_force.rb +0 -15
- data/lib/faker/deprecate/back_to_the_future.rb +0 -25
- data/lib/faker/deprecate/bitcoin.rb +0 -20
- data/lib/faker/deprecate/bojack_horseman.rb +0 -25
- data/lib/faker/deprecate/breaking_bad.rb +0 -20
- data/lib/faker/deprecate/buffy.rb +0 -35
- data/lib/faker/deprecate/cat.rb +0 -25
- data/lib/faker/deprecate/community.rb +0 -20
- data/lib/faker/deprecate/dog.rb +0 -50
- data/lib/faker/deprecate/dota.rb +0 -35
- data/lib/faker/deprecate/dr_who.rb +0 -45
- data/lib/faker/deprecate/dragon_ball.rb +0 -15
- data/lib/faker/deprecate/dumb_and_dumber.rb +0 -25
- data/lib/faker/deprecate/dune.rb +0 -35
- data/lib/faker/deprecate/elder_scrolls.rb +0 -50
- data/lib/faker/deprecate/ethereum.rb +0 -15
- data/lib/faker/deprecate/fallout.rb +0 -30
- data/lib/faker/deprecate/family_guy.rb +0 -25
- data/lib/faker/deprecate/famous_last_words.rb +0 -15
- data/lib/faker/deprecate/friends.rb +0 -25
- data/lib/faker/deprecate/game_of_thrones.rb +0 -35
- data/lib/faker/deprecate/harry_potter.rb +0 -40
- data/lib/faker/deprecate/heroes_of_the_storm.rb +0 -30
- data/lib/faker/deprecate/hey_arnold.rb +0 -25
- data/lib/faker/deprecate/hitchhikers_guide_to_the_galaxy.rb +0 -44
- data/lib/faker/deprecate/hobbit.rb +0 -30
- data/lib/faker/deprecate/how_i_met_your_mother.rb +0 -30
- data/lib/faker/deprecate/league_of_legends.rb +0 -40
- data/lib/faker/deprecate/lebowski.rb +0 -25
- data/lib/faker/deprecate/lord_of_the_rings.rb +0 -25
- data/lib/faker/deprecate/lovecraft.rb +0 -65
- data/lib/faker/deprecate/matz.rb +0 -15
- data/lib/faker/deprecate/michael_scott.rb +0 -15
- data/lib/faker/deprecate/most_interesting_man_in_the_world.rb +0 -15
- data/lib/faker/deprecate/myst.rb +0 -35
- data/lib/faker/deprecate/new_girl.rb +0 -20
- data/lib/faker/deprecate/one_piece.rb +0 -40
- data/lib/faker/deprecate/overwatch.rb +0 -25
- data/lib/faker/deprecate/parks_and_rec.rb +0 -20
- data/lib/faker/deprecate/pokemon.rb +0 -25
- data/lib/faker/deprecate/princess_bride.rb +0 -20
- data/lib/faker/deprecate/rick_and_morty.rb +0 -25
- data/lib/faker/deprecate/robin.rb +0 -15
- data/lib/faker/deprecate/rock_band.rb +0 -15
- data/lib/faker/deprecate/ru_paul.rb +0 -20
- data/lib/faker/deprecate/seinfeld.rb +0 -25
- data/lib/faker/deprecate/shakespeare.rb +0 -50
- data/lib/faker/deprecate/silicon_valley.rb +0 -50
- data/lib/faker/deprecate/simpsons.rb +0 -25
- data/lib/faker/deprecate/singular_siegler.rb +0 -15
- data/lib/faker/deprecate/south_park.rb +0 -20
- data/lib/faker/deprecate/star_trek.rb +0 -30
- data/lib/faker/deprecate/star_wars.rb +0 -95
- data/lib/faker/deprecate/stargate.rb +0 -25
- data/lib/faker/deprecate/stranger_things.rb +0 -20
- data/lib/faker/deprecate/sword_art_online.rb +0 -30
- data/lib/faker/deprecate/tezos.rb +0 -33
- data/lib/faker/deprecate/the_fresh_prince_of_bel_air.rb +0 -25
- data/lib/faker/deprecate/the_it_crowd.rb +0 -30
- data/lib/faker/deprecate/the_thick_of_it.rb +0 -25
- data/lib/faker/deprecate/twin_peaks.rb +0 -25
- data/lib/faker/deprecate/umphreys_mcgee.rb +0 -15
- data/lib/faker/deprecate/v_for_vendetta.rb +0 -25
- data/lib/faker/deprecate/venture_bros.rb +0 -30
- data/lib/faker/deprecate/witcher.rb +0 -40
- data/lib/faker/deprecate/world_of_warcraft.rb +0 -20
- data/lib/faker/deprecate/yoda.rb +0 -16
- data/lib/faker/deprecate/zelda.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4adc28503a1bd209dcf7c7bfea5794149f0b92bdb0869f67a920ce33fa96ce2a
|
4
|
+
data.tar.gz: 3698e9ce24f8625591c49fd3e032f8768c8396c40d501a9a73ab70d5e3ec506e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b7c6bce97ad335d681fb7cf509229f2dddb68fd0cf65ea0ecb5531babf049da3094f8a968b43b36ed88079811dca637fe1ee092796991e3abab57fe8d9e7e0
|
7
|
+
data.tar.gz: 7792629c3ceff4a0c7d1e0efb38beb0c0a58ed6cd7ad3ddb5b7869c434dac72dede781400e768006a2db3d3f02fd67c7cc35c376069856839bf2b3f8128e4d6e
|
data/CHANGELOG.md
CHANGED
@@ -3,19 +3,84 @@
|
|
3
3
|
## HEAD Unreleased
|
4
4
|
|
5
5
|
### Bug/Fixes
|
6
|
+
### Chores
|
7
|
+
### Deprecation
|
8
|
+
### Documentation
|
9
|
+
### Feature Request
|
10
|
+
### Update/add locales
|
11
|
+
|
12
|
+
------------------------------------------------------------------------------
|
13
|
+
|
14
|
+
## [v1.9.4](https://github.com/stympy/faker/tree/v1.9.4) (2019-06-19)
|
15
|
+
|
16
|
+
### Bug/Fixes
|
17
|
+
|
18
|
+
- [PR #1605](https://github.com/stympy/faker/pull/1605) fix shallow_json for frozen_string_literal [@causztic](https://github.com/causztic)
|
19
|
+
- [PR #1597](https://github.com/stympy/faker/pull/1597) Fix broken test [@vbrazo](https://github.com/vbrazo)
|
20
|
+
- [PR #1578](https://github.com/stympy/faker/pull/1578) Namespaces should inherit Base [@vbrazo](https://github.com/vbrazo)
|
6
21
|
|
7
22
|
### Chores
|
8
23
|
|
24
|
+
- [PR #1626](https://github.com/stympy/faker/pull/1626) Update tty tree [@Zeragamba](https://github.com/Zeragamba)
|
25
|
+
- [PR #1559](https://github.com/stympy/faker/pull/1559) Fix name_with_middle field for en-AU [@psibi](https://github.com/psibi)
|
26
|
+
- [PR #1548](https://github.com/stympy/faker/pull/1548) Chore/improve pt-BR specs [@paulodiovani](https://github.com/paulodiovani)
|
27
|
+
- [PR #1542](https://github.com/stympy/faker/pull/1542) Fixed typos to the unreleased_README.md [@gkunwar](https://github.com/gkunwar)
|
28
|
+
- [PR #1541](https://github.com/stympy/faker/pull/1541) Add new categories to armenian [@hovikman](https://github.com/hovikman)
|
29
|
+
|
9
30
|
### Deprecation
|
10
31
|
|
32
|
+
- [PR #1549](https://github.com/stympy/faker/pull/1549) Faker::Movies::GratefulDead => Faker::Music::GratefulDead [@bcharna](https://github.com/bcharna)
|
33
|
+
- [PR #1538](https://github.com/stympy/faker/pull/1538) Add Sports namespace [@vbrazo](https://github.com/vbrazo)
|
34
|
+
- Deprecates `::Football`
|
35
|
+
|
11
36
|
### Documentation
|
12
37
|
|
38
|
+
- [PR #1636](https://github.com/stympy/faker/pull/1636) Fix default values for arguments in Lorem doc [@mikong](https://github.com/mikong)
|
39
|
+
- [PR #1617](https://github.com/stympy/faker/pull/1617) Fix Dota README [@TheSmartnik](https://github.com/TheSmartnik)
|
40
|
+
- [PR #1612](https://github.com/stympy/faker/pull/1612) Update returned example player [@ncallaway](https://github.com/ncallaway)
|
41
|
+
- [PR #1611](https://github.com/stympy/faker/pull/1611) Documentation error fix [@tomlockwood](https://github.com/tomlockwood)
|
42
|
+
- [PR #1575](https://github.com/stympy/faker/pull/1575) Add issues templates [@vbrazo](https://github.com/vbrazo)
|
43
|
+
|
13
44
|
### Feature Request
|
14
45
|
|
15
|
-
|
46
|
+
- [PR #1631](https://github.com/stympy/faker/pull/1631) Faker::Tezos: add block faker [@akettal](https://github.com/akettal)
|
47
|
+
- [PR #1619](https://github.com/stympy/faker/pull/1619) Add Faker::Music::Opera [@Adsidera](https://github.com/Adsidera)
|
48
|
+
- [PR #1607](https://github.com/stympy/faker/pull/1607) Add Faker::Game with title, genre, and platform generators. [@connorshea](https://github.com/connorshea)
|
49
|
+
- [PR #1603](https://github.com/stympy/faker/pull/1603) Add Faker::Internet.uuid [@ianks](https://github.com/ianks)
|
50
|
+
- [PR #1560](https://github.com/stympy/faker/pull/1560) Add Faker::Creature::Horse [@wndxlori](https://github.com/wndxlori)
|
51
|
+
- [PR #1507](https://github.com/stympy/faker/pull/1507) Add CLI - Integrate fakerbot 🤖 [@akabiru](https://github.com/akabiru)
|
52
|
+
- [PR #1540](https://github.com/stympy/faker/pull/1540) Add sic_code to company #355 [@bruno-b-martins](https://github.com/bruno-b-martins)
|
53
|
+
- [PR #1537](https://github.com/stympy/faker/pull/1537) Adds the Faker::Sports::Basketball generator [@ecbrodie](https://github.com/ecbrodie)
|
54
|
+
- [PR #1520](https://github.com/stympy/faker/pull/1520) Allow subdomains for Internet.domain_name [@cianooooo](https://github.com/cianooooo)
|
16
55
|
|
17
56
|
### Update/add locales
|
18
57
|
|
58
|
+
- [PR #1629](https://github.com/stympy/faker/pull/1629) Fix sintax error on game.yml file [@ricardobsilva](https://github.com/ricardobsilva)
|
59
|
+
- [PR #1627](https://github.com/stympy/faker/pull/1627) add more data for Faker::Games [@BlazingRockStorm](https://github.com/BlazingRockStorm)
|
60
|
+
- [PR #1620](https://github.com/stympy/faker/pull/1620) Added Yuumi as a Champion [@eddorre](https://github.com/eddorre)
|
61
|
+
- [PR #1621](https://github.com/stympy/faker/pull/1621) Updated classes to match the changes that Blizzard rolled out late last year. Updated hero pool to add the latest two heroes added to the game. [@eddorre](https://github.com/eddorre)
|
62
|
+
- [PR #1602](https://github.com/stympy/faker/pull/1602) Remove white space, fix minor typos [@darylf](https://github.com/darylf)
|
63
|
+
- [PR #1595](https://github.com/stympy/faker/pull/1595) Fix accented French surnames [@Samy-Amar](https://github.com/Samy-Amar)
|
64
|
+
- [PR #1585](https://github.com/stympy/faker/pull/1585) Add Meepo to Dota heroes and quotes [@justinoue](https://github.com/justinoue)
|
65
|
+
- [PR #1594](https://github.com/stympy/faker/pull/1594) Changed Startrek to Stargate :) [@Defoncesko](https://github.com/Defoncesko)
|
66
|
+
- [PR #1591](https://github.com/stympy/faker/pull/1591) fix-chinese-city [@locez](https://github.com/locez)
|
67
|
+
- [PR #1592](https://github.com/stympy/faker/pull/1592) Add coffee country for Japanese [@schmurfy](https://github.com/schmurfy)
|
68
|
+
- [PR #1593](https://github.com/stympy/faker/pull/1593) removes duplicates in fr-CA and fr-CH [@schmurfy](https://github.com/schmurfy)
|
69
|
+
- [PR #1587](https://github.com/stympy/faker/pull/1587) Add ancient god for Japanese [@yizknn](https://github.com/yizknn)
|
70
|
+
- [PR #1582](https://github.com/stympy/faker/pull/1582) Add fighters and DLC to Faker::Games::SuperSmashBros [@boardfish](https://github.com/boardfish)
|
71
|
+
- [PR #1583](https://github.com/stympy/faker/pull/1583) updates to RuPaul [@notactuallypagemcconnell](https://github.com/notactuallypagemcconnell)
|
72
|
+
- [PR #1581](https://github.com/stympy/faker/pull/1581) add latest list of phish tunes from phish.net/song that are by the band and not covers [@notactuallypagemcconnell](https://github.com/notactuallypagemcconnell)
|
73
|
+
- [PR #1573](https://github.com/stympy/faker/pull/1573) Fix data of music albums [@sankichi92](https://github.com/sankichi92)
|
74
|
+
- [PR #1567](https://github.com/stympy/faker/pull/1567) Fix name_with_middle in Chinese locales [@rockymeza](https://github.com/rockymeza)
|
75
|
+
- [PR #1564](https://github.com/stympy/faker/pull/1564) Update League of legends content [@michebble](https://github.com/michebble)
|
76
|
+
- [PR #1558](https://github.com/stympy/faker/pull/1558) remove misspelling of Japanese [@michebble](https://github.com/michebble)
|
77
|
+
- [PR #1554](https://github.com/stympy/faker/pull/1554) Extend list of cryptocurrencies [@kamilbielawski](https://github.com/kamilbielawski)
|
78
|
+
- [PR #1552](https://github.com/stympy/faker/pull/1552) Fix subscription: Fix missing double quotes [@psibi](https://github.com/psibi)
|
79
|
+
- [PR #1551](https://github.com/stympy/faker/pull/1551) Yaml syntax for stargate.yml: Fix missing double quote [@psibi](https://github.com/psibi)
|
80
|
+
- [PR #1550](https://github.com/stympy/faker/pull/1550) Fix kpop - yaml syntax issue. Double quote is missing [@psibi](https://github.com/psibi)
|
81
|
+
- [PR #1545](https://github.com/stympy/faker/pull/1545) Remove trailing space from "kangaroo " & "gnu " translation in animals [@spikeheap](https://github.com/spikeheap)
|
82
|
+
- [PR #1543](https://github.com/stympy/faker/pull/1543) Add pt-BR genders [@fladson](https://github.com/fladson)
|
83
|
+
|
19
84
|
------------------------------------------------------------------------------
|
20
85
|
|
21
86
|
## [v1.9.3](https://github.com/stympy/faker/tree/v1.9.2) (2019-02-12)
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
![logotype a happy-07](https://user-images.githubusercontent.com/36028424/40263395-4318481e-5b44-11e8-92e5-3dcc1ce169b3.png)
|
2
3
|
|
3
4
|
# Faker
|
@@ -15,11 +16,14 @@ for the creation of this gem), having real-looking test data, and having your
|
|
15
16
|
database populated with more than one or two records while you're doing
|
16
17
|
development.
|
17
18
|
|
18
|
-
- [
|
19
|
-
- [
|
19
|
+
- [Faker](#faker)
|
20
|
+
- [NOTE](#note)
|
21
|
+
- [Installing](#installing)
|
22
|
+
- [Usage](#usage)
|
23
|
+
- [CLI](#cli)
|
20
24
|
- [Ensuring unique values](#ensuring-unique-values)
|
21
25
|
- [Deterministic Random](#deterministic-random)
|
22
|
-
- [Generators](#generators)
|
26
|
+
- [Generators](#generators)
|
23
27
|
- [Default](#default)
|
24
28
|
- [Blockchain](#blockchain)
|
25
29
|
- [Books](#books)
|
@@ -29,11 +33,12 @@ development.
|
|
29
33
|
- [Movies](#movies)
|
30
34
|
- [Music](#music)
|
31
35
|
- [Quotes](#quotes)
|
32
|
-
- [
|
33
|
-
- [
|
34
|
-
- [
|
35
|
-
- [
|
36
|
-
- [
|
36
|
+
- [Sports](#sports)
|
37
|
+
- [Tv Shows](#tv-shows)
|
38
|
+
- [Customization](#customization)
|
39
|
+
- [Contributing](#contributing)
|
40
|
+
- [Contact](#contact)
|
41
|
+
- [License](#license)
|
37
42
|
|
38
43
|
### NOTE
|
39
44
|
* While Faker generates data at random, returned values are not guaranteed to be unique by default.
|
@@ -47,7 +52,7 @@ development.
|
|
47
52
|
```bash
|
48
53
|
gem install faker
|
49
54
|
```
|
50
|
-
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
|
55
|
+
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:
|
51
56
|
|
52
57
|
```ruby
|
53
58
|
gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
@@ -62,6 +67,14 @@ Faker::Name.name #=> "Christophe Bartell"
|
|
62
67
|
Faker::Internet.email #=> "kirsten.greenholt@corkeryfisher.info"
|
63
68
|
```
|
64
69
|
|
70
|
+
### CLI
|
71
|
+
|
72
|
+
Usage Instructions [available here](https://github.com/stympy/faker/blob/master/lib/cli/README.md)
|
73
|
+
|
74
|
+
```bash
|
75
|
+
$ faker
|
76
|
+
```
|
77
|
+
|
65
78
|
### Ensuring unique values
|
66
79
|
Prefix your method call with `unique`. For example:
|
67
80
|
```ruby
|
@@ -218,8 +231,10 @@ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
|
218
231
|
- [Faker::Creature::Animal](doc/creature/animal.md)
|
219
232
|
- [Faker::Creature::Cat](doc/creature/cat.md)
|
220
233
|
- [Faker::Creature::Dog](doc/creature/dog.md)
|
234
|
+
- [Faker::Creature::Horse](doc/creature/horse.md)
|
221
235
|
|
222
236
|
### Games
|
237
|
+
- [Faker::Game](doc/games/game.md)
|
223
238
|
- [Faker::Games::Dota](doc/games/dota.md)
|
224
239
|
- [Faker::Games::ElderScrolls](doc/games/elder_scrolls.md)
|
225
240
|
- [Faker::Games::Fallout](doc/games/fallout.md)
|
@@ -245,7 +260,6 @@ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
|
245
260
|
- [Faker::Movie](doc/movies/movie.md)
|
246
261
|
- [Faker::Movies::BackToTheFuture](doc/movies/back_to_the_future.md)
|
247
262
|
- [Faker::Movies::Ghostbusters](doc/movies/ghostbusters.md)
|
248
|
-
- [Faker::Movies::GratefulDead](doc/movies/grateful_dead.md)
|
249
263
|
- [Faker::Movies::HarryPotter](doc/movies/harry_potter.md)
|
250
264
|
- [Faker::Movies::HitchhikersGuideToTheGalaxy](doc/movies/hitchhikers_guide_to_the_galaxy.md)
|
251
265
|
- [Faker::Movies::Hobbit](doc/movies/hobbit.md)
|
@@ -257,6 +271,8 @@ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
|
257
271
|
|
258
272
|
### Music
|
259
273
|
- [Faker::Music](doc/music/music.md)
|
274
|
+
- [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
|
275
|
+
- [Faker::Music::Opera](doc/music/opera.md)
|
260
276
|
- [Faker::Music::Phish](doc/music/phish.md)
|
261
277
|
- [Faker::Music::RockBand](doc/music/rock_band.md)
|
262
278
|
- [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
|
@@ -265,6 +281,10 @@ gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
|
265
281
|
- [Faker::Quote](doc/quotes/quote.md)
|
266
282
|
- [Faker::Quotes::Shakespeare](doc/quotes/shakespeare.md)
|
267
283
|
|
284
|
+
### Sports
|
285
|
+
- [Faker::Sports::Basketball](doc/sports/basketball.md)
|
286
|
+
- [Faker::Sports::Football](doc/sports/football.md)
|
287
|
+
|
268
288
|
### Tv Shows
|
269
289
|
- [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
|
270
290
|
- [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
|
data/bin/faker
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
|
+
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
|
6
|
+
|
7
|
+
require 'cli'
|
8
|
+
|
9
|
+
Signal.trap('INT') do
|
10
|
+
warn("\n#{caller.join("\n")}: interrupted")
|
11
|
+
exit(1)
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
Faker::CLI::Base.start
|
16
|
+
rescue Faker::CLI::Base::Error => err
|
17
|
+
puts "ERROR: #{err.message}"
|
18
|
+
exit 1
|
19
|
+
end
|
data/lib/cli.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
require 'cli/commands/list'
|
6
|
+
require 'cli/commands/search'
|
7
|
+
require 'faker/version'
|
8
|
+
|
9
|
+
module Faker
|
10
|
+
module CLI
|
11
|
+
class Base < Thor
|
12
|
+
Error = Class.new(StandardError)
|
13
|
+
# Skip default deprecation warning output; the CLI will display that.
|
14
|
+
Gem::Deprecate.skip_during do
|
15
|
+
desc 'version', 'Faker version'
|
16
|
+
def version
|
17
|
+
puts "v#{Faker::VERSION}"
|
18
|
+
end
|
19
|
+
map %w[--version -v] => :version
|
20
|
+
|
21
|
+
desc 'list', 'List all Faker constants'
|
22
|
+
method_option :help, aliases: '-h', type: :boolean,
|
23
|
+
desc: 'Display usage information'
|
24
|
+
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
|
25
|
+
desc: 'Display Faker constants with methods'
|
26
|
+
method_option :verbose, aliases: '-v', type: :boolean,
|
27
|
+
desc: 'Include sample Faker output'
|
28
|
+
def list(*)
|
29
|
+
if options[:help]
|
30
|
+
invoke :help, ['list']
|
31
|
+
else
|
32
|
+
Faker::CLI::Commands::List.new(options).execute
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'search [Faker]', 'Search Faker method(s)'
|
37
|
+
method_option :help, aliases: '-h', type: :boolean,
|
38
|
+
desc: 'Display usage information'
|
39
|
+
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
|
40
|
+
desc: 'Display Faker constants with methods'
|
41
|
+
method_option :verbose, aliases: '-v', type: :boolean,
|
42
|
+
desc: 'Include sample Faker output'
|
43
|
+
def search(query)
|
44
|
+
if options[:help]
|
45
|
+
invoke :help, ['search']
|
46
|
+
else
|
47
|
+
Faker::CLI::Commands::Search.new(options).execute(query)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/cli/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# faker (cli)
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
|
5
|
+
1.) Run a quick lookup
|
6
|
+
|
7
|
+
```bash
|
8
|
+
$ faker search name
|
9
|
+
# Faker::SwordArtOnline
|
10
|
+
# └── real_name
|
11
|
+
# └── game_name
|
12
|
+
# Faker::Superhero
|
13
|
+
# └── name
|
14
|
+
# ....
|
15
|
+
```
|
16
|
+
|
17
|
+
2.) List methods
|
18
|
+
|
19
|
+
```sh
|
20
|
+
$ faker list
|
21
|
+
# Faker::BackToTheFuture
|
22
|
+
# ├── quote
|
23
|
+
# ├── date
|
24
|
+
# └── character
|
25
|
+
# Faker::Finance
|
26
|
+
# └── credit_card
|
27
|
+
# ....
|
28
|
+
```
|
29
|
+
|
30
|
+
`faker` also includes an option to display sample output via the `--verbose` or `-v` flag. :wink:
|
31
|
+
|
32
|
+
3.)
|
33
|
+
|
34
|
+
```sh
|
35
|
+
$ faker list -v
|
36
|
+
# Faker::Appliance
|
37
|
+
# ├── brand=> Whirlpool
|
38
|
+
# └── equipment=> Sump pump
|
39
|
+
# Faker::UmphreysMcgee
|
40
|
+
# └── song=> Headphones & Snowcones
|
41
|
+
$ faker search name -v
|
42
|
+
# Faker::App
|
43
|
+
# └── name=> Subin
|
44
|
+
# Faker::Address
|
45
|
+
# └── street_name=> Percy Landing
|
46
|
+
# ....
|
47
|
+
```
|
48
|
+
|
49
|
+
## Features! :sunglasses: :dancers:
|
50
|
+
|
51
|
+
- [x] List classes with methods E.g. Faker::FunnyName is displayed with `.name`,`.first_name` e.t.c.
|
52
|
+
- [x] Expand search to Faker::Base sub classes
|
53
|
+
- [x] Paginate results :book:
|
54
|
+
|
55
|
+
![screenshot 2019-01-05 at 03 02 08](https://user-images.githubusercontent.com/17295175/50717135-59d85780-1096-11e9-8d0d-eca95646644d.jpg)
|
data/lib/cli/command.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
|
5
|
+
require_relative 'renderer'
|
6
|
+
|
7
|
+
module Faker
|
8
|
+
module CLI
|
9
|
+
class Command
|
10
|
+
extend Forwardable
|
11
|
+
|
12
|
+
def_delegators :command, :run
|
13
|
+
attr_reader :options
|
14
|
+
|
15
|
+
def initialize(options)
|
16
|
+
@options = options
|
17
|
+
end
|
18
|
+
|
19
|
+
def render(result, output)
|
20
|
+
Renderer.call(result, options, output)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../command'
|
4
|
+
require_relative '../reflectors/list'
|
5
|
+
|
6
|
+
module Faker
|
7
|
+
module CLI
|
8
|
+
module Commands
|
9
|
+
class List < Command
|
10
|
+
def execute(output: $stdout)
|
11
|
+
result = Reflectors::List.call(options)
|
12
|
+
render(result, output)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../command'
|
4
|
+
require_relative '../reflectors/search'
|
5
|
+
|
6
|
+
module Faker
|
7
|
+
module CLI
|
8
|
+
module Commands
|
9
|
+
class Search < Command
|
10
|
+
def execute(input, output: $stdout)
|
11
|
+
result = Reflectors::Search.call(input)
|
12
|
+
render(result, output)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def render(result, output)
|
18
|
+
return not_found(output) if result.empty?
|
19
|
+
|
20
|
+
super(result, output)
|
21
|
+
end
|
22
|
+
|
23
|
+
def not_found(output)
|
24
|
+
output.puts "\nSorry, we couldn't find a match 😢", "\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faker'
|
4
|
+
|
5
|
+
module Faker
|
6
|
+
module CLI
|
7
|
+
# Abstract `Faker` Reflector - introspects the `Faker` module
|
8
|
+
#
|
9
|
+
# @api private
|
10
|
+
# @abstract
|
11
|
+
#
|
12
|
+
class Reflector
|
13
|
+
Faker::Base.class_eval do
|
14
|
+
# Select `Faker` subclasses
|
15
|
+
# @return [Array] `Faker::Base` sub classes
|
16
|
+
def self.descendants
|
17
|
+
@descendants ||= ObjectSpace.each_object(Class).select do |klass|
|
18
|
+
klass < self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Select public class methods
|
23
|
+
# @return [Array] public methods
|
24
|
+
def self.my_singleton_methods
|
25
|
+
singleton_methods(false).select { |m| respond_to?(m) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
attr_reader :descendants_with_methods
|
30
|
+
|
31
|
+
def initialize(*)
|
32
|
+
@descendants_with_methods = Hash.new { |h, k| h[k] = [] }
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def store(descendant, methods)
|
38
|
+
return if methods.empty?
|
39
|
+
|
40
|
+
descendants_with_methods[descendant].concat(methods)
|
41
|
+
end
|
42
|
+
|
43
|
+
def faker_descendants
|
44
|
+
@faker_descendants ||= Faker::Base.descendants
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|