rake script weird in cmd.exe, works fine in ruby.exe
Вопрос
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)
Решение
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...