Class | Rake::Application
In: | lib/rake.rb
Parent: | Object

Rake main application object. When invoking `rake` from the command line, a Rake::Application object is created and run.

### Methods

add_import add_loader collect_tasks const_warning display_prerequisites display_tasks_and_comments dynamic_width dynamic_width_stty dynamic_width_tput find_rakefile_location handle_options have_rakefile init invoke_task load_imports load_rakefile new options parse_task_string rake_require rakefile_location run standard_exception_handling standard_rake_options system_dir terminal_width top_level truncate truncate_output? tty_output= tty_output? unix? windows?

### Included Modules

TaskManager

### Constants

DEFAULT_RAKEFILES | = | ['rakefile', 'Rakefile', 'rakefile.rb', 'Rakefile.rb'].freeze

### Attributes

name | [R] | The name of the application (typically ‘rake’)
original_dir | [R] | The original directory where rake was invoked.
rakefile | [R] | Name of the actual rakefile used.
top_level_tasks | [R] | List of the top level task names (task names from the command line).

### Public Class methods

new()

Initialize a Rake::Application object.

### Public Instance methods

add_import(fn)

Add a file to the list of files to be imported.

add_loader(ext, loader)

Add a loader to handle imported files ending in the extension `ext`.

collect_tasks()

Collect the list of tasks on the command line. If no tasks are given, return a list containing only the default task. Environmental assignments are processed at this time as well.

const_warning(const_name)

Warn about deprecated use of top level constant names.

display_prerequisites()

Display the tasks and prerequisites

display_tasks_and_comments()

Display the tasks and comments.

dynamic_width()

Calculate the dynamic width of the

dynamic_width_stty()
dynamic_width_tput()
find_rakefile_location()
handle_options()

Read and handle the command line options.

have_rakefile()

True if one of the files in RAKEFILES is in the current directory. If a match is found, it is copied into @rakefile.

init(app_name='rake')

Initialize the command line parameters and app name.

invoke_task(task_string)

private —————————————————————-

load_imports()

Load the pending list of imported files.

load_rakefile()

Find the rakefile and then load it and any pending imports.

options()

Application options from the command line

parse_task_string(string)
rake_require(file_name, paths=$LOAD_PATH, loaded=$")

Similar to the regular Ruby `require` command, but will check for *.rake files in addition to *.rb files.

rakefile_location()
run()

Run the Rake application. The run method performs the following three steps:

- Initialize the command line options (`init`).
- Define the tasks (`load_rakefile`).
- Run the top level tasks (`run_tasks`).

If you wish to build a custom rake command, you should call `init` on your application. The define any tasks. Finally, call `top_level` to run your top level tasks.

standard_exception_handling() {|| ...}

Provide standard execption handling for the given block.

standard_rake_options()

A list of all the standard options used in rake, suitable for passing to OptionParser.

system_dir()

The directory path containing the system wide rakefiles.

terminal_width()
top_level()

Run the top level tasks of a Rake application.

truncate(string, width)
truncate_output?()

We will truncate output if we are outputting to a TTY or if we‘ve been given an explicit column width to honor

tty_output=( tty_output_state )

Override the detected TTY output state (mostly for testing)

tty_output?()

True if we are outputting to TTY, false otherwise

unix?()
windows?()

[Validate]