module LabClient::Generator::Names

Name Helper

Public Instance Methods

create_file(content, branch = :master, message = nil) click to toggle source
# File lib/labclient/generator/names.rb, line 7
def create_file(content, branch = :master, message = nil)
  {
    branch: branch,
    commit_message: message || gen_description,
    content: content
  }
end
gen_description() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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() click to toggle source

rubocop:disable Metrics/AbcSize

# 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