Skip to content

Commit

Permalink
Add Faker::Games namespace (#1412)
Browse files Browse the repository at this point in the history
* Move games files into 'games' folder

* Migrate all 'elder_scrolls' code to the 'games' namespace

* Move 'zelda' to the correct 'namespace'

* Update 'fallout' to be in the 'games' namespace

* Update 'pokemon' to be in the 'games' namespace

* Update 'world_of_warcraft' to be in the 'games' namespace

* Update 'overwatch' to be in the 'games' namespace

* Update 'myst' to be in the 'games' namespace

* Update 'league_of_legends' to be in the 'games' namespace

* Update 'dota' to be in the 'games' namespace

* Move 'witcher' to be under 'games' namespace

* Remove rubocop warning

* Restore old file, deprecate methods in favour of new namespaced version

* Restore 'dota' file, add deprecations

* Restore 'elder_scrolls' and deprecate

* Restore 'heroes_of_the_storm' and deprecate

* Restore 'league_of_legends' and deprecate

* Restore 'myst' and deprecate

* Restore 'overwatch' and deprecate

* Restore 'pokemon' and deprecate

* Restore 'world_of_warcraft' and deprecate

* Restore 'zelda' and deprecate

* Address mucked up merge

* Restore 'fallout' and deprecate

* Merge mess still

* Address rubocop violation

* Remove duplicated entry

* Remove extra '::'

* Add tests for the newly deprecated methods

* Update CHANGELOG.md
  • Loading branch information
ChaoticBoredom authored and vbrazo committed Oct 22, 2018
1 parent 784c987 commit a34e418
Show file tree
Hide file tree
Showing 70 changed files with 1,181 additions and 502 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- [PR #372](https://github.com/stympy/faker/pull/372) Add test_password_could_achieve_max_length [@oleksii-ti](https://github.com/oleksii-ti)

### Deprecation
- [PR #1412](https://github.com/stympy/faker/pull/1412) Add Faker::Games namespace [@ChaoticBoredom](https://github.com/ChaoticBoredom)
- Deprecates `::Dota`, `::ElderScrolls`, `::Fallout`, `::LeagueOfLegends`, `::Myst`, `::Overwatch`, `::Pokemon`, `::Witcher`, `::WorldOfWarcraft` and `::Zelda`
- [PR #1424](https://github.com/stympy/faker/pull/1424) Add Faker::Creature namespace [@ChaoticBoredom](https://github.com/ChaoticBoredom)
- Deprecates `::Cat` and `::Dog`
- [PR #1420](https://github.com/stympy/faker/pull/1420) Add Faker::JapaneseMedia namespace [@boardfish](https://github.com/boardfish)
Expand Down
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!"
```
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
Loading

0 comments on commit a34e418

Please sign in to comment.