Skip to content
Henrik edited this page Aug 21, 2014 · 1 revision

The output task is the declarative way to state all of your typical file operations. For example, when you're creating the zip-able or redistributable package. Typically this step uses FileUtil, mv's, cp's.

desc "Prepare project output for publishing"
output :out => [:build, :test] do |out|
  out.from "bin/Release"
  out.to "out"
  out.dir "MyWebService"
  out.file "legal/LICENSE.txt", :as => "LICENSE"
  out.file "README.md"
  out.file "VERSION"
end

Required Parameters

From & To

The base directories to copy from and to, used in conjunction with the file and dir methods. The output task will create any path that it needs.

from "bin/Release"
to "out"

Optional Parameters

File & Dir

The files and directories to copy from the base from directory into the base to directory. You can rename the file or flatten the path by providing an :as option.

dir "MyWebService"
file "README.md"
file "legal/LICENSE.txt", :as => "LICENSE"

Preserve

Do not overwrite files in the destination.

preserve

ERB

Transform ERB templates, as an alternative to the XML transformations provided by the Microsoft tooling.

erb  "template.config", :as => "other.config", :locals => {:password => "xyz"}

Guidance

Be very careful with this task. Try not to use it to move files to remote shares or anything. It essentially runs rm -rf <destination> if you do not specify preserve. Test it locally, a lot.

Clone this wiki locally