Skip to content

Commit 3975e36

Browse files
committed
Merge pull request #1542 from bf4/rake_isolated_shellescape
Escape paths in rake isolated for directory with spaces and parens
2 parents b231401 + 042ec38 commit 3975e36

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Rakefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,19 @@ namespace :test do
5050
namespace :isolated do
5151
desc 'Run isolated tests for Railtie'
5252
task :railtie do
53+
require 'shellwords'
5354
dir = File.dirname(__FILE__)
54-
file = "#{dir}/test/active_model_serializers/railtie_test_isolated.rb"
55+
file = Shellwords.shellescape("#{dir}/test/active_model_serializers/railtie_test_isolated.rb")
56+
dir = Shellwords.shellescape(dir)
5557

5658
# https://github.com/rails/rails/blob/3d590add45/railties/lib/rails/generators/app_base.rb#L345-L363
5759
_bundle_command = Gem.bin_path('bundler', 'bundle')
5860
require 'bundler'
5961
Bundler.with_clean_env do
6062
command = "-w -I#{dir}/lib -I#{dir}/test #{file}"
6163
full_command = %("#{Gem.ruby}" #{command})
62-
system(full_command) or fail 'Failures' # rubocop:disable Style/AndOr
64+
system(full_command) or # rubocop:disable Style/AndOr
65+
fail 'Failures'
6366
end
6467
end
6568
end

0 commit comments

Comments
 (0)