Skip to content

Commit f5762ea

Browse files
committed
Allow resetting specific demo tenant in rake task
1 parent d447182 commit f5762ea

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/tasks/demo.rake

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
namespace :demo do
4-
desc "Reset all demo tenants with fresh seed data"
4+
desc "Reset all demo tenants with fresh seed data (TENANT_NAME=demo-XY for specific tenant)"
55
task reset: :environment do
66
demo_tenants = Tenant.demo_tenants
77

@@ -10,6 +10,15 @@ namespace :demo do
1010
exit
1111
end
1212

13+
if ENV["TENANT_NAME"]
14+
tenant = ENV["TENANT_NAME"]
15+
unless demo_tenants.include?(tenant)
16+
puts "Demo tenant '#{tenant}' not found."
17+
exit 1
18+
end
19+
demo_tenants = [ tenant ]
20+
end
21+
1322
demo_tenants.each do |tenant|
1423
puts "Resetting demo tenant '#{tenant}'..."
1524

@@ -20,6 +29,6 @@ namespace :demo do
2029
puts "Demo tenant '#{tenant}' reset completed successfully."
2130
end
2231

23-
puts "All demo tenants reset completed."
32+
puts "All demo tenants reset completed." if demo_tenants.size > 1
2433
end
2534
end

0 commit comments

Comments
 (0)