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?
You can use
thor installto 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.