From 5ff19c5b0b123479635a43edb15914e58359ed6c Mon Sep 17 00:00:00 2001 From: Steve Polito Date: Thu, 9 Nov 2023 06:56:48 -0500 Subject: [PATCH] Introduce `./bin/rails` to fix broken test runner (#1139) This is a work around for an [issue][] with `vim-test`. Borrowed an [existing][] `./bin/rails` configuration from an [Engine][], which is very similar to a [plugin][]. The only difference is that we do not need the `ENGINE_ROOT` setting. [issue]: https://github.com/vim-test/vim-test/issues/477 [existing]: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt [Engine]: https://guides.rubyonrails.org/engines.html [plugin]: https://guides.rubyonrails.org/plugins.html --- bin/rails | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bin/rails diff --git a/bin/rails b/bin/rails new file mode 100755 index 000000000..38401bb40 --- /dev/null +++ b/bin/rails @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails gems +# installed from the root of your application. + +ENGINE_ROOT = File.expand_path("..", __dir__) +APP_PATH = File.expand_path("../test/dummy/config/application", __dir__) + +# Set up gems listed in the Gemfile. +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) + +require "rails/all" +require "rails/engine/commands"