Closed misaka closed 1 year ago
After a chat with @tvararu I've double-checked that this template works for the non-asdf path. I ran it by setting the tools versions asdf
uses in my shell (setting ASDF_NODEJS_VERSION
, ASDF_YARN_VERSION
, etc), so this is not a 100% asdf
-less test, but as the test doesn't install .tools-version
I think this is close enough to show that these changes haven't introduced any new issues. Any issues using non-asdf
tool installations should probably be addressed in a separate PR.
I've also addressed a couple more issues relating to the asdf
path:
asdf
section in READMEBefore instructions for asdf
would be added as part of the h2 "Setup" section. This meant that if asdf
was not installed then there would be no h2 "Setup" heading, and the h3 headings that follow for linting, etc, wouldn't be nested into an h2 nicely.
Now an h2 "Setup" heading is always added and asdf
gets it's own h3 section.
asdf
setup if .tools-version
file detectedIf a .tools-version
file was detected before, the entire asdf
setup was aborted, meaning no instructions added to the README (which gets regenerated every run, so would be blank). Now the asdf
section is added to the README and the plugins are added even if .tools-version
is detected.
.ruby-version
templateRails already installs this for us, so this is one less thing for us to worry about. Rails also uses the (more) correct format with ruby-
included:
ruby-3.1.2
whereas ours was just the version, i.e. 3.1.2
I ran into an issue trying to run bundle with a project generated from this template, and uncovered a couple of other issues.
Running bundle from a project generated with this template fails because the
pg
gem fails to build.The key here is
No version is set for command pg_config
.asdf
doesn't know what version of postgres to use becausebundle
it's changed to a directory that isn't the project directory. This is annoying and not this template's fault, but we can add instructions on how to circumvent this.Change 1: Update generated README
Non-obvious failures when running without dependencies
When running the template without the dependencies available, or as in my case, incorrectly assuming that since it's using
asdf
it will pick up the correct dependencies, the run fails with errors that aren't obvious. This could lead users to incorrectly assuming that an incorrectly setup project is now ready.This happens because
asdf
was setup after other steps, like installing gems, yarn, etc. The only way to make this work correctly and as expected is to either haveasdf
configured correctly for this project already, or by setting upasdf
before we do these other setup steps.Change 2: Setup asdf first
The script now does the
asdf
setup before the other steps to ensure the gems and node packages get installed to the right place.Change 3: Install required plugins using asdf
When setting up
asdf
, the plugins we rely on will be installed by runningasdf plugin add ______
to ensure they are available to the rest of the setup process.Change 4: Update our README
The README for this project now makes it clear that some required tools will be installed using
asdf
if that option is selected. It also has examples of how to check the versions of the installed tools ifasdf
is not used, to help make it clearer to users what's expected.Change 5: Move adrs setup to end
Because moving the
asdf
setup to the beginning affects how the README file is generated, the "How the application works" section was wrongly placed in the middle of the Setup section. To fix this, the ADRs setup has been moved to the end of the script. This doesn't break the script since there are no dependencies aside from installing therladr
, which is not installed in the correctasdf
Ruby instance.