I'm trying to set up a rake task to run any cucumber scenario with a certain tag(@server). I have a rakefile in the root of the project directory with this code:

require 'cucumber/rake/task'

desc "Get SQL response and store it in a file"
Cucumber::Rake::Task.new(:server, 'Execute SQL (@server only)') do |t|
    t.cucumber_opts = [ '--tags', '@server' ]
end

task :default => :server

With a cucumber.yml file for default profile in the root of the project as well

default: --profile server_cache
server_cache: --format pretty --tags @server

I try running "jruby -S rake" on the command prompt while in my project folder and I get this error:

"'jruby.bat.exe' is not recognized as an internal or external command, operable program or batch file"

Am I trying to run the task in a wrong way?

I'm using jruby 1.5.6, version 1.8, on windows xp.

Thanks in advance for any help!

有帮助吗?

解决方案

I would have posted this as a comment, but your problem has nothing to do with rake, and everything to do with gem installation

I'm curious, are you using RubyMine? I've had this problem before when I installed gems for jruby using RubyMine's installer. For whatever reason, it munges the batch files during installation of gems.

For example, your rake.bat file should look something like this:

@ECHO OFF
@"%~dp0jruby.exe" -S rake %*

If it doesn't, it's probably been updated by your gem install process.

You're executing the command correctly, but something has munged the rake.bat (or cucumber.bat, check it as well) to include an execution of 'jruby.bat.exe' when it should just call jruby.exe For reference, my cucumber.bat looks like this:

@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"jruby.exe" "C:/<path to jruby>/bin/cucumber" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"jruby.exe" "%~dpn0" %*
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top