Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use "global" Thorfile

I want to use Thor with thor-scmversion to bump the version of my Chef cookbooks. The normal way of using Thor is to create a Thorfile in the project folder and have tasks implemented in there. For my use case I would have to create a Thorfile in every cookbook I write containing only

require 'thor/scmversion'

My question is, whether I can somehow put such a file in a "global" directory and point to it, when I run thor on the command line from within my project folder.

Edit

I followed @coderanger's advice and used thor install Thorfile. This creates a directory .thor in the user's home directory (in my case: /var/lib/jenkins/.thor) and a thor.yml file that includes a reference to the Thorfile I added with the upper command.

When I now run thor list, I get

$ thor list
version
-------
thor version:bump TYPE [PRERELEASE_TYPE]  # Bump version number (type is major, minor, patch, prerelease or auto)
thor version:current                      # Show current SCM tagged version

but running thor version:current, I get the following error:

Could not find command "version:current".

So probably I missed something?

like image 385
Michael Lihs Avatar asked Jun 03 '26 05:06

Michael Lihs


1 Answers

You can use thor install to set up a system-wide task. Bear in mind this might make things more difficult for other people since it won't be set up in git for them.

like image 118
coderanger Avatar answered Jun 05 '26 20:06

coderanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!