Why does this Albacore zip task not create the zip file?
質問
When I run the zip task with rake –-trace
, it shows the calls to default
and zip_up_files
, but it doesn't create the zip file. It doesn't give me an error message. What am I doing wrong?
require 'albacore'
task :default => :zip_up_files
zip :zip_up_files do |zip|
zip.directories_to_zip 'C:\\Temp\\StuffToZip'
zip.output_file = 'out.zip'
zip.output_path = 'C:\\Temp'
end
解決
I tried your rakefile on my machine and got no errors and no zip file! I looked into the Albacore zip task and it uses the Ruby ZipFile class. That seems to be a pure Ruby implementation of the zip archive. So, next thing I tried was fixing up the paths to use forward slashes. That worked!
zip :zip_up_files do |zip|
zip.directories_to_zip 'C:/Temp/StuffToZip'
zip.output_file = 'out.zip'
zip.output_path = 'C:/Temp'
end
I had another thought, that maybe you didn't have permissions to write on the C drive. I wasn't able to reproduce that, but it's my recommendation to maybe be in a User controlled directory. Even if it's an automated build user. Just double check.
所属していません StackOverflow