Module: LabClient::Generator::Names
- Included in:
- GroupTemplateHelper, Wizard
- Defined in:
- lib/labclient/generator/names.rb
Overview
Name Helper
Instance Method Summary collapse
- #create_file(content, branch = :master, message = nil) ⇒ Object
- #gen_description ⇒ Object
- #gen_groups ⇒ Object
- #gen_people ⇒ Object
- #gen_projects ⇒ Object
-
#generate_names ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Method Details
#create_file(content, branch = :master, message = nil) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/labclient/generator/names.rb', line 7 def create_file(content, branch = :master, = nil) { branch: branch, commit_message: || gen_description, content: content } end |
#gen_description ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/labclient/generator/names.rb', line 50 def gen_description [ Faker::Hacker.say_something_smart, Faker::Games::LeagueOfLegends.quote, Faker::Company.bs, Faker::Movies::PrincessBride.quote ].sample end |
#gen_groups ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/labclient/generator/names.rb', line 15 def gen_groups [ Faker::Games::LeagueOfLegends.location, Faker::Movies::LordOfTheRings.location, Faker::TvShows::RickAndMorty.location, Faker::TvShows::StarTrek.location, Faker::Games::ElderScrolls.region, Faker::Games::ElderScrolls.city, Faker::Games::Zelda.location, Faker::Games::SuperSmashBros.stage ].map { |x| x.gsub(/[^0-9A-Za-z]/, '') } end |
#gen_people ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/labclient/generator/names.rb', line 40 def gen_people [ Faker::Movies::LordOfTheRings.character, Faker::Games::WorldOfWarcraft.hero, Faker::TvShows::StarTrek.character, Faker::Games::LeagueOfLegends.champion, Faker::Movies::PrincessBride.character ] end |
#gen_projects ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/labclient/generator/names.rb', line 28 def gen_projects [ Faker::Games::ElderScrolls.creature, Faker::Movies::LordOfTheRings.location, Faker::Games::LeagueOfLegends.summoner_spell, Faker::Games::Pokemon.move, Faker::TvShows::RickAndMorty.location, Faker::Games::LeagueOfLegends.masteries, Faker::Superhero.power ].map { |x| x.gsub(/[^0-9A-Za-z]/, '') } end |
#generate_names ⇒ Object
rubocop:disable Metrics/AbcSize
60 61 62 63 64 |
# File 'lib/labclient/generator/names.rb', line 60 def generate_names @user_names = Array.new(count[:users]) { gen_people }.flatten.uniq.sample(count[:users]) @group_names = Array.new(count[:groups]) { gen_groups }.flatten.uniq.sample(count[:groups]) @project_names = Array.new(count[:projects]) { gen_projects }.flatten.uniq.sample(count[:projects]) end |