Skip to content

Asgard

Asgard
"Loki collects the tricks.
Thor of Asgard runs them."
Key Features
  • Thor-Powered CLI — every Thor DSL feature available inside .loki task files
  • Task Dependencies — sequential, parallel, and mixed dependency graphs via depends_on
  • Concurrent Execution — parallel task groups run in native Ruby threads
  • Subcommands — group related tasks under a named namespace
  • Variables — shared configuration via Ruby class variables (@@name), visible across all tasks and subcommands
  • Shell Helperssh for any shell command or heredoc; shebang for polyglot scripts
  • Dotenv Support — load .env files into the environment with dotenv
  • Auto-Discovery.loki root marker searched from CWD upward through parent directories
  • Multi-File Tasks — split tasks across *.loki files loaded via import
  • Built-in Flags--version, --debug, and --verbose available on every task

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

Requirements