Add an option for rake task to select ruby interpreter
Reported by pluskid | April 8th, 2008 @ 06:35 PM | in No-Milestone-Assigned
My problem is that I've installed both ruby 1.8 (as ruby) and
ruby 1.9 (as ruby1.9) on my system. I use spec/rake/spectask for
my Rakefile. But the generated command is
ruby -I.. blabla
it should be "ruby1.9 -I... blabla", but after look at the code
of spectask.rb, I found this line:
==> cmd = "ruby "
rb_opts = ruby_opts.clone
rb_opts << "-I\"#{lib_path}\""
rb_opts << "-S rcov" if rcov
rb_opts << "-w" if warning
A better idea is to let the ruby interpreter command a customizable option instead of hard-coded constant.
Comments and changes to this ticket
-
Aslak Hellesøy April 8th, 2008 @ 11:51 PM
- → State changed from new to open
Rake has a #ruby method that forks a new ruby interpreter of the same kind as the one used to start rake itself. This should work for JRuby, Ruby 1.9/1.8 etc.
Would this work instead of explicitly setting what ruby to use? I can't think of a case where, say, you'd start rake with 1.8 and have the specs run with 1.9. Or?
-

pluskid April 9th, 2008 @ 04:51 AM
no, in fact, I'm using rake-1.9 to invoke the command. But the rspec task produced a string like "ruby blablabla" and use "system" to execute that (look at the "define" method of spectask.rb). It should be "*ruby-1.9 blablabla" because "ruby" will refer to Ruby 1.8 on my system.
-
Aslak Hellesøy April 9th, 2008 @ 07:58 AM
I think you misunderstood me. I'm suggesting that we change the Rake task to use the ruby method that comes with Rake.
-

pluskid April 9th, 2008 @ 09:26 AM
Oh, I'm sorry. I see now. And that would be OK to use the ruby method that comes with Rake at least for my situation. :)
-
Aslak Hellesøy April 9th, 2008 @ 11:18 AM
- → Assigned user changed from to Aslak Hellesøy
-

-

Brian Takita May 25th, 2008 @ 09:10 PM
- → State changed from open to resolved
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
