From 98f27c1f308cd85a32f00defa51a600c78bfd96b Mon Sep 17 00:00:00 2001 From: Sameer Kolhar Date: Tue, 4 Mar 2025 00:34:35 -0800 Subject: [PATCH 1/7] fix issue from #767 - calling an instance method incorrectly Link to comment: https://github.com/tramlinehq/tramline/pull/767#pullrequestreview-2650094396 --- lib/seed/dev_starter.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/seed/dev_starter.rb b/lib/seed/dev_starter.rb index 1a5d53aba..ddd106cc7 100644 --- a/lib/seed/dev_starter.rb +++ b/lib/seed/dev_starter.rb @@ -4,13 +4,17 @@ module Seed class DevStarter include Seed::Constants + def self.call + new.call + end + def call puts "Seeding database..." ActiveRecord::Base.transaction do - self.class.send(:create_admin_user) - self.class.send(:create_owner_user) - self.class.send(:create_developer_user) + create_admin_user + create_owner_user + create_developer_user end puts "Completed seeding database" From 36b8054490d2e64fb06c95ae9170e5a34cdc76df Mon Sep 17 00:00:00 2001 From: Sameer Kolhar Date: Tue, 4 Mar 2025 02:06:16 -0800 Subject: [PATCH 2/7] fix issue around the methods in class DevStarter --- lib/seed/dev_starter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/seed/dev_starter.rb b/lib/seed/dev_starter.rb index ddd106cc7..ce99b22e8 100644 --- a/lib/seed/dev_starter.rb +++ b/lib/seed/dev_starter.rb @@ -20,7 +20,7 @@ def call puts "Completed seeding database" end - def self.create_admin_user + def create_admin_user email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: ADMIN_EMAIL) admin = true @@ -32,7 +32,7 @@ def self.create_admin_user puts "Added/updated admin user." end - def self.create_owner_user + def create_owner_user email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: OWNER_EMAIL) if email_authentication.persisted? @@ -58,7 +58,7 @@ def self.create_owner_user puts "Added/updated owner user." end - def self.create_developer_user + def create_developer_user email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: DEVELOPER_EMAIL) if email_authentication.persisted? From dbec18e60d6e36c6550acdff9cde2ad0057d7717 Mon Sep 17 00:00:00 2001 From: Sameer Kolhar Date: Tue, 4 Mar 2025 02:06:34 -0800 Subject: [PATCH 3/7] update compose file to directly build from applelink repo --- compose.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compose.yml b/compose.yml index cfff457b5..c08bccf7f 100644 --- a/compose.yml +++ b/compose.yml @@ -141,8 +141,8 @@ services: applelink: build: - dockerfile: ../applelink/dev.Dockerfile - context: ../applelink + dockerfile: dev.Dockerfile + context: https://github.com/tramlinehq/applelink.git args: RUBY_VERSION: '3.2.0' image: applelink-dev:1.0.0 @@ -150,10 +150,11 @@ services: ports: - '4000:4000' volumes: - - ../applelink:/applelink:cached + - applelink_data:/applelink:cached volumes: bundle: rails_cache: postgres: redis: + applelink_data: From 11f3aa87b22fecec3a9e23ad8e337278067682c7 Mon Sep 17 00:00:00 2001 From: Sameer Kolhar Date: Tue, 4 Mar 2025 02:15:17 -0800 Subject: [PATCH 4/7] fix issues lint and test errors --- db/seeds.rb | 2 +- lib/seed/dev_starter.rb | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 58581b0ba..00aaf3d27 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,3 @@ # rubocop:disable Rails/Output -Seed::DevStarter.call +Seed::DevStarter.new.call # rubocop:enable Rails/Output diff --git a/lib/seed/dev_starter.rb b/lib/seed/dev_starter.rb index ce99b22e8..af5f37573 100644 --- a/lib/seed/dev_starter.rb +++ b/lib/seed/dev_starter.rb @@ -4,8 +4,7 @@ module Seed class DevStarter include Seed::Constants - def self.call - new.call + def initialize end def call @@ -20,6 +19,8 @@ def call puts "Completed seeding database" end + private + def create_admin_user email_authentication = Accounts::EmailAuthentication.find_or_initialize_by(email: ADMIN_EMAIL) admin = true @@ -83,10 +84,6 @@ def create_developer_user puts "Added/updated developer user." end - - private_class_method :create_admin_user - private_class_method :create_owner_user - private_class_method :create_developer_user end end From 8a66e8969a1678024461587eda77444109ebcba2 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 4 Mar 2025 16:31:37 +0530 Subject: [PATCH 5/7] undo applelink docker change --- compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compose.yml b/compose.yml index c08bccf7f..a5f076051 100644 --- a/compose.yml +++ b/compose.yml @@ -141,8 +141,8 @@ services: applelink: build: - dockerfile: dev.Dockerfile - context: https://github.com/tramlinehq/applelink.git + dockerfile: ../applelink/dev.Dockerfile + context: ../applelink args: RUBY_VERSION: '3.2.0' image: applelink-dev:1.0.0 @@ -150,7 +150,7 @@ services: ports: - '4000:4000' volumes: - - applelink_data:/applelink:cached + - ../applelink:/applelink:cached volumes: bundle: From 64e1b90b01ed440edb2e850bd77a9889b3cf9bdc Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 4 Mar 2025 16:31:49 +0530 Subject: [PATCH 6/7] directly 'call' --- db/seeds.rb | 2 +- lib/seed/dev_starter.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 00aaf3d27..58581b0ba 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,3 @@ # rubocop:disable Rails/Output -Seed::DevStarter.new.call +Seed::DevStarter.call # rubocop:enable Rails/Output diff --git a/lib/seed/dev_starter.rb b/lib/seed/dev_starter.rb index af5f37573..51ec8d593 100644 --- a/lib/seed/dev_starter.rb +++ b/lib/seed/dev_starter.rb @@ -4,7 +4,8 @@ module Seed class DevStarter include Seed::Constants - def initialize + def self.call + new.call end def call From 5d62395525d5b7b6f1aeda10c9ec8ee688bceec7 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 4 Mar 2025 16:34:06 +0530 Subject: [PATCH 7/7] remove extra volume --- compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/compose.yml b/compose.yml index a5f076051..cfff457b5 100644 --- a/compose.yml +++ b/compose.yml @@ -157,4 +157,3 @@ volumes: rails_cache: postgres: redis: - applelink_data: