From 971ab7654fddcf3421516ec8283220b6718ca8e5 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Tue, 2 Oct 2018 00:50:32 -0400 Subject: [PATCH 1/5] Add Faker::HalfLife --- doc/half_life.md | 12 ++++++++++++ lib/faker/half_life.rb | 19 +++++++++++++++++++ lib/locales/en/half_life.yml | 6 ++++++ test/test_half_life.rb | 21 +++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 doc/half_life.md create mode 100644 lib/faker/half_life.rb create mode 100644 lib/locales/en/half_life.yml create mode 100644 test/test_half_life.rb diff --git a/doc/half_life.md b/doc/half_life.md new file mode 100644 index 0000000000..301e16137b --- /dev/null +++ b/doc/half_life.md @@ -0,0 +1,12 @@ +# Faker::HalfLife + +Available since version 1.9.1. + +```ruby +# Any character from the game +Faker::HalfLife.character #=> "Gordon Freeman" + +Faker::HalfLife.enemy #=> "Houndeye" + +Faker::HalfLife.location #=> "Black Mesa Research Facility" +``` \ No newline at end of file diff --git a/lib/faker/half_life.rb b/lib/faker/half_life.rb new file mode 100644 index 0000000000..23f7e32ec1 --- /dev/null +++ b/lib/faker/half_life.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Faker + class HalfLife < Base + class << self + def character + fetch('half_life.character') + end + + def enemy + fetch('half_life.enemy') + end + + def location + fetch('half_life.location') + end + end + end +end \ No newline at end of file diff --git a/lib/locales/en/half_life.yml b/lib/locales/en/half_life.yml new file mode 100644 index 0000000000..a4f9f927db --- /dev/null +++ b/lib/locales/en/half_life.yml @@ -0,0 +1,6 @@ +en: + faker: + half_life: + character: ["Gordon Freeman", "Barney Calhoun", "Wallace Breen", "Adrian Shephard", "G-Man", "Gina Cross", "Colette Green", "Richard Keller", "Walter Bennett", "Simmons", "Alyx Vance", "Isaac Kleiner", "Eli Vance", "Arne Magnusson", "Dog", "Judith Mossman", "Odessa Cubbage", "Father Grigori"] + enemy: ["Headcrab", "Zombie", "Barnacle", "Houndeye", "Bullsquid", "Alien Grunt", "Tentacle", "Ichthyosaur", "Snark", "Garg", "Alien Controller", "Gonarch", "Baby Headcrab", "Grunt", "Assassin", "Antlion", "Antlion Guard", "Fast Headcrab", "Fast Zombie", "Leech", "Poison Headcrab", "Poison Zombie", "APC", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Hopper Mine", "Hunter-Chopper", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Rollermine", "Shield Scanner", "Strider", "Snark", "Vortigaunt"] + location: ["Black Mesa Research Facility", "Xen", "City 17", "Black Mesa East", "Ravenholm", "Nova Prospekt", "White Forest", "St. Olga", "Citadel", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric"] \ No newline at end of file diff --git a/test/test_half_life.rb b/test/test_half_life.rb new file mode 100644 index 0000000000..6ffddfe562 --- /dev/null +++ b/test/test_half_life.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require_relative 'test_helper' + +class TestFakerHalfLife < Test::Unit::TestCase + def setup + @tester = Faker::HalfLife + end + + def test_character + assert @tester.character.match(/\w+/) + end + + def test_enemy + assert @tester.enemy.match(/\w+/) + end + + def test_location + assert @tester.location.match(/\w+/) + end +end From f038b32083609d08062227c33c087d36e9a86917 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Tue, 2 Oct 2018 02:55:28 -0400 Subject: [PATCH 2/5] add line for rubocop add more comments to doc fix a typo in a character name add more enemies --- doc/half_life.md | 2 ++ lib/faker/half_life.rb | 2 +- lib/locales/en/half_life.yml | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/half_life.md b/doc/half_life.md index 301e16137b..09729bc2ee 100644 --- a/doc/half_life.md +++ b/doc/half_life.md @@ -6,7 +6,9 @@ Available since version 1.9.1. # Any character from the game Faker::HalfLife.character #=> "Gordon Freeman" +# Any enemy from the game Faker::HalfLife.enemy #=> "Houndeye" +# Any location from the game Faker::HalfLife.location #=> "Black Mesa Research Facility" ``` \ No newline at end of file diff --git a/lib/faker/half_life.rb b/lib/faker/half_life.rb index 23f7e32ec1..4b3fb645e7 100644 --- a/lib/faker/half_life.rb +++ b/lib/faker/half_life.rb @@ -16,4 +16,4 @@ def location end end end -end \ No newline at end of file +end diff --git a/lib/locales/en/half_life.yml b/lib/locales/en/half_life.yml index a4f9f927db..73661faf9d 100644 --- a/lib/locales/en/half_life.yml +++ b/lib/locales/en/half_life.yml @@ -1,6 +1,6 @@ en: faker: half_life: - character: ["Gordon Freeman", "Barney Calhoun", "Wallace Breen", "Adrian Shephard", "G-Man", "Gina Cross", "Colette Green", "Richard Keller", "Walter Bennett", "Simmons", "Alyx Vance", "Isaac Kleiner", "Eli Vance", "Arne Magnusson", "Dog", "Judith Mossman", "Odessa Cubbage", "Father Grigori"] - enemy: ["Headcrab", "Zombie", "Barnacle", "Houndeye", "Bullsquid", "Alien Grunt", "Tentacle", "Ichthyosaur", "Snark", "Garg", "Alien Controller", "Gonarch", "Baby Headcrab", "Grunt", "Assassin", "Antlion", "Antlion Guard", "Fast Headcrab", "Fast Zombie", "Leech", "Poison Headcrab", "Poison Zombie", "APC", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Hopper Mine", "Hunter-Chopper", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Rollermine", "Shield Scanner", "Strider", "Snark", "Vortigaunt"] - location: ["Black Mesa Research Facility", "Xen", "City 17", "Black Mesa East", "Ravenholm", "Nova Prospekt", "White Forest", "St. Olga", "Citadel", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric"] \ No newline at end of file + character: ["Adrian Shephard", "Alyx Vance", "Arne Magnusson", "Barney Calhoun", "Colette Green", "Dog", "Eli Vance", "Father Grigori", "G-Man", "Gina Cross", "Gordon Freeman", "Isaac Kleiner", "Judith Mossman", "Odessa Cubbage", "Richard Keller", "Simmons", "Wallace Breen", "Walter Bennet"] + enemy: ["APC", "Alien Controller", "Alien Grunt", "Antlion", "Antlion Guard", "Assassin", "Baby Headcrab", "Barnacle", "Bullsquid", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Fast Headcrab", "Fast Zombie", "Garg", "Gene Worm", "Gonarch", "Grunt", "Headcrab", "Hopper Mine", "Houndeye", "Hunter-Chopper", "Ichthyosaur", "Leech", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Pit Drone", "Pit Worm", "Poison Headcrab", "Poison Zombie", "Rollermine", "Shield Scanner", "Shock Roach", "Shock Trooper", "Snark", "Snark", "Strider", "Tentacle", "Voltigore", "Vortigaunt", "Zombie"] + location: ["Black Mesa East", "Black Mesa Research Facility", "Citadel", "City 17", "Earth", "Nova Prospekt", "Ravenholm", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric", "St. Olga", "White Forest", "Xen"] From ae4777e9ab86b3d42fa88c7e89f325759f40490f Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Tue, 2 Oct 2018 03:09:22 -0400 Subject: [PATCH 3/5] remove duplicate enemy. --- lib/locales/en/half_life.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/locales/en/half_life.yml b/lib/locales/en/half_life.yml index 73661faf9d..ceab52a217 100644 --- a/lib/locales/en/half_life.yml +++ b/lib/locales/en/half_life.yml @@ -2,5 +2,5 @@ en: faker: half_life: character: ["Adrian Shephard", "Alyx Vance", "Arne Magnusson", "Barney Calhoun", "Colette Green", "Dog", "Eli Vance", "Father Grigori", "G-Man", "Gina Cross", "Gordon Freeman", "Isaac Kleiner", "Judith Mossman", "Odessa Cubbage", "Richard Keller", "Simmons", "Wallace Breen", "Walter Bennet"] - enemy: ["APC", "Alien Controller", "Alien Grunt", "Antlion", "Antlion Guard", "Assassin", "Baby Headcrab", "Barnacle", "Bullsquid", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Fast Headcrab", "Fast Zombie", "Garg", "Gene Worm", "Gonarch", "Grunt", "Headcrab", "Hopper Mine", "Houndeye", "Hunter-Chopper", "Ichthyosaur", "Leech", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Pit Drone", "Pit Worm", "Poison Headcrab", "Poison Zombie", "Rollermine", "Shield Scanner", "Shock Roach", "Shock Trooper", "Snark", "Snark", "Strider", "Tentacle", "Voltigore", "Vortigaunt", "Zombie"] + enemy: ["APC", "Alien Controller", "Alien Grunt", "Antlion", "Antlion Guard", "Assassin", "Baby Headcrab", "Barnacle", "Bullsquid", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Fast Headcrab", "Fast Zombie", "Garg", "Gene Worm", "Gonarch", "Grunt", "Headcrab", "Hopper Mine", "Houndeye", "Hunter-Chopper", "Ichthyosaur", "Leech", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Pit Drone", "Pit Worm", "Poison Headcrab", "Poison Zombie", "Rollermine", "Shield Scanner", "Shock Roach", "Shock Trooper", "Snark", "Strider", "Tentacle", "Voltigore", "Vortigaunt", "Zombie"] location: ["Black Mesa East", "Black Mesa Research Facility", "Citadel", "City 17", "Earth", "Nova Prospekt", "Ravenholm", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric", "St. Olga", "White Forest", "Xen"] From c0bf4baaf1b0d10a292301c6dd9e9a32a1b2ae88 Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Tue, 2 Oct 2018 12:34:57 -0300 Subject: [PATCH 4/5] Update half_life.md --- doc/half_life.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/half_life.md b/doc/half_life.md index 09729bc2ee..abd426610b 100644 --- a/doc/half_life.md +++ b/doc/half_life.md @@ -1,6 +1,6 @@ # Faker::HalfLife -Available since version 1.9.1. +It might be available in the next version. ```ruby # Any character from the game @@ -11,4 +11,4 @@ Faker::HalfLife.enemy #=> "Houndeye" # Any location from the game Faker::HalfLife.location #=> "Black Mesa Research Facility" -``` \ No newline at end of file +``` From 22d81928cdc3cef1fde690de0abe82fed8d22653 Mon Sep 17 00:00:00 2001 From: Justin Thompson Date: Tue, 2 Oct 2018 17:04:50 -0400 Subject: [PATCH 5/5] update README add namespace for Faker::Games --- README.md | 1 + doc/half_life.md | 8 ++++---- lib/faker.rb | 2 ++ lib/faker/games.rb | 6 ++++++ lib/faker/games/half_life.rb | 21 +++++++++++++++++++++ lib/faker/half_life.rb | 19 ------------------- lib/locales/en/half_life.yml | 9 +++++---- test/test_determinism.rb | 2 +- test/test_half_life.rb | 4 ++-- 9 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 lib/faker/games.rb create mode 100644 lib/faker/games/half_life.rb delete mode 100644 lib/faker/half_life.rb diff --git a/README.md b/README.md index ba651a556d..bb7dd3f444 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Contents - [Faker::Friends](doc/friends.md) - [Faker::FunnyName](doc/funny_name.md) - [Faker::GameOfThrones](doc/game_of_thrones.md) + - [Faker::Games::HalfLife](doc/half_life.md) - [Faker::Gender](doc/gender.md) - [Faker::GratefulDead](doc/grateful_dead.md) - [Faker::GreekPhilosophers](doc/greek_philosophers.md) diff --git a/doc/half_life.md b/doc/half_life.md index abd426610b..cd2172dc73 100644 --- a/doc/half_life.md +++ b/doc/half_life.md @@ -1,14 +1,14 @@ -# Faker::HalfLife +# Faker::Games::HalfLife It might be available in the next version. ```ruby # Any character from the game -Faker::HalfLife.character #=> "Gordon Freeman" +Faker::Games::HalfLife.character #=> "Gordon Freeman" # Any enemy from the game -Faker::HalfLife.enemy #=> "Houndeye" +Faker::Games::HalfLife.enemy #=> "Houndeye" # Any location from the game -Faker::HalfLife.location #=> "Black Mesa Research Facility" +Faker::Games::HalfLife.location #=> "Black Mesa Research Facility" ``` diff --git a/lib/faker.rb b/lib/faker.rb index ad901b07a2..788a1cc683 100644 --- a/lib/faker.rb +++ b/lib/faker.rb @@ -248,6 +248,8 @@ def disable_enforce_available_locales Dir.glob(File.join(File.dirname(__FILE__), 'faker', '*.rb')).sort.each { |f| require f } +require 'faker/games/half_life' + require 'helpers/char' require 'helpers/unique_generator' require 'helpers/base58' diff --git a/lib/faker/games.rb b/lib/faker/games.rb new file mode 100644 index 0000000000..cc95d35d9f --- /dev/null +++ b/lib/faker/games.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +module Faker + module Games + end +end diff --git a/lib/faker/games/half_life.rb b/lib/faker/games/half_life.rb new file mode 100644 index 0000000000..ad29d3ef54 --- /dev/null +++ b/lib/faker/games/half_life.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Faker + module Games + class HalfLife < Base + class << self + def character + fetch('games.half_life.character') + end + + def enemy + fetch('games.half_life.enemy') + end + + def location + fetch('games.half_life.location') + end + end + end + end +end diff --git a/lib/faker/half_life.rb b/lib/faker/half_life.rb deleted file mode 100644 index 4b3fb645e7..0000000000 --- a/lib/faker/half_life.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Faker - class HalfLife < Base - class << self - def character - fetch('half_life.character') - end - - def enemy - fetch('half_life.enemy') - end - - def location - fetch('half_life.location') - end - end - end -end diff --git a/lib/locales/en/half_life.yml b/lib/locales/en/half_life.yml index ceab52a217..2c95608b93 100644 --- a/lib/locales/en/half_life.yml +++ b/lib/locales/en/half_life.yml @@ -1,6 +1,7 @@ en: faker: - half_life: - character: ["Adrian Shephard", "Alyx Vance", "Arne Magnusson", "Barney Calhoun", "Colette Green", "Dog", "Eli Vance", "Father Grigori", "G-Man", "Gina Cross", "Gordon Freeman", "Isaac Kleiner", "Judith Mossman", "Odessa Cubbage", "Richard Keller", "Simmons", "Wallace Breen", "Walter Bennet"] - enemy: ["APC", "Alien Controller", "Alien Grunt", "Antlion", "Antlion Guard", "Assassin", "Baby Headcrab", "Barnacle", "Bullsquid", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Fast Headcrab", "Fast Zombie", "Garg", "Gene Worm", "Gonarch", "Grunt", "Headcrab", "Hopper Mine", "Houndeye", "Hunter-Chopper", "Ichthyosaur", "Leech", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Pit Drone", "Pit Worm", "Poison Headcrab", "Poison Zombie", "Rollermine", "Shield Scanner", "Shock Roach", "Shock Trooper", "Snark", "Strider", "Tentacle", "Voltigore", "Vortigaunt", "Zombie"] - location: ["Black Mesa East", "Black Mesa Research Facility", "Citadel", "City 17", "Earth", "Nova Prospekt", "Ravenholm", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric", "St. Olga", "White Forest", "Xen"] + games: + half_life: + character: ["Adrian Shephard", "Alyx Vance", "Arne Magnusson", "Barney Calhoun", "Colette Green", "Dog", "Eli Vance", "Father Grigori", "G-Man", "Gina Cross", "Gordon Freeman", "Isaac Kleiner", "Judith Mossman", "Odessa Cubbage", "Richard Keller", "Simmons", "Wallace Breen", "Walter Bennet"] + enemy: ["APC", "Alien Controller", "Alien Grunt", "Antlion", "Antlion Guard", "Assassin", "Baby Headcrab", "Barnacle", "Bullsquid", "City Scanner", "Civil Protection", "Combine Advisor", "Combine Gunship", "Crab Synth", "Fast Headcrab", "Fast Zombie", "Garg", "Gene Worm", "Gonarch", "Grunt", "Headcrab", "Hopper Mine", "Houndeye", "Hunter-Chopper", "Ichthyosaur", "Leech", "Manhack", "Mortar Synth", "Overwatch Elite", "Overwatch Sniper", "Overwatch Soldier", "Pit Drone", "Pit Worm", "Poison Headcrab", "Poison Zombie", "Rollermine", "Shield Scanner", "Shock Roach", "Shock Trooper", "Snark", "Strider", "Tentacle", "Voltigore", "Vortigaunt", "Zombie"] + location: ["Black Mesa East", "Black Mesa Research Facility", "Citadel", "City 17", "Earth", "Nova Prospekt", "Ravenholm", "Section A-17 Prototype Labs", "Sector A Training Facility", "Sector B Coolant Reserve", "Sector C Test Labs", "Sector D Administration", "Sector E Biodome Complex", "Sector F Lambda Complex", "Sector G Hydro Electric", "St. Olga", "White Forest", "Xen"] diff --git a/test/test_determinism.rb b/test/test_determinism.rb index e655ab2a16..5f3f587056 100644 --- a/test/test_determinism.rb +++ b/test/test_determinism.rb @@ -45,7 +45,7 @@ def all_methods def subclasses Faker.constants.delete_if do |subclass| - %i[Base Bank Char Base58 ChileRut Config Date Internet Time VERSION].include?(subclass) + %i[Base Bank Char Base58 ChileRut Config Date Games GamesHalfLife Internet Time VERSION].include?(subclass) end.sort end diff --git a/test/test_half_life.rb b/test/test_half_life.rb index 6ffddfe562..da9393d714 100644 --- a/test/test_half_life.rb +++ b/test/test_half_life.rb @@ -2,9 +2,9 @@ require_relative 'test_helper' -class TestFakerHalfLife < Test::Unit::TestCase +class TestFakerGamesHalfLife < Test::Unit::TestCase def setup - @tester = Faker::HalfLife + @tester = Faker::Games::HalfLife end def test_character