Ruby latest stable (v2_5_5) - 0 notes - Class: DSL

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2_2_9) is shown here.

task(*args, &block) private

Declare a basic task. The task_name is always the first argument. If the task name contains a “:” it is defined in that namespace.

The dependencies may be a single task name or an Array of task names. The argument (a single name) or arguments (an Array of names) define the arguments provided to the task.

The task, argument and dependency names may be either symbols or strings.

A task with a single dependency:

task clobber: %w[clean] do
  rm_rf "html"

A task with an argument and a dependency:

task :package, [:version] => :test do |t, args|
  # ...

To invoke this task from the command line:

$ rake package[1.2.3]

Alternate definition:

task :package, :version, needs: :test do |t, args|
  # ...
Show source
Register or log in to add new notes.