Skip to content

Commit

Permalink
Merge pull request #1542 from bf4/rake_isolated_shellescape
Browse files Browse the repository at this point in the history
Escape paths in rake isolated for directory with spaces and parens
  • Loading branch information
bf4 committed Feb 26, 2016
2 parents b231401 + 042ec38 commit 3975e36
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ namespace :test do
namespace :isolated do
desc 'Run isolated tests for Railtie'
task :railtie do
require 'shellwords'
dir = File.dirname(__FILE__)
file = "#{dir}/test/active_model_serializers/railtie_test_isolated.rb"
file = Shellwords.shellescape("#{dir}/test/active_model_serializers/railtie_test_isolated.rb")
dir = Shellwords.shellescape(dir)

# https://github.com/rails/rails/blob/3d590add45/railties/lib/rails/generators/app_base.rb#L345-L363
_bundle_command = Gem.bin_path('bundler', 'bundle')
require 'bundler'
Bundler.with_clean_env do
command = "-w -I#{dir}/lib -I#{dir}/test #{file}"
full_command = %("#{Gem.ruby}" #{command})
system(full_command) or fail 'Failures' # rubocop:disable Style/AndOr
system(full_command) or # rubocop:disable Style/AndOr
fail 'Failures'
end
end
end
Expand Down

0 comments on commit 3975e36

Please sign in to comment.