Better seeding
- don't ever seed during CI - cut honcho seed time by 75%
This commit is contained in:
@@ -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
|
||||
|
||||
+2
-21
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user