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

Have task attempt to fallback to a Taskfile.dist.yml if Taskfile.yml does not exist #498

Closed
geekygnr opened this issue Jun 2, 2021 · 6 comments
Labels
good first issue Issues that are good for first-time contributors to pick up.

Comments

@geekygnr
Copy link

geekygnr commented Jun 2, 2021

We want to create a composer project containing tasks of everything that needs to be done for deployments, updates and maintenance.

A standard pattern with projects like this is to have a dist file that can be committed into code and used as a standard configuration until overridden.

An example of this is phpunit.xml.dist is looked for if phpunit.xml does not exist. phpunit.xml.dist would be committed into the repo while phpunit.xml would be a part of the gitignore to allow for environment specific settings.

The request is that task use a similar mechanism and look for a Taskfile.dist.yml when Taskfile.yml isn't present.

@geekygnr geekygnr added the type: feature A new feature or functionality. label Jun 2, 2021
@tylermmorton
Copy link
Contributor

Hi @geekygnr -- I think this could be achieved with a simple addition of the .dist files in defaultTaskFiles: https://github.com/go-task/task/blob/master/taskfile/read/taskfile.go#L23

defaultTaskfiles = []string{"Taskfile.yml", "Taskfile.yaml", "Taskfile.dist.yml", "Taskfile.dist.yaml"}

In this scenario you would have to include via directory as mentioned here: Lullabot/drainpipe#12 (comment)

Would like to hear from @andreynering about this but I'd be happy to put up a PR

@tylermmorton tylermmorton added enhancement good first issue Issues that are good for first-time contributors to pick up. and removed type: feature A new feature or functionality. labels Jan 17, 2022
@kerma
Copy link
Contributor

kerma commented Jan 18, 2022

Technically the problem could be solved today with using Taskfile.yml and Taskfile.yaml. Taskfile.yml is first in the list, so Taskfile.yaml could be used as a default fallback.

@andreynering
Copy link
Member

I think I like this idea. The implementation should also be simple as @tylermmorton mentioned.

A standard pattern with projects like this is to have a dist file that can be committed into code and used as a standard configuration until overridden. An example of this is phpunit.xml.dist.

@geekygnr Out of curiosity, do you know other tools that use this pattern other than phpunit?

@geekygnr
Copy link
Author

I see it most in php tools but that is also where I do most of my development. There are examples of it with phpunit and phpcs that can be seen in drupal core (https://github.com/drupal/drupal/tree/9.4.x/core), it is mentioned in symfony documentation (https://symfony.com/doc/2.2/cookbook/workflow/new_project_git.html).

@andreynering
Copy link
Member

Just merged as #666

@tylermmorton
Copy link
Contributor

tylermmorton commented Feb 20, 2022

Just merged as #666

Awesome! 😈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are good for first-time contributors to pick up.
Projects
None yet
Development

No branches or pull requests

5 participants