设置 rake 任务来运行特定的 Cucumber 场景

发布于 2024-12-01 08:11:21 字数 677 浏览 3 评论 0原文

我正在尝试设置一个 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。

预先感谢您的任何帮助!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯了 2024-12-08 08:11:21

我本来想将此作为评论发布,但你的问题与 rake 无关,而与 gem 安装有关

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

例如,您的 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" %*

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" %*
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文