Set up a "cleanslate" seed that has no cards and no collections
and only a single user, david@37signals.com ref: https://fizzy.37signals.com/5986089/collections/7/cards/1318
This commit is contained in:
@@ -2,9 +2,7 @@ module Account::SignalAccount
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
unless Rails.application.config.x.local_authentication
|
||||
belongs_to :signal_account, class_name: "SignalId::Account", primary_key: :queenbee_id, foreign_key: :queenbee_id, optional: true
|
||||
end
|
||||
belongs_to :signal_account, class_name: "SignalId::Account", primary_key: :queenbee_id, foreign_key: :queenbee_id, optional: true
|
||||
end
|
||||
|
||||
class_methods do
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
echo "Login with david@37signals.com / secret123456 to:"
|
||||
echo " - 37signals: http://fizzy.localhost:3006/735464785"
|
||||
echo " - Honcho: http://fizzy.localhost:3006/175932900"
|
||||
bin/rails runner - <<EOF
|
||||
ApplicationRecord.with_each_tenant do |tenant|
|
||||
next unless tenant =~ /\A\d+\z/
|
||||
if Account.sole.signal_account || Rails.application.config.x.local_authentication
|
||||
puts " - #{Account.sole.name}: http://fizzy.localhost:3006/#{Account.sole.queenbee_id}"
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
if [ -f tmp/solid-queue.txt ]; then
|
||||
export SOLID_QUEUE_IN_PUMA=1
|
||||
|
||||
+22
-7
@@ -10,17 +10,31 @@ def seed_account(name)
|
||||
puts " #{elapsed.round(2)} sec"
|
||||
end
|
||||
|
||||
def create_tenant(signal_account_name)
|
||||
signal_account = SignalId::Account.find_by_product_and_name!("fizzy", signal_account_name)
|
||||
tenant_name = signal_account.queenbee_id
|
||||
def create_tenant(signal_account_name, bare: false)
|
||||
if bare
|
||||
queenbee_id = Digest::SHA256.hexdigest(signal_account_name)[0..8].to_i(16)
|
||||
else
|
||||
signal_account = SignalId::Account.find_by_product_and_name!("fizzy", signal_account_name)
|
||||
queenbee_id = signal_account.queenbee_id
|
||||
end
|
||||
|
||||
ApplicationRecord.destroy_tenant tenant_name
|
||||
ApplicationRecord.create_tenant(tenant_name) do
|
||||
account = Account.create_with_admin_user(queenbee_id: signal_account.queenbee_id)
|
||||
ApplicationRecord.destroy_tenant queenbee_id
|
||||
ApplicationRecord.create_tenant(queenbee_id) do
|
||||
account = if bare
|
||||
Account.create(name: signal_account_name, queenbee_id: queenbee_id).tap do
|
||||
User.create!(
|
||||
name: "David Heinemeier Hansson",
|
||||
email_address: "david@37signals.com",
|
||||
password: "secret123456"
|
||||
)
|
||||
end
|
||||
else
|
||||
Account.create_with_admin_user(queenbee_id: queenbee_id)
|
||||
end
|
||||
account.setup_basic_template
|
||||
end
|
||||
|
||||
ApplicationRecord.current_tenant = tenant_name
|
||||
ApplicationRecord.current_tenant = queenbee_id
|
||||
end
|
||||
|
||||
def find_or_create_user(full_name, email_address)
|
||||
@@ -65,5 +79,6 @@ def create_card(title, collection:, description: nil, status: :published, creato
|
||||
end
|
||||
|
||||
# Seed accounts
|
||||
seed_account "cleanslate"
|
||||
seed_account "37signals"
|
||||
seed_account "honcho"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
create_tenant "cleanslate", bare: true
|
||||
Reference in New Issue
Block a user