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

Add configuration option for default template name to be used in conjunction with the choco new command #2377

Closed
TheCakeIsNaOH opened this issue Sep 22, 2021 · 2 comments · Fixed by #2390
Assignees
Labels
5 - Released Improvement IN REGRESSION TEST SUITE These are things that are handled by tools like Test-Kitchen
Milestone

Comments

@TheCakeIsNaOH
Copy link
Member

It would be a nice feature to be able to select the default template to use with a config option.

That way, a user can choco install a template, and then choco config set the default template, no need to go in and overwrite the files in the default folder manually.

If the specified default template name is missing/not installed, then a warning should be shown, and a build in template should be used instead.

This would allow #1366 to be implemented more easily, or at least the way I envision it being implemented. Choco could just include the current default template, and the new "edit friendly" template, then users could switch between using them as the default with a simple command.

@gep13 gep13 self-assigned this Sep 27, 2021
@gep13 gep13 added this to the 0.12.0 milestone Sep 27, 2021
@TheCakeIsNaOH
Copy link
Member Author

It may make sense to revert back to the built-in default template and display a warning if the template specified as the default is not found.

@gep13
Copy link
Member

gep13 commented Sep 27, 2021

@TheCakeIsNaOH yes, this sounds like a sensible warning to display when this happens!

gep13 added a commit to gep13/choco that referenced this issue Oct 3, 2021
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
gep13 added a commit to gep13/choco that referenced this issue Oct 3, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.
gep13 added a commit to gep13/choco that referenced this issue Oct 11, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to gep13/choco that referenced this issue Oct 11, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
TheCakeIsNaOH pushed a commit to TheCakeIsNaOH/choco that referenced this issue Dec 4, 2021
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
TheCakeIsNaOH pushed a commit to TheCakeIsNaOH/choco that referenced this issue Dec 4, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.
TheCakeIsNaOH pushed a commit to TheCakeIsNaOH/choco that referenced this issue Dec 4, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 23, 2021
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 23, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 23, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to TheCakeIsNaOH/choco that referenced this issue Dec 23, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
If the defaultTemplateName configuration value is set, and the user
hasn't specified a template name at the command line, check to see
whether a template exists with that name. If it does, use this as the
template when generating the new package.

Given that the default value for the new defaultTemplateName
configuration value is an empty string, if the user is directly
overriding the default template files folder, this overriding will still
take place.

Also take into consideration the usage of the --built-in command line
option. If this is set, make sure to respect it. The order of
precedence is the following:

1. choco new --template=name
2. choco new --built-in
3. choco config defaultTemplateName
4. Manually created files in $env:chocolateyinstall\templates\default
5. Fall back onto the built-in template.
gep13 added a commit to gep13/choco that referenced this issue Dec 23, 2021
Unit tests have been added to exercise the generate method of the
TemplateService to ensure that the template name that is used matches
the configured value.

- If option is set at the command line, it should win, even if there is
a default value in the chocolatey.config file.
- If default value is set in chocolatey.config file but path doesn't
exist, should use null value
- If default value is set in chocolatey.config file and path exists,
should be set to this template value
- If --built-in option is set, this should override default value in
chocolatey.config file
gep13 added a commit that referenced this issue Dec 23, 2021
(#2377) Add ability to configure default template name
@corbob corbob added the ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added label Jan 5, 2022
@gep13 gep13 changed the title Add config option to select default template Add configuration option for default template name to be used in conjunction with the choco new command Jan 17, 2022
@corbob corbob added IN REGRESSION TEST SUITE These are things that are handled by tools like Test-Kitchen and removed ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added labels Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Released Improvement IN REGRESSION TEST SUITE These are things that are handled by tools like Test-Kitchen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants