From fb9aa5dfac11c2fe868cc741f3b60a9304495ac3 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Sun, 23 Nov 2025 05:54:49 +0100 Subject: [PATCH] Extract common method to configure bundle --- bin/kamal | 4 +--- bin/rails | 5 +---- lib/fizzy.rb | 6 ++++++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/kamal b/bin/kamal index 4cdcdc588..862f9036a 100755 --- a/bin/kamal +++ b/bin/kamal @@ -24,9 +24,7 @@ end require "rubygems" require_relative "../lib/fizzy" -if Fizzy.saas? - ENV["BUNDLE_WITH"] = [ ENV["BUNDLE_WITH"], "saas" ].compact.join(",") -end +Fizzy.configure_bundle require "bundler/setup" diff --git a/bin/rails b/bin/rails index 36ee7f712..e644775f8 100755 --- a/bin/rails +++ b/bin/rails @@ -2,10 +2,7 @@ APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../lib/fizzy" - -if Fizzy.saas? - ENV["BUNDLE_WITH"] = [ ENV["BUNDLE_WITH"] , "saas" ].compact.join(",") -end +Fizzy.configure_bundle require_relative "../config/boot" diff --git a/lib/fizzy.rb b/lib/fizzy.rb index 16a1ca3a4..0a87dd815 100644 --- a/lib/fizzy.rb +++ b/lib/fizzy.rb @@ -8,6 +8,12 @@ module Fizzy def db_adapter @db_adapter ||= DbAdapter.new ENV.fetch("DATABASE_ADAPTER", saas? ? "mysql" : "sqlite") end + + def configure_bundle + if saas? + ENV["BUNDLE_WITH"] = [ENV["BUNDLE_WITH"], "saas"].compact.join(",") + end + end end class DbAdapter