#
import
Optional
Import and blend actions from external runfiles. The provided argument is a relative path to the file, without the runfile extension, or a glob pattern to import multiple files.
title 'Dev Tools'
import 'server'
title 'Server Commands'
action 'start' do
say 'Starting server'
end
action 'stop' do
say 'Starting server'
end
$ run
Usage:
run server
run [COMMAND] (--help | -h)
$ run server
Usage:
run server start
run server stop
run server (--help | -h)
$ run server start
Starting server
To import multiple files, use a wildcard.
title 'Dev Tools'
import 'tasks/*'
title 'Server Commands'
action 'start' do
say 'Starting server'
end
action 'stop' do
say 'Starting server'
end
title 'Connect to SSH'
action do
say 'Connecting to ssh'
end
$ run
Usage:
run server
run ssh
run [COMMAND] (--help | -h)
$ run server
Usage:
run server start
run server stop
run server (--help | -h)
$ run ssh
Connecting to ssh
The import
directive accepts additional key: value
pairs, which will be
forwarded to the imported runfile as the context
hash.
The imported runfile can optionally use the require_context
directive to
either set default values to context variables, or require that they will be
provided by the importer.
title 'DevOps Tools'
import 'server', cloud: 'azure'
title 'Server Commands'
require_context :cloud, default: 'aws'
action 'deploy' do
say "Deploying to #{context[:cloud]}"
end
$ run
Usage:
run server
run [COMMAND] (--help | -h)
$ run server
Usage:
run server deploy
run server (--help | -h)
$ run server deploy
Deploying to azure