From e1e9a01720ca8d13db28a29513c7e06b2b27a9df Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Sat, 22 Nov 2025 16:58:14 +0100 Subject: [PATCH] Make open source the default, and check for sass instead --- Dockerfile | 2 +- Dockerfile.dev | 2 +- Gemfile | 4 +--- Gemfile.lock | 14 ++------------ bin/rails | 6 ------ config/application.rb | 2 ++ config/ci.rb | 3 +-- config/initializers/authentication.rb | 2 -- config/routes.rb | 3 ++- lib/bootstrap.rb | 5 ----- lib/fizzy.rb | 5 +++++ test/controllers/sessions_controller_test.rb | 2 +- test/test_helper.rb | 4 ---- 13 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 config/initializers/authentication.rb delete mode 100644 lib/bootstrap.rb create mode 100644 lib/fizzy.rb diff --git a/Dockerfile b/Dockerfile index 6341f3fc1..3f272de4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN apt-get update -qq && \ # Install application gems COPY Gemfile Gemfile.lock .ruby-version ./ -COPY lib/bootstrap.rb ./lib/bootstrap.rb +COPY lib/fizzy.rb ./lib/fizzy.rb COPY gems ./gems/ RUN --mount=type=secret,id=GITHUB_TOKEN --mount=type=cache,id=fizzy-permabundle-${RUBY_VERSION},sharing=locked,target=/permabundle \ gem install bundler && \ diff --git a/Dockerfile.dev b/Dockerfile.dev index 75b284570..9c20fcda5 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -18,7 +18,7 @@ RUN apt-get update -qq && \ # Install application gems COPY Gemfile Gemfile.lock .ruby-version ./ -COPY lib/bootstrap.rb ./lib/bootstrap.rb +COPY lib/fizzy.rb ./lib/fizzy.rb COPY gems ./gems/ RUN --mount=type=secret,id=GITHUB_TOKEN --mount=type=cache,id=fizzy-devbundle-${RUBY_VERSION},sharing=locked,target=/devbundle \ gem install bundler foreman && \ diff --git a/Gemfile b/Gemfile index d008f4907..bdd047171 100644 --- a/Gemfile +++ b/Gemfile @@ -76,8 +76,6 @@ group :test do gem "mocha" end -require_relative "lib/bootstrap" -unless Bootstrap.oss_config? - eval_gemfile "gems/fizzy-saas/Gemfile" +group :saas do gem "fizzy-saas", path: "gems/fizzy-saas" end diff --git a/Gemfile.lock b/Gemfile.lock index f8001333c..6b7771fd3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,3 @@ -GIT - remote: https://github.com/basecamp/queenbee-plugin - revision: eb01c697de1ad028afc65cc7d9b5345a7a8e849f - ref: eb01c697de1ad028afc65cc7d9b5345a7a8e849f - specs: - queenbee (3.2.0) - activeresource - builder - rexml - GIT remote: https://github.com/basecamp/rails-structured-logging revision: 76960cb5c15fc2b6b5f7542e05d7dcc031cef9e6 @@ -387,6 +377,8 @@ GEM public_suffix (7.0.0) puma (7.1.0) nio4r (~> 2.0) + queenbee (1.5.1) + json (> 1.8) raabro (1.4.0) racc (1.8.1) rack (3.2.4) @@ -585,7 +577,6 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES - activeresource autotuner aws-sdk-s3 bcrypt (~> 3.1.7) @@ -612,7 +603,6 @@ DEPENDENCIES prometheus-client-mmap (~> 1.3) propshaft puma (>= 5.0) - queenbee! rack-mini-profiler rails! rails_structured_logging! diff --git a/bin/rails b/bin/rails index ab22dd770..073966023 100755 --- a/bin/rails +++ b/bin/rails @@ -1,10 +1,4 @@ #!/usr/bin/env ruby -require_relative "../lib/bootstrap" -if !Bootstrap.oss_config? - # default from rails/test_unit/runner.rb but adding the saas gem test files - ENV["DEFAULT_TEST"] = "{gems/fizzy-saas/,}test/**/*_test.rb" - ENV["DEFAULT_TEST_EXCLUDE"] = "{gems/fizzy-saas/,}test/{system,dummy,fixtures}/**/*_test.rb" -end APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/config/application.rb b/config/application.rb index 27177a5cb..0399caaca 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,5 +1,7 @@ require_relative "boot" require "rails/all" +require_relative "../lib/fizzy" + Bundler.require(*Rails.groups) module Fizzy diff --git a/config/ci.rb b/config/ci.rb index f6cbbf953..5d518c21c 100644 --- a/config/ci.rb +++ b/config/ci.rb @@ -10,8 +10,7 @@ CI.run do step "Security: Brakeman audit", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error" step "Security: Gitleaks audit", "bin/gitleaks-audit" - step "Tests: Rails: SaaS config", "bin/rails test" - step "Tests: Rails: OSS config", "OSS_CONFIG=1 bin/rails test" + step "Tests: Rails", "bin/rails test" step "Tests: System", "bin/rails test:system" if success? diff --git a/config/initializers/authentication.rb b/config/initializers/authentication.rb deleted file mode 100644 index 5556a9661..000000000 --- a/config/initializers/authentication.rb +++ /dev/null @@ -1,2 +0,0 @@ -require "bootstrap" -Rails.application.config.x.oss_config = Bootstrap.oss_config? diff --git a/config/routes.rb b/config/routes.rb index 73acfa75e..87fe32b7a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -224,7 +224,8 @@ Rails.application.routes.draw do get "manifest" => "rails/pwa#manifest", as: :pwa_manifest get "service-worker" => "pwa#service_worker" - unless Rails.application.config.x.oss_config + # TODO: Can we move this just to the engine + if Fizzy.saas? mount Fizzy::Saas::Engine, at: "/", as: "saas" end diff --git a/lib/bootstrap.rb b/lib/bootstrap.rb deleted file mode 100644 index 6d52f3f49..000000000 --- a/lib/bootstrap.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Bootstrap - def self.oss_config? - ENV.fetch("OSS_CONFIG", "") != "" || !File.directory?(File.expand_path("../gems/fizzy-saas", __dir__)) - end -end diff --git a/lib/fizzy.rb b/lib/fizzy.rb new file mode 100644 index 000000000..2a3b6e221 --- /dev/null +++ b/lib/fizzy.rb @@ -0,0 +1,5 @@ +module Fizzy + def self.saas? + defined?(Fizzy::Saas::Engine) + end +end diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index 623423fdf..7fed62900 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -21,7 +21,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest end end - unless Bootstrap.oss_config? + if Fizzy.saas? test "create for a new user" do untenanted do assert_difference -> { Identity.count }, +1 do diff --git a/test/test_helper.rb b/test/test_helper.rb index bad1fdb2a..722d39d59 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -152,7 +152,3 @@ end ActiveSupport.on_load(:active_record_fixture_set) do prepend(FixturesTestHelper) end - -unless Rails.application.config.x.oss_config - load File.expand_path("../gems/fizzy-saas/test/test_helper.rb", __dir__) -end