mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-16 22:12:53 +00:00
346 lines
12 KiB
Ruby
346 lines
12 KiB
Ruby
puts "Seeding database..."
|
|
|
|
# Create Platforms
|
|
puts "Creating platforms..."
|
|
platforms_data = [
|
|
# Nintendo
|
|
{ name: "Nintendo Entertainment System", abbreviation: "NES", manufacturer: "Nintendo" },
|
|
{ name: "Super Nintendo Entertainment System", abbreviation: "SNES", manufacturer: "Nintendo" },
|
|
{ name: "Nintendo 64", abbreviation: "N64", manufacturer: "Nintendo" },
|
|
{ name: "GameCube", abbreviation: "GCN", manufacturer: "Nintendo" },
|
|
{ name: "Wii", abbreviation: "Wii", manufacturer: "Nintendo" },
|
|
{ name: "Wii U", abbreviation: "Wii U", manufacturer: "Nintendo" },
|
|
{ name: "Nintendo Switch", abbreviation: "Switch", manufacturer: "Nintendo" },
|
|
{ name: "Game Boy", abbreviation: "GB", manufacturer: "Nintendo" },
|
|
{ name: "Game Boy Color", abbreviation: "GBC", manufacturer: "Nintendo" },
|
|
{ name: "Game Boy Advance", abbreviation: "GBA", manufacturer: "Nintendo" },
|
|
{ name: "Nintendo DS", abbreviation: "DS", manufacturer: "Nintendo" },
|
|
{ name: "Nintendo 3DS", abbreviation: "3DS", manufacturer: "Nintendo" },
|
|
|
|
# Sony
|
|
{ name: "PlayStation", abbreviation: "PS1", manufacturer: "Sony" },
|
|
{ name: "PlayStation 2", abbreviation: "PS2", manufacturer: "Sony" },
|
|
{ name: "PlayStation 3", abbreviation: "PS3", manufacturer: "Sony" },
|
|
{ name: "PlayStation 4", abbreviation: "PS4", manufacturer: "Sony" },
|
|
{ name: "PlayStation 5", abbreviation: "PS5", manufacturer: "Sony" },
|
|
{ name: "PlayStation Portable", abbreviation: "PSP", manufacturer: "Sony" },
|
|
{ name: "PlayStation Vita", abbreviation: "PS Vita", manufacturer: "Sony" },
|
|
|
|
# Microsoft
|
|
{ name: "Xbox", abbreviation: "Xbox", manufacturer: "Microsoft" },
|
|
{ name: "Xbox 360", abbreviation: "X360", manufacturer: "Microsoft" },
|
|
{ name: "Xbox One", abbreviation: "XB1", manufacturer: "Microsoft" },
|
|
{ name: "Xbox Series X/S", abbreviation: "Series X/S", manufacturer: "Microsoft" },
|
|
|
|
# Sega
|
|
{ name: "Sega Genesis", abbreviation: "Genesis", manufacturer: "Sega" },
|
|
{ name: "Sega Saturn", abbreviation: "Saturn", manufacturer: "Sega" },
|
|
{ name: "Sega Dreamcast", abbreviation: "Dreamcast", manufacturer: "Sega" },
|
|
{ name: "Sega Game Gear", abbreviation: "Game Gear", manufacturer: "Sega" },
|
|
|
|
# Other
|
|
{ name: "PC", abbreviation: "PC", manufacturer: nil },
|
|
{ name: "Mobile (iOS)", abbreviation: "iOS", manufacturer: "Apple" },
|
|
{ name: "Mobile (Android)", abbreviation: "Android", manufacturer: "Google" },
|
|
{ name: "Arcade", abbreviation: "Arcade", manufacturer: nil }
|
|
]
|
|
|
|
platforms_data.each do |platform_data|
|
|
Platform.find_or_create_by!(name: platform_data[:name]) do |platform|
|
|
platform.abbreviation = platform_data[:abbreviation]
|
|
platform.manufacturer = platform_data[:manufacturer]
|
|
end
|
|
end
|
|
|
|
puts "Created #{Platform.count} platforms"
|
|
|
|
# Create Genres
|
|
puts "Creating genres..."
|
|
genres = [
|
|
"Action", "Adventure", "RPG", "JRPG", "Strategy", "Simulation",
|
|
"Platformer", "Fighting", "Racing", "Sports", "Puzzle", "Horror",
|
|
"Stealth", "Shooter", "FPS", "TPS", "Rhythm", "Visual Novel",
|
|
"Roguelike", "Metroidvania", "Sandbox", "MMO", "Turn-Based",
|
|
"Real-Time Strategy", "Tower Defense", "Card Game", "Party Game",
|
|
"Educational", "Survival", "Battle Royale"
|
|
]
|
|
|
|
genres.each do |genre_name|
|
|
Genre.find_or_create_by!(name: genre_name)
|
|
end
|
|
|
|
puts "Created #{Genre.count} genres"
|
|
|
|
# Create demo user and sample games for development
|
|
if Rails.env.development?
|
|
puts "Creating demo user..."
|
|
|
|
demo_user = User.find_or_create_by!(email: "demo@turbovault.com") do |user|
|
|
user.username = "demo"
|
|
user.password = "password123"
|
|
user.password_confirmation = "password123"
|
|
user.bio = "Demo user for TurboVault development"
|
|
user.profile_public = true
|
|
puts " ✓ Created demo user"
|
|
puts " Email: demo@turbovault.com"
|
|
puts " Password: password123"
|
|
end
|
|
|
|
if demo_user.persisted? && !demo_user.previously_new_record?
|
|
puts " ✓ Demo user already exists"
|
|
puts " Email: demo@turbovault.com"
|
|
puts " Password: password123"
|
|
end
|
|
|
|
# Create sample collections
|
|
puts "Creating sample collections for demo user..."
|
|
|
|
nintendo_collection = demo_user.collections.find_or_create_by!(name: "Nintendo Games") do |collection|
|
|
collection.description = "All my Nintendo platform games"
|
|
end
|
|
|
|
n64_collection = demo_user.collections.find_or_create_by!(name: "N64 Classics") do |collection|
|
|
collection.description = "Best games from the Nintendo 64 era"
|
|
collection.parent_collection = nintendo_collection
|
|
end
|
|
|
|
favorites_collection = demo_user.collections.find_or_create_by!(name: "All-Time Favorites") do |collection|
|
|
collection.description = "My absolute favorite games across all platforms"
|
|
end
|
|
|
|
backlog_collection = demo_user.collections.find_or_create_by!(name: "To Play") do |collection|
|
|
collection.description = "Games I still need to complete"
|
|
end
|
|
|
|
puts " ✓ Created #{demo_user.collections.count} collections"
|
|
|
|
# Only create games if demo user has none
|
|
if demo_user.games.empty?
|
|
puts "Creating sample games for demo user..."
|
|
|
|
# Find platforms
|
|
n64 = Platform.find_by(abbreviation: "N64")
|
|
ps5 = Platform.find_by(abbreviation: "PS5")
|
|
switch = Platform.find_by(abbreviation: "Switch")
|
|
snes = Platform.find_by(abbreviation: "SNES")
|
|
ps2 = Platform.find_by(abbreviation: "PS2")
|
|
pc = Platform.find_by(name: "PC")
|
|
|
|
# Find genres
|
|
action = Genre.find_by(name: "Action")
|
|
adventure = Genre.find_by(name: "Adventure")
|
|
rpg = Genre.find_by(name: "RPG")
|
|
jrpg = Genre.find_by(name: "JRPG")
|
|
platformer = Genre.find_by(name: "Platformer")
|
|
puzzle = Genre.find_by(name: "Puzzle")
|
|
shooter = Genre.find_by(name: "Shooter")
|
|
fps = Genre.find_by(name: "FPS")
|
|
simulation = Genre.find_by(name: "Simulation")
|
|
|
|
sample_games = [
|
|
{
|
|
title: "The Legend of Zelda: Ocarina of Time",
|
|
platform: n64,
|
|
genres: [ action, adventure ],
|
|
collections: [ nintendo_collection, n64_collection, favorites_collection ],
|
|
format: "physical",
|
|
condition: "cib",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 45.00,
|
|
location: "Shelf A - Row 2",
|
|
notes: "One of the best games ever made. Perfect condition with manual and box.",
|
|
date_added: 30.days.ago
|
|
},
|
|
{
|
|
title: "Super Mario 64",
|
|
platform: n64,
|
|
genres: [ platformer, adventure ],
|
|
collections: [ nintendo_collection, n64_collection, favorites_collection ],
|
|
format: "physical",
|
|
condition: "loose",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 30.00,
|
|
location: "Shelf A - Row 2",
|
|
date_added: 45.days.ago
|
|
},
|
|
{
|
|
title: "Elden Ring",
|
|
platform: ps5,
|
|
genres: [ action, rpg ],
|
|
collections: [ favorites_collection ],
|
|
format: "digital",
|
|
digital_store: "PlayStation Store",
|
|
completion_status: "currently_playing",
|
|
user_rating: 5,
|
|
price_paid: 59.99,
|
|
notes: "Amazing open world. Currently at 80 hours playtime.",
|
|
date_added: 10.days.ago
|
|
},
|
|
{
|
|
title: "The Legend of Zelda: Breath of the Wild",
|
|
platform: switch,
|
|
genres: [ action, adventure ],
|
|
collections: [ nintendo_collection, favorites_collection ],
|
|
format: "physical",
|
|
condition: "cib",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 60.00,
|
|
location: "Shelf B - Row 1",
|
|
date_added: 20.days.ago
|
|
},
|
|
{
|
|
title: "Super Metroid",
|
|
platform: snes,
|
|
genres: [ action, adventure, platformer ],
|
|
collections: [ nintendo_collection, favorites_collection ],
|
|
format: "physical",
|
|
condition: "loose",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 85.00,
|
|
location: "Shelf A - Row 1",
|
|
notes: "Classic Metroidvania. Still holds up today!",
|
|
date_added: 60.days.ago
|
|
},
|
|
{
|
|
title: "Final Fantasy VII",
|
|
platform: ps2,
|
|
genres: [ jrpg, rpg ],
|
|
collections: [ backlog_collection ],
|
|
format: "physical",
|
|
condition: "cib",
|
|
completion_status: "backlog",
|
|
user_rating: nil,
|
|
price_paid: 20.00,
|
|
location: "Shelf B - Row 3",
|
|
notes: "Need to replay this classic.",
|
|
date_added: 15.days.ago
|
|
},
|
|
{
|
|
title: "Hollow Knight",
|
|
platform: pc,
|
|
genres: [ action, platformer, adventure ],
|
|
collections: [ favorites_collection ],
|
|
format: "digital",
|
|
digital_store: "Steam",
|
|
completion_status: "on_hold",
|
|
user_rating: 5,
|
|
price_paid: 15.00,
|
|
notes: "Incredible art style and gameplay. Taking a break but will return.",
|
|
date_added: 25.days.ago
|
|
},
|
|
{
|
|
title: "Portal 2",
|
|
platform: pc,
|
|
genres: [ puzzle, fps ],
|
|
collections: [ favorites_collection ],
|
|
format: "digital",
|
|
digital_store: "Steam",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 9.99,
|
|
notes: "Perfect puzzle game. Co-op is fantastic.",
|
|
date_added: 50.days.ago
|
|
},
|
|
{
|
|
title: "Hades",
|
|
platform: switch,
|
|
genres: [ action, rpg ],
|
|
collections: [ nintendo_collection, favorites_collection ],
|
|
format: "digital",
|
|
digital_store: "Nintendo eShop",
|
|
completion_status: "completed",
|
|
user_rating: 5,
|
|
price_paid: 24.99,
|
|
notes: "Best roguelike I've ever played. Fantastic story and gameplay loop.",
|
|
date_added: 35.days.ago
|
|
},
|
|
{
|
|
title: "Cyberpunk 2077",
|
|
platform: ps5,
|
|
genres: [ action, rpg, shooter ],
|
|
collections: [ backlog_collection ],
|
|
format: "digital",
|
|
digital_store: "PlayStation Store",
|
|
completion_status: "backlog",
|
|
user_rating: nil,
|
|
price_paid: 29.99,
|
|
notes: "Heard it's much better now after patches. Need to start this.",
|
|
date_added: 5.days.ago
|
|
},
|
|
{
|
|
title: "GoldenEye 007",
|
|
platform: n64,
|
|
genres: [ fps, action ],
|
|
collections: [ nintendo_collection, n64_collection ],
|
|
format: "physical",
|
|
condition: "loose",
|
|
completion_status: "completed",
|
|
user_rating: 4,
|
|
price_paid: 35.00,
|
|
location: "Shelf A - Row 2",
|
|
notes: "Classic multiplayer. Still fun with friends.",
|
|
date_added: 40.days.ago
|
|
},
|
|
{
|
|
title: "Stardew Valley",
|
|
platform: switch,
|
|
genres: [ simulation ],
|
|
collections: [ nintendo_collection ],
|
|
format: "digital",
|
|
digital_store: "Nintendo eShop",
|
|
completion_status: "currently_playing",
|
|
user_rating: 5,
|
|
price_paid: 14.99,
|
|
notes: "Perfect game for relaxing. Over 100 hours in!",
|
|
date_added: 55.days.ago
|
|
}
|
|
]
|
|
|
|
sample_games.each do |game_data|
|
|
game = demo_user.games.create!(
|
|
title: game_data[:title],
|
|
platform: game_data[:platform],
|
|
format: game_data[:format],
|
|
condition: game_data[:condition],
|
|
completion_status: game_data[:completion_status],
|
|
user_rating: game_data[:user_rating],
|
|
price_paid: game_data[:price_paid],
|
|
location: game_data[:location],
|
|
digital_store: game_data[:digital_store],
|
|
notes: game_data[:notes],
|
|
date_added: game_data[:date_added] || Date.current
|
|
)
|
|
|
|
game.genres = game_data[:genres] if game_data[:genres]
|
|
game.collections = game_data[:collections] if game_data[:collections]
|
|
end
|
|
|
|
puts " ✓ Created #{demo_user.games.count} sample games"
|
|
puts " ✓ Games organized into collections"
|
|
else
|
|
puts " ✓ Demo user already has #{demo_user.games.count} games"
|
|
end
|
|
|
|
puts "\n" + "="*60
|
|
puts "Demo Account Ready!"
|
|
puts "="*60
|
|
puts "Email: demo@turbovault.com"
|
|
puts "Password: password123"
|
|
puts ""
|
|
puts "Quick Login: http://localhost:3000/login"
|
|
puts "="*60
|
|
end
|
|
|
|
puts "Seeding completed!"
|
|
puts "- #{Platform.count} platforms"
|
|
puts "- #{Genre.count} genres"
|
|
|
|
# Seed IGDB Platform Mappings
|
|
puts "\nSeeding IGDB platform mappings..."
|
|
IgdbPlatformMapping.seed_common_mappings!
|
|
puts " ✓ Created #{IgdbPlatformMapping.count} platform mappings"
|