| Q | A
| ----------------- | ---
| Issue Type | Question
| Deployer Version | 6.4.3
| Local Machine OS | ubuntu
| Remote Machine OS | ubuntu
The documentation doesn't say I need to pass a stage or host when running tasks, can you not have standalone tasks without requiring a host or stage for general commands you want to run before staging and all that jazz?
I've also tried calling ->local() on the task and I still get the same error.
Actually, it's a bit hidden on this page.
You have to add the following code to your deploy.php file:
set('default_stage', 'staging');
I've found that option useful for as the same need. Reference: #1517
https://deployer.org/docs/hosts.html#localhost
Here is my simple solution:
set('default_stage', 'local');
task('test', function ()
{
$result = run('uptime');
writeln('uptime: '. $result);
});
localhost()
->stage('local');
dep test command will use default_stage as stage default by itself. Also you don't need to use runLocally or ->local() anymore for non-stage tasks.
Fixed!
<?php
namespace Deployer;
task('test', function () {
run('date');
});
Most helpful comment
Actually, it's a bit hidden on this page.
You have to add the following code to your
deploy.phpfile: