Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressStep Wrapper Concept #388

Open
dshoreman opened this issue May 2, 2021 · 0 comments
Open

ProgressStep Wrapper Concept #388

dshoreman opened this issue May 2, 2021 · 0 comments

Comments

@dshoreman
Copy link
Owner

ProgressStep could potentially be improved by taking a callback either in its constructor or a separate run() method (for example). It would allow us to send the ProjectProgress events automatically before/after executing the callback, rather than adding them manually for every step in the process.

// Consider this...
$step = new ProgressStep('nginx.reload', 'Reloading the nginx config');

$step->run(fn ($event) => {
    exec('systemctl reload-or-restart nginx.service');
});

// ...or even this...
(new ProgressStep('nginx.reload', 'Reloading the nginx config'))->run(fn ($event) => {
    exec('systemctl reload-or-restart nginx.service');
});

// ...vs this
ProjectProgress::dispatch($event->project, $step = new ProgressStep('nginx.reload', 'Reloading nginx service'));

exec('systemctl reload-or-restart nginx.service');

ProjectProgress::dispatch($event->project, $step->complete());
@dshoreman dshoreman created this issue from a note in Progress Component (To do) May 2, 2021
@dshoreman dshoreman added this to To do in Projects, Apps and Redirects via automation May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant