1

我正在尝试设置一个 rake 任务来运行具有特定标签(@server)的任何黄瓜场景。我在项目目录的根目录中有一个带有以下代码的 rakefile:

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

在项目的根目录中还有一个用于默认配置文件的 cucumber.yml 文件

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

我尝试在项目文件夹中的命令提示符下运行“jruby -S rake”,但出现此错误:

“'jruby.bat.exe' 不是内部或外部命令、可运行程序或批处理文件”

我是否试图以错误的方式运行任务?

我在 windows xp 上使用 jruby 1.5.6,版本 1.8。

提前感谢您的帮助!

4

1 回答 1

2

我会将此作为评论发布,但您的问题与 rake 无关,与 gem 安装有关

我很好奇,你在使用 RubyMine 吗?我之前使用 RubyMine 的安装程序为 jruby 安装 gems 时遇到过这个问题。无论出于何种原因,它都会在安装 gems 期间处理批处理文件。

例如,您的 rake.bat 文件应如下所示:

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

如果没有,它可能已被您的 gem 安装过程更新。

您正在正确执行命令,但是某些东西已经破坏了 rake.bat(或 cucumber.bat,也请检查它)以包含“jruby.bat.exe”的执行,而它应该只调用 jruby.exe 作为参考,我的 cucumber.bat 看起来像这样:

@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" %*
于 2011-08-25T15:34:03.583 回答