Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Faker::Games namespace #1412

Merged
merged 34 commits into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
49180e1
Move games files into 'games' folder
ChaoticBoredom Oct 8, 2018
5b42e14
Migrate all 'elder_scrolls' code to the 'games' namespace
ChaoticBoredom Oct 16, 2018
eb9f0a0
Move 'zelda' to the correct 'namespace'
ChaoticBoredom Oct 16, 2018
184103c
Update 'fallout' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
f9073b7
Update 'pokemon' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
877e1c5
Update 'world_of_warcraft' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
e7d880c
Update 'overwatch' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
66184df
Update 'myst' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
d9ea55d
Update 'league_of_legends' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
1a6de7e
Update 'dota' to be in the 'games' namespace
ChaoticBoredom Oct 16, 2018
05380ea
Merge branch 'master' into organize-games-into-games-dir
ChaoticBoredom Oct 16, 2018
f8412a9
Move 'witcher' to be under 'games' namespace
ChaoticBoredom Oct 17, 2018
0749b85
Remove rubocop warning
ChaoticBoredom Oct 17, 2018
58275a8
Restore old file, deprecate methods in favour of new namespaced version
ChaoticBoredom Oct 18, 2018
83eacbf
Restore 'dota' file, add deprecations
ChaoticBoredom Oct 18, 2018
48568d1
Restore 'elder_scrolls' and deprecate
ChaoticBoredom Oct 18, 2018
d7ab01b
Restore 'heroes_of_the_storm' and deprecate
ChaoticBoredom Oct 20, 2018
f5fa773
Restore 'league_of_legends' and deprecate
ChaoticBoredom Oct 20, 2018
bc36528
Restore 'myst' and deprecate
ChaoticBoredom Oct 20, 2018
bb1571b
Restore 'overwatch' and deprecate
ChaoticBoredom Oct 20, 2018
7be5b5a
Restore 'pokemon' and deprecate
ChaoticBoredom Oct 20, 2018
d36540a
Restore 'world_of_warcraft' and deprecate
ChaoticBoredom Oct 20, 2018
54c5e7b
Restore 'zelda' and deprecate
ChaoticBoredom Oct 20, 2018
ae0929e
Merge branch 'master' into organize-games-into-games-dir
ChaoticBoredom Oct 20, 2018
fc36de5
Address mucked up merge
ChaoticBoredom Oct 20, 2018
d883d75
Restore 'fallout' and deprecate
ChaoticBoredom Oct 20, 2018
9fdf518
Merge mess still
ChaoticBoredom Oct 20, 2018
7e761bf
Address rubocop violation
ChaoticBoredom Oct 20, 2018
228e762
Remove duplicated entry
ChaoticBoredom Oct 20, 2018
963de38
Remove extra '::'
ChaoticBoredom Oct 20, 2018
8847254
Add tests for the newly deprecated methods
ChaoticBoredom Oct 20, 2018
0f56f8f
Merge remote-tracking branch 'origin/master' into organize-games-into…
ChaoticBoredom Oct 21, 2018
c8f3cd6
Update CHANGELOG.md
vbrazo Oct 22, 2018
bee5c8d
Merge branch 'master' into organize-games-into-games-dir
vbrazo Oct 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,13 @@ Contents
- [Faker::Demographic](doc/demographic.md)
- [Faker::Dessert](doc/dessert.md)
- [Faker::Device](doc/device.md)
- [Faker::Dota](doc/dota.md)
- [Faker::DrWho](doc/dr_who.md)
- [Faker::DumbAndDumber](doc/dumb_and_dumber.md)
- [Faker::Dune](doc/dune.md)
- [Faker::Educator](doc/educator.md)
- [Faker::ElderScrolls](doc/elder_scrolls.md)
- [Faker::ElectricalComponents](doc/electrical_components.md)
- [Faker::Esport](doc/esport.md)
- [Faker::Ethereum](doc/ethereum.md)
- [Faker::Fallout](doc/fallout.md)
- [Faker::FamilyGuy](doc/family_guy.md)
- [Faker::FamousLastWords](doc/famous_last_words.md)
- [Faker::File](doc/file.md)
Expand All @@ -86,11 +83,21 @@ Contents
- [Faker::Friends](doc/friends.md)
- [Faker::FunnyName](doc/funny_name.md)
- [Faker::GameOfThrones](doc/game_of_thrones.md)
- [Faker::Games::Dota](doc/dota.md)
- [Faker::Games::ElderScrolls](doc/elder_scrolls.md)
- [Faker::Games::Fallout](doc/fallout.md)
- [Faker::Games::HalfLife](doc/half_life.md)
- [Faker::Games::Heroes](doc/heroes.md)
- [Faker::Games::HeroesOfTheStorm](doc/heroes_of_the_storm.md)
- [Faker::Games::LeagueOfLegends](doc/league_of_legends.md)
- [Faker::Games::Myst](doc/myst.md)
- [Faker::Games::Overwatch](doc/overwatch.md)
- [Faker::Games::Pokemon](doc/pokemon.md)
- [Faker::Games::SonicTheHedgehog](doc/sonic_the_hedgehog.md)
- [Faker::Games::SuperSmashBros](doc/super_smash_bros.md)
- [Faker::Games::Witcher](doc/witcher.md)
- [Faker::Games::WorldOfWarcraft](doc/world_of_warcraft.md)
- [Faker::Games::Zelda](doc/zelda.md)
- [Faker::Gender](doc/gender.md)
- [Faker::GreekPhilosophers](doc/greek_philosophers.md)
- [Faker::Hacker](doc/hacker.md)
Expand All @@ -110,7 +117,6 @@ Contents
- [Faker::Job](doc/job.md)
- [Faker::Json](doc/json.md)
- [Faker::Kpop](doc/kpop.md)
- [Faker::LeagueOfLegends](doc/league_of_legends.md)
- [Faker::Lebowski](doc/lebowski.md)
- [Faker::LordOfTheRings](doc/lord_of_the_rings.md)
- [Faker::Lorem](doc/lorem.md)
Expand All @@ -128,19 +134,16 @@ Contents
- [Faker::Movies::GratefulDead](doc/grateful_dead.md)
- [Faker::Movies::SouthPark](doc/south_park.md)
- [Faker::Music](doc/music.md)
- [Faker::Myst](doc/myst.md)
- [Faker::Name](doc/name.md)
- [Faker::Nation](doc/nation.md)
- [Faker::NatoPhoneticAlphabet](doc/nato_phonetic_alphabet.md)
- [Faker::NewGirl](doc/new_girl.md)
- [Faker::NationalHealthService](doc/national_health_service.md)
- [Faker::Number](doc/number.md)
- [Faker::Omniauth](doc/omniauth.md)
- [Faker::Overwatch](doc/overwatch.md)
- [Faker::ParksAndRec](doc/parks_and_rec.md)
- [Faker::PhoneNumber](doc/phone_number.md)
- [Faker::Placeholdit](doc/placeholdit.md)
- [Faker::Pokemon](doc/pokemon.md)
- [Faker::PrincessBride](doc/princess_bride.md)
- [Faker::ProgrammingLanguage](doc/programming_language.md)
- [Faker::Relationship](doc/relationship.md)
Expand Down Expand Up @@ -179,10 +182,7 @@ Contents
- [Faker::VentureBros](doc/venture_bros.md)
- [Faker::Verbs](doc/verbs.md)
- [Faker::VForVendetta](doc/v_for_vendetta.md)
- [Faker::Witcher](doc/witcher.md)
- [Faker::WorldCup](doc/world_cup.md)
- [Faker::WorldOfWarcraft](doc/world_of_warcraft.md)
- [Faker::Zelda](doc/zelda.md)
- [Customization](#customization)
- [Contributing](#contributing)
- [Contact](#contact)
Expand Down
16 changes: 8 additions & 8 deletions doc/dota.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Faker::Dota
# Faker::Games::Dota

Available since version 1.9.0.

```ruby
# Random hero
Faker::Dota.hero #=> "Abaddon"
Faker::Games::Dota.hero #=> "Abaddon"

# Random item
Faker::Dota.item #=> "You have called death upon yourself."
Faker::Games::Dota.item #=> "You have called death upon yourself."

# Random team
Faker::Dota.team #=> "Evil Geniuses"
Faker::Games::Dota.team #=> "Evil Geniuses"

# Random player
Faker::Dota.player #=> "Dendi"
Faker::Games::Dota.player #=> "Dendi"

# Random quote
Faker::Dota.quote #=> "Easy now, this stuff is explosive!"
Faker::Dota.quote(hero = 'alchemist') #=> "Better living through alchemy!"
```
Faker::Games::Dota.quote #=> "Easy now, this stuff is explosive!"
Faker::Games::Dota.quote(hero = 'alchemist') #=> "Better living through alchemy!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we convert this parameter to a keyword argument as it was suggested in this issue #603?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could that be done as a follow-up? Keep this PR as more of a strict re-org?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

```
18 changes: 9 additions & 9 deletions doc/elder_scrolls.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Faker::ElderScrolls
# Faker::Games::ElderScrolls

```ruby
Faker::ElderScrolls.race #=> Argonian
Faker::Games::ElderScrolls.race #=> Argonian

Faker::ElderScrolls.city #=> Solitude
Faker::Games::ElderScrolls.city #=> Solitude

Faker::ElderScrolls.creature #=> Frost Troll
Faker::Games::ElderScrolls.creature #=> Frost Troll

Faker::ElderScrolls.region #=> Cyrodiil
Faker::Games::ElderScrolls.region #=> Cyrodiil

Faker::ElderScrolls.dragon #=> Blood Dragon
Faker::Games::ElderScrolls.dragon #=> Blood Dragon

Faker::ElderScrolls.first_name #=> Astrid
Faker::Games::ElderScrolls.first_name #=> Astrid

Faker::ElderScrolls.last_name #=> Mallory
Faker::Games::ElderScrolls.last_name #=> Mallory

Faker::ElderScrolls.name #=> Babette Brill
Faker::Games::ElderScrolls.name #=> Babette Brill
```
12 changes: 6 additions & 6 deletions doc/fallout.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Faker::Fallout
# Faker::Games::Fallout

```ruby
Faker::Fallout.character #=> "Dogmeat"
Faker::Games::Fallout.character #=> "Dogmeat"

Faker::Fallout.faction #=> "The Institute"
Faker::Games::Fallout.faction #=> "The Institute"

Faker::Fallout.location #=> "Capital Wasteland"
Faker::Games::Fallout.location #=> "Capital Wasteland"

Faker::Fallout.quote #=> "Democracy is non-negotiable"
```
Faker::Games::Fallout.quote #=> "Democracy is non-negotiable"
```
14 changes: 7 additions & 7 deletions doc/league_of_legends.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Faker::LeagueOfLegends
# Faker::Games::LeagueOfLegends

Available since version 1.8.0.

```ruby
Faker::LeagueOfLegends.champion #=> "Jarvan IV"
Faker::Games::LeagueOfLegends.champion #=> "Jarvan IV"

Faker::LeagueOfLegends.location #=> "Demacia"
Faker::Games::LeagueOfLegends.location #=> "Demacia"

Faker::LeagueOfLegends.quote #=> "Purge the unjust."
Faker::Games::LeagueOfLegends.quote #=> "Purge the unjust."

Faker::LeagueOfLegends.summoner_spell #=> "Flash"
Faker::Games::LeagueOfLegends.summoner_spell #=> "Flash"

Faker::LeagueOfLegends.masteries #=> "Double Edged Sword"
Faker::Games::LeagueOfLegends.masteries #=> "Double Edged Sword"

Faker::LeagueOfLegends.rank #=> "Bronze V"
Faker::Games::LeagueOfLegends.rank #=> "Bronze V"
```
12 changes: 6 additions & 6 deletions doc/myst.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Faker::Myst
# Faker::Games::Myst

Available since version 1.9.0.

```ruby
Faker::Myst.game #=> "Myst III: Exile"
Faker::Games::Myst.game #=> "Myst III: Exile"

Faker::Myst.creature #=> "squee"
Faker::Games::Myst.creature #=> "squee"

Faker::Myst.age #=> "Relto"
Faker::Games::Myst.age #=> "Relto"

Faker::Myst.character #=> "Gehn"
Faker::Games::Myst.character #=> "Gehn"

Faker::Myst.quote #=> "I realized, the moment I fell into the fissure, that the Book would not be destroyed as I had planned."
Faker::Games::Myst.quote #=> "I realized, the moment I fell into the fissure, that the Book would not be destroyed as I had planned."
```
8 changes: 4 additions & 4 deletions doc/overwatch.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Faker::Overwatch
# Faker::Games::Overwatch

Available since version 1.8.0.

```ruby
Faker::Overwatch.hero #=> "Tracer"
Faker::Games::Overwatch.hero #=> "Tracer"

Faker::Overwatch.location #=> "Numbani"
Faker::Games::Overwatch.location #=> "Numbani"

Faker::Overwatch.quote #=> "It's high noon"
Faker::Games::Overwatch.quote #=> "It's high noon"
```
8 changes: 4 additions & 4 deletions doc/pokemon.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Faker::Pokemon
# Faker::Games::Pokemon

Available since version 1.7.0.

```ruby
Faker::Pokemon.name #=> "Pikachu"
Faker::Games::Pokemon.name #=> "Pikachu"

Faker::Pokemon.location #=> "Pallet Town"
Faker::Games::Pokemon.location #=> "Pallet Town"

Faker::Pokemon.move #=> "Thunder Shock"
Faker::Games::Pokemon.move #=> "Thunder Shock"
```
14 changes: 7 additions & 7 deletions doc/witcher.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Faker::Witcher
# Faker::Games::Witcher

```ruby

Faker::Witcher.character # => "Triss Merigold"
Faker::Games::Witcher.character # => "Triss Merigold"

Faker::Witcher.witcher # => "Geralt of Rivia"
Faker::Games::Witcher.witcher # => "Geralt of Rivia"

Faker::Witcher.location # => "Novigrad"
Faker::Games::Witcher.location # => "Novigrad"

Faker::Witcher.school # => "Wolf"
Faker::Games::Witcher.school # => "Wolf"

Faker::Witcher.quote # => "No Lollygagin'!"
Faker::Games::Witcher.quote # => "No Lollygagin'!"

Faker::Witcher.monster # => "Katakan"
Faker::Games::Witcher.monster # => "Katakan"
6 changes: 3 additions & 3 deletions doc/world_of_warcraft.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Faker::WorldOfWarcraft
# Faker::Games::WorldOfWarcraft

```ruby
# Generate random character from the World of Warcraft
Faker::WorldOfWarcraft.hero #=> "Uther the Lightbringer"
Faker::Games::WorldOfWarcraft.hero #=> "Uther the Lightbringer"

# Generate random quote from the World of Warcraft
Faker::WorldOfWarcraft.quote #=> "These are dark times indeed."
Faker::Games::WorldOfWarcraft.quote #=> "These are dark times indeed."
```
10 changes: 5 additions & 5 deletions doc/zelda.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Faker::Zelda
# Faker::Games::Zelda

Available since version 1.7.3.

```ruby
# Random Zelda game
Faker::Zelda.game #=> "Ocarina of Time"
Faker::Games::Zelda.game #=> "Ocarina of Time"

# Random Zelda character
Faker::Zelda.character #=> "Guru-Guru"
Faker::Games::Zelda.character #=> "Guru-Guru"

# Random Zelda location
Faker::Zelda.location #=> "Tarrey Town"
Faker::Games::Zelda.location #=> "Tarrey Town"

# Random Zelda item
Faker::Zelda.item #=> "Master Sword"
Faker::Games::Zelda.item #=> "Master Sword"
```
20 changes: 14 additions & 6 deletions lib/faker/dota.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
# frozen_string_literal: true

module Faker
class Dota < Base
module Dota
class << self
extend Gem::Deprecate

def hero
fetch('dota.hero')
Faker::Games::Dota.hero
end

def item
fetch('dota.item')
Faker::Games::Dota.item
end

def team
fetch('dota.team')
Faker::Games::Dota.team
end

def player
fetch('dota.player')
Faker::Games::Dota.player
end

def quote(hero = 'abaddon')
fetch("dota.#{hero}.quote")
Faker::Games::Dota.quote(hero)
end

deprecate :hero, 'Faker::Games::Dota.hero', 2018, 10
deprecate :item, 'Faker::Games::Dota.item', 2018, 10
deprecate :team, 'Faker::Games::Dota.team', 2018, 10
deprecate :player, 'Faker::Games::Dota.player', 2018, 10
deprecate :quote, 'Faker::Games::Dota.quote', 2018, 10
end
end
end
29 changes: 20 additions & 9 deletions lib/faker/elder_scrolls.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
# frozen_string_literal: true

module Faker
class ElderScrolls < Base
module ElderScrolls
class << self
extend Gem::Deprecate

def race
fetch('elder_scrolls.race')
Faker::Games::ElderScrolls.race
end

def city
fetch('elder_scrolls.city')
Faker::Games::ElderScrolls.city
end

def creature
fetch('elder_scrolls.creature')
Faker::Games::ElderScrolls.creature
end

def region
fetch('elder_scrolls.region')
Faker::Games::ElderScrolls.region
end

def dragon
fetch('elder_scrolls.dragon')
Faker::Games::ElderScrolls.dragon
end

def name
"#{fetch('elder_scrolls.first_name')} #{fetch('elder_scrolls.last_name')}"
Faker::Games::ElderScrolls.name
end

def first_name
fetch('elder_scrolls.first_name')
Faker::Games::ElderScrolls.first_name
end

def last_name
fetch('elder_scrolls.last_name')
Faker::Games::ElderScrolls.last_name
end

deprecate :race, 'Faker::Games::ElderScrolls.race', 2018, 10
deprecate :city, 'Faker::Games::ElderScrolls.city', 2018, 10
deprecate :creature, 'Faker::Games::ElderScrolls.creature', 2018, 10
deprecate :region, 'Faker::Games::ElderScrolls.region', 2018, 10
deprecate :dragon, 'Faker::Games::ElderScrolls.dragon', 2018, 10
deprecate :name, 'Faker::Games::ElderScrolls.name', 2018, 10
deprecate :first_name, 'Faker::Games::ElderScrolls.first_name', 2018, 10
deprecate :last_name, 'Faker::Games::ElderScrolls.last_name', 2018, 10
end
end
end
Loading