rake 脚本在 cmd.exe 中很奇怪,在 ruby.exe 中工作正常
我有这个 rakefile 在从“使用 Ruby 启动命令提示符”实例调用时工作正常,但在使用 rake.bat
调用时失败。这意味着我根本无法使用 Rake 构建步骤插件让它在 Jenkins 上工作。
据我所知,是 rake/clean 任务弄乱并删除了“/Core”目录中的所有文件。我已经明确地将其从 CLEAN
文件列表中排除,但是当从 rake.bat
调用时,它被完全忽略。
造成这种情况的原因可能是什么?
编辑: 好的,更多信息。第一次在 Ruby shell 中运行时,CLEAN.exclude('**/core')
也会被忽略,但后续运行正常。这就解释了为什么 rake.bat
100% 都是问题。
我使用的是 rake 0.8.7,但 0.9.2 也会发生同样的情况。 Ruby 版本是 1.9.2p290。 albacore 版本是 0.2.7。 Windows 7 x64(Windows Server 2008 R2 Standard 上也会发生同样的情况)
I have this rakefile that works fine when called from a "Start Command Prompt with Ruby" instance, but fails when called with rake.bat
. This means I can't get it to work on Jenkins at all using the Rake build step plugin.
From what I can tell, it's the rake/clean
task that's messing up and deleting all files in a "/Core" directory. I've explicitly excluded this from the CLEAN
filelist, but when called from rake.bat
, this is completely ignored.
What could possibly be the cause for this?
Edit:
OK, more info. CLEAN.exclude('**/core')
is ignored the first time it's run in the Ruby shell too, but subsequent runs are fine. That explains why rake.bat
is a problem 100% of the time.
I'm using rake 0.8.7, but the same thing happens with 0.9.2. Ruby version is 1.9.2p290. albacore version is 0.2.7. Windows 7 x64 (same thing happens on Windows Server 2008 R2 Standard)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我解决了。
应该早点意识到这一点,但这太奇怪了。
第一次失败:
CLEAN.exclude("**/core", "**/bak", "**/~") # a comment here
这总是有效的:
CLEAN.排除(“**/core”,“**/bak”,“**/~”)
我想我从此将删除不在我的rakefiles中的一行上的所有注释......
OK, I solved it.
Should've realised it earlier, but it's mind-boggingly weird.
fails the first time:
CLEAN.exclude("**/core", "**/bak", "**/~") # a comment here
this always works:
CLEAN.exclude("**/core", "**/bak", "**/~")
I guess I'm henceforth removing all comments that are not on a single line in my rakefiles...