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

Run any arbitrary command from your rakefile. All tasks that just wrap a command line application will inherit the properties from this task, even if they aren't documented (it gets kind of redundant).

desc "A description of whatever this command does"
exec :whatever do |cmd|
  cmd.working_directory = "path/to/working/dir"
  cmd.command = "foo"
  cmd.parameters = ["-q"]
end

Required Parameters

Command

The command that you wish to use. This can be a relative path, for example, to a tool checked into your repository

command = "relative/path/to/command"

Or an absolute path, for example, to a tool that's installed machine-wide (you may want to use environment variables and File methods to ensure system independence)

command = File.join(ENV["PROGRAMFILES"], "partial/path/to/command/install")

Or, if the tool is on your environment PATH, whether directly (some tool's bin directory) or via a "shim" (like a bat file that redirects the call), you can just put the name in

command = "foo"

Optional Parameters

Parameters

Any valid parameter for your command, as an array, you are responsible for any quoting necessary (especially when inserting file paths or anything that may have spaces).

parameters = ["/S", "/File \"path/to/file\""]

Working Directory

A working directory other than the current directory.

working_directory = "foo/bar"

Guidance

Use Framework Version

We need to talk about the use method that is attached to some task's configurations.

Clone this wiki locally