npryce / adr-tools

Command-line tools for working with Architecture Decision Records
Other
4.64k stars 588 forks source link

Add ADR_TEMPLATES_DIR env var to customize templates path #4

Closed olleolleolle closed 8 years ago

olleolleolle commented 8 years ago

Addressing #2 - this will make it easier to inreplace in the package managers' scripts.

I tried using it, like this:

$ mkdir ~/slask/t/
$ cp src/*.md ~/slask/t/
$ vi ~/slask/t/init.md
$ ADR_TEMPLATES_DIR=~/slask/t ./adr-init

(Slask is Swedish for "mush" or "sleet".)

npryce commented 8 years ago

The CI test fails because of differences between bash on the CI server and other platforms.

Unfortunately the tests, though quick to write, are overly sensitive to platform differences.

The solution, I think, is to not have spaces in the dummy content of the template.

npryce commented 8 years ago

I think custom templates are a great idea. But maybe an environment variable is not the best way.

How about if the tool looks into a templates/ subdirectory of the ADR directory? If it finds the template there, it will use it, otherwise it will fall back to the built-in default.

(I'm also mulling over ways to avoid the ADR_DIR environment variable. Currently thinking of a hidden .adr file in the root of the project containing the name of the ADR directory.

npryce commented 8 years ago

Ah, actually reading the comments above (and not just the code!) I see that the PR is to help with packaging. This looks like a good idea, and I'm happy to pull the changes in when the CI build is passing.

I'm also thinking of better ways to manage packaging. See issue #2. Input welcome.

npryce commented 8 years ago

Actually, don't try to fix the tests. I think I've got an implementation that will make it easier to do this kind of thing. I'll push that to master and would appreciate your thoughts.

olleolleolle commented 8 years ago

Perfect!

Improving on ideas when cheap.