Clone this wiki locally
The ZipTask allows you to package local files into a .zip file, making it easier to move a large set of files to another location.
How to use the ZipTask
The zip task has a number of properties to find the files to zip and where to save the output.
- directories_to_zip – This accepts an array of directories which should be included in the zip. If you provide multiple directories, then they will keep the directory structure inside the zip. If only one directory is provided, then the files within that directory will appear in the root.
- additional_files – [Optional] While zipping complete directories solves one problem, there are times when you need to include other files such as release notes within the zip as well.
- output_file – this is the filename of the zip
- output_path – [Optional] Where you want the final zip to be saved to. In this example, it is the same directory as your build file. If no path provided, the first path provided for directories_to_zip property will be used.
zip do |zip| zip.directories_to_zip "lib", "spec" zip.additional_files = "README.markdown" zip.output_file = 'source.zip' zip.output_path = File.dirname(__FILE__) end
Above example can be found in Rakefile.rb