From 519f719173442d92e1d0c79c19bb2b15d0678395 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 23 Oct 2025 15:33:34 -0700 Subject: [PATCH] Better seeding - don't ever seed during CI - cut honcho seed time by 75% --- bin/setup | 4 ++++ db/seeds/honcho.rb | 23 ++--------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/bin/setup b/bin/setup index 153fd34de..4dc4277fe 100755 --- a/bin/setup +++ b/bin/setup @@ -35,6 +35,10 @@ step() { } needs_seeding() { + if [ "$CI" != "" ] ; then + return 1 + fi + has_tenant=$(bin/rails runner "pp ApplicationRecord.tenants.any? { ApplicationRecord.with_tenant(_1) { Account.sole } }" 2>/dev/null) if [ "$has_tenant" = "true" ] ; then return 1 diff --git a/db/seeds/honcho.rb b/db/seeds/honcho.rb index 80ffab4d6..bba0f378b 100644 --- a/db/seeds/honcho.rb +++ b/db/seeds/honcho.rb @@ -9,10 +9,8 @@ mike = find_or_create_user "Mike Dalessio", "mike@37signals.com" login_as david -# Array of authors for random assignment authors = [ david, jason, jz, kevin, jorge, mike ] -# Card titles for reuse across collections card_titles = [ "Implement authentication", "Design landing page", @@ -23,38 +21,21 @@ card_titles = [ "Add user profiles", "Implement search", "Create admin panel", - "Set up CI/CD", - "Design logo", - "Create documentation", - "Add payment system", - "Implement notifications", - "Set up analytics", - "Create mobile layout", - "Add social sharing", - "Implement caching", - "Set up monitoring", - "Create error handling" + "Set up CI/CD" ] -# Create 10 collections collections = [ "Project Launch", "Frontend Dev", "Backend Dev", "Design System", - "Testing Suite", - "Performance", - "User Experience", - "API Development", - "DevOps", - "Documentation" + "Testing Suite" ] time_range = (60 .. 30.days.in_minutes) collections.each_with_index do |collection_name, index| create_collection(collection_name, access_to: authors.sample(3)).tap do |collection| - # Create 20 unique cards for each collection card_titles.each do |title| travel(-rand(time_range).minutes) do card = create_card title,