From 2d6d60f5420e2cf4fcd369fc6d1d02a0cf2f43a5 Mon Sep 17 00:00:00 2001 From: Gaurav Tiwari Date: Fri, 28 Aug 2026 16:55:03 +0100 Subject: [PATCH] Run Rails builds as standalone commands --- CHANGELOG.md | 5 +++++ lib/boringbuilder/tasks/boring.rake | 3 +-- lib/boringbuilder/version.rb | 2 +- test/boringbuilder/rake_task_test.rb | 24 +++++++++++------------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb96e2..b240e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.1.0.alpha.6 - 2026-08-28 + +- Run `bin/rails boring:build` as a standalone builder process so Dagger can + preserve the command, streaming progress, signals, and cleanup. + ## 0.1.0.alpha.5 - 2026-08-28 - Record the exact local or BoringCache build result for deployment tools. diff --git a/lib/boringbuilder/tasks/boring.rake b/lib/boringbuilder/tasks/boring.rake index 000cb86..91f02dd 100644 --- a/lib/boringbuilder/tasks/boring.rake +++ b/lib/boringbuilder/tasks/boring.rake @@ -29,8 +29,7 @@ namespace :boring do end command << Rails.root.to_s - status = BoringBuilder::CLI.start(command) - raise BoringBuilder::BuildError, "BoringBuilder exited unsuccessfully" unless status.zero? + Kernel.exec(Gem.ruby, Gem.bin_path("boringbuilder", "boringbuilder"), *command) end desc "Check the configured container runtime" diff --git a/lib/boringbuilder/version.rb b/lib/boringbuilder/version.rb index 640af62..9ad865a 100644 --- a/lib/boringbuilder/version.rb +++ b/lib/boringbuilder/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module BoringBuilder - VERSION = "0.1.0.alpha.5" + VERSION = "0.1.0.alpha.6" end diff --git a/test/boringbuilder/rake_task_test.rb b/test/boringbuilder/rake_task_test.rb index 2388480..65e1955 100644 --- a/test/boringbuilder/rake_task_test.rb +++ b/test/boringbuilder/rake_task_test.rb @@ -24,35 +24,33 @@ def test_exposes_the_rails_shaped_build_task def test_builds_the_rails_application calls = [] - start = lambda do |arguments| - calls << arguments - 0 - end + executable = Gem.bin_path("boringbuilder", "boringbuilder") with_environment("BORINGBUILDER_RUNTIME" => "docker", "BORINGBUILDER_OUTPUT" => "dist/app.tar.zst") do with_rails_root do - with_cli_start(start) do + with_kernel_exec(->(*arguments) { calls << arguments }) do Rake::Task["boring:build"].invoke end end end assert_equal [ - ["build", "--runtime", "docker", "--output", "dist/app.tar.zst", Pathname.pwd.to_s] + [Gem.ruby, executable, "build", "--runtime", "docker", "--output", "dist/app.tar.zst", + Pathname.pwd.to_s] ], calls end private - def with_cli_start(replacement) - singleton_class = BoringBuilder::CLI.singleton_class - original = BoringBuilder::CLI.method(:start) - singleton_class.send(:remove_method, :start) - singleton_class.define_method(:start, replacement) + def with_kernel_exec(replacement) + singleton_class = Kernel.singleton_class + original = Kernel.method(:exec) + singleton_class.send(:remove_method, :exec) + singleton_class.define_method(:exec, replacement) yield ensure - singleton_class.send(:remove_method, :start) - singleton_class.define_method(:start, original) + singleton_class.send(:remove_method, :exec) + singleton_class.define_method(:exec, original) end def with_environment(values)