Asgard¶
![]() "Loki collects the tricks. Thor of Asgard runs them." |
Key Features
|
Asgard is a Thor-based task runner for Ruby projects. Define tasks in .loki files, declare dependencies between them, and let Asgard handle ordering and concurrent execution. Anything Thor can do — subcommands, typed options, argument validation — is available inside a .loki file.
Quick Start¶
# Install
gem install asgard
# Create your project root marker
touch .loki
# Add your first task
cat >> .loki << 'EOF'
class Tasks
desc "Say hello"
def hello = puts "Hello from Asgard!"
end
EOF
# Run it
asgard hello
How It Works¶
Asgard searches upward from your current directory for a .loki file. That file marks the project root. Additional *.loki files in the same directory can be loaded via import "*.loki" at the top of .loki. All task files reopen class Tasks, which is pre-defined by the gem as a subclass of Asgard::Base (itself a Thor subclass).
The full Thor DSL is available: desc, method_option, class_option, long_desc, argument, default_task, map, and subcommand all work exactly as documented in Thor — with Asgard's own depends_on, sh, shebang, and dotenv layered on top.
Documentation¶
| Section | Description |
|---|---|
| Getting Started | Install, create your first .loki, run your first task |
| Defining Tasks | Parameters, options, long_desc, aliases, default_task |
| Dependencies | Sequential, parallel, and mixed dependency graphs |
| Variables | Static and lazy-evaluated task variables |
| Helper Methods | Private helpers and the no_commands block |
| Options & Flags | class_option, built-in flags, debug? and verbose? |
| Subcommands | Grouping tasks under a namespace |
| Shell Helpers | sh, shebang, and supported interpreters |
| Environment | Loading .env files with dotenv |
| Task Files | .loki root marker, --auto-load, multi-file layout |
| API Reference | Module methods, DSL methods, error classes |
| Examples | Working .loki files for every feature |
| Changelog | Release history |
