Skip to content

Commit

Permalink
Defines shellescape method
Browse files Browse the repository at this point in the history
Method allows newer versions of Ruby to use string.shellescape while not breaking in 1.8.6
  • Loading branch information
Charlie Maffitt committed Nov 13, 2012
1 parent 3e95e4e commit f5e14f0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/rspec/core/rake_task.rb
Expand Up @@ -157,11 +157,21 @@ def run_task(verbose)

private

if RUBY_VERSION == '1.8.6'
def shellescape(string)
string.gsub(/"/, '\"').gsub(/'/, "\\\\'")
end
else
def shellescape(string)
string.shellescape
end
end

def files_to_run
if ENV['SPEC']
FileList[ ENV['SPEC'] ].sort
else
FileList[ pattern ].sort.map { |f| f.shellescape }
FileList[ pattern ].sort.map { |f| shellescape(f) }
end
end

Expand Down

0 comments on commit f5e14f0

Please sign in to comment.