# ruby/rake architecture

> Architecture diagram of the GitHub repository ruby/rake, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ruby/rake
- Repository: https://github.com/ruby/rake

## Overview

Rake is a Ruby-based build-task runner. A user invokes the command-line application, which loads a Ruby Rakefile; the DSL declares tasks and prerequisites, and the task manager resolves them for invocation. Tasks run prerequisites before their own actions, while file tasks use timestamps to determine whether rebuilding is needed. Other documented capabilities include implicit rule patterns, file lists, parallel execution, and prepackaged tasks. The graph follows documented behavior and visible source references; unsampled implementation details are omitted where their connections cannot be verified.

Main entry points: [`lib/rake/application.rb`](https://github.com/ruby/rake/blob/master/lib/rake/application.rb) (Application CLI), [`lib/rake/task_manager.rb`](https://github.com/ruby/rake/blob/master/lib/rake/task_manager.rb) (Task manager), [`lib/rake/dsl_definition.rb`](https://github.com/ruby/rake/blob/master/lib/rake/dsl_definition.rb) (Task DSL), [`lib/rake/task.rb`](https://github.com/ruby/rake/blob/master/lib/rake/task.rb) (Task invocation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and configuration"]
  node_application["Application CLI<br/>[application.rb]"]
  node_options["CLI options<br/>[options.rb]"]
end

subgraph group_tasks["Task definition and resolution"]
  node_dsl["Task DSL<br/>[dsl_definition.rb]"]
  node_task_manager["Task manager<br/>[task_manager.rb]"]
  node_task["Task invocation<br/>[task.rb]"]
  node_rules["Implicit rules<br/>[task_manager.rb]"]
end

subgraph group_files["File and build support"]
  node_file_task["File tasks<br/>[file_task.rb]"]
  node_file_list["File lists<br/>[file_list.rb]"]
  node_file_utils["File utilities<br/>[file_utils_ext.rb]"]
  node_path_strings["Path mapping<br/>[string.rb]"]
end

subgraph group_execution["Execution and extensions"]
  node_parallel["Parallel tasks<br/>[thread_pool.rb]"]
  node_promise["Work promises<br/>[promise.rb]"]
  node_package_task["Package tasks<br/>[packagetask.rb]"]
  node_test_task["Test tasks<br/>[testtask.rb]"]
end

node_user(("Rake user"))
node_rakefile["Ruby Rakefile"]
node_build_output(("Build actions"))

node_user -->|"invokes"| node_application
node_application -->|"parses options"| node_options
node_application -->|"manages tasks"| node_task_manager
node_application -->|"loads rules"| node_rakefile
node_rakefile -->|"declares tasks"| node_dsl
node_dsl -->|"defines tasks"| node_task_manager
node_task_manager -->|"resolves tasks"| node_task
node_task -->|"invokes prerequisites"| node_task
node_task -->|"runs actions"| node_build_output
node_task_manager -->|"synthesizes tasks"| node_rules
node_task_manager -->|"creates rule tasks"| node_file_task
node_dsl -->|"defines file tasks"| node_file_task
node_file_task -->|"rebuilds files"| node_build_output
node_application -->|"uses file lists"| node_file_list
node_file_list -->|"uses file utilities"| node_file_utils
node_file_list -->|"maps paths"| node_path_strings
node_dsl -->|"exposes utilities"| node_file_utils
node_parallel -->|"queues work"| node_promise
node_rakefile -->|"requests parallel tasks"| node_parallel
node_rakefile -.->|"uses package tasks"| node_package_task
node_rakefile -.->|"uses test tasks"| node_test_task

click node_application "https://github.com/ruby/rake/blob/master/lib/rake/application.rb"
click node_options "https://github.com/ruby/rake/blob/master/lib/rake/options.rb"
click node_dsl "https://github.com/ruby/rake/blob/master/lib/rake/dsl_definition.rb"
click node_task_manager "https://github.com/ruby/rake/blob/master/lib/rake/task_manager.rb"
click node_task "https://github.com/ruby/rake/blob/master/lib/rake/task.rb"
click node_file_task "https://github.com/ruby/rake/blob/master/lib/rake/file_task.rb"
click node_rules "https://github.com/ruby/rake/blob/master/lib/rake/task_manager.rb"
click node_file_list "https://github.com/ruby/rake/blob/master/lib/rake/file_list.rb"
click node_file_utils "https://github.com/ruby/rake/blob/master/lib/rake/file_utils_ext.rb"
click node_path_strings "https://github.com/ruby/rake/blob/master/lib/rake/ext/string.rb"
click node_parallel "https://github.com/ruby/rake/blob/master/lib/rake/thread_pool.rb"
click node_promise "https://github.com/ruby/rake/blob/master/lib/rake/promise.rb"
click node_package_task "https://github.com/ruby/rake/blob/master/lib/rake/packagetask.rb"
click node_test_task "https://github.com/ruby/rake/blob/master/lib/rake/testtask.rb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_options,node_user toneBlue
class node_dsl,node_task_manager,node_task,node_rules toneAmber
class node_file_task,node_file_list,node_file_utils,node_path_strings toneMint
class node_parallel,node_promise,node_package_task,node_test_task toneRose
class node_rakefile,node_build_output toneIndigo
```

## Components

### Entry and configuration

- [Application CLI](https://github.com/ruby/rake/blob/master/lib/rake/application.rb): `lib/rake/application.rb`
- [CLI options](https://github.com/ruby/rake/blob/master/lib/rake/options.rb): `lib/rake/options.rb`

### Task definition and resolution

- [Task DSL](https://github.com/ruby/rake/blob/master/lib/rake/dsl_definition.rb): `lib/rake/dsl_definition.rb`
- [Task manager](https://github.com/ruby/rake/blob/master/lib/rake/task_manager.rb): `lib/rake/task_manager.rb`
- [Task invocation](https://github.com/ruby/rake/blob/master/lib/rake/task.rb): `lib/rake/task.rb`
- [Implicit rules](https://github.com/ruby/rake/blob/master/lib/rake/task_manager.rb): `lib/rake/task_manager.rb`

### File and build support

- [File tasks](https://github.com/ruby/rake/blob/master/lib/rake/file_task.rb): `lib/rake/file_task.rb`
- [File lists](https://github.com/ruby/rake/blob/master/lib/rake/file_list.rb): `lib/rake/file_list.rb`
- [File utilities](https://github.com/ruby/rake/blob/master/lib/rake/file_utils_ext.rb): `lib/rake/file_utils_ext.rb`
- [Path mapping](https://github.com/ruby/rake/blob/master/lib/rake/ext/string.rb): `lib/rake/ext/string.rb`

### Execution and extensions

- [Parallel tasks](https://github.com/ruby/rake/blob/master/lib/rake/thread_pool.rb): `lib/rake/thread_pool.rb`
- [Work promises](https://github.com/ruby/rake/blob/master/lib/rake/promise.rb): `lib/rake/promise.rb`
- [Package tasks](https://github.com/ruby/rake/blob/master/lib/rake/packagetask.rb): `lib/rake/packagetask.rb`
- [Test tasks](https://github.com/ruby/rake/blob/master/lib/rake/testtask.rb): `lib/rake/testtask.rb`

### Other components

- **Rake user**
- **Ruby Rakefile**
- **Build actions**

## Connections

- Rake user → Application CLI: invokes
- Application CLI → CLI options: parses options (evidence: `lib/rake/application.rb`)
- Application CLI → Task manager: manages tasks (evidence: `lib/rake/application.rb`)
- Application CLI → Ruby Rakefile: loads rules
- Ruby Rakefile → Task DSL: declares tasks
- Task DSL → Task manager: defines tasks (evidence: `lib/rake/dsl_definition.rb`)
- Task manager → Task invocation: resolves tasks (evidence: `lib/rake/task_manager.rb`)
- Task invocation → Task invocation: invokes prerequisites (evidence: `lib/rake/task.rb`)
- Task invocation → Build actions: runs actions
- Task manager → Implicit rules: synthesizes tasks (evidence: `lib/rake/task_manager.rb`)
- Task manager → File tasks: creates rule tasks (evidence: `lib/rake/task_manager.rb`)
- Task DSL → File tasks: defines file tasks (evidence: `lib/rake/dsl_definition.rb`)
- File tasks → Build actions: rebuilds files (evidence: `lib/rake/file_task.rb`)
- Application CLI → File lists: uses file lists (evidence: `lib/rake/application.rb`)
- File lists → File utilities: uses file utilities (evidence: `lib/rake/file_list.rb`)
- File lists → Path mapping: maps paths (evidence: `lib/rake/file_list.rb`)
- Task DSL → File utilities: exposes utilities (evidence: `lib/rake/dsl_definition.rb`)
- Parallel tasks → Work promises: queues work (evidence: `lib/rake/thread_pool.rb`)
- Ruby Rakefile → Parallel tasks: requests parallel tasks
- Ruby Rakefile → Package tasks: uses package tasks
- Ruby Rakefile → Test tasks: uses test tasks
