3scale / apisonator

Red Hat 3scale API Management Apisonator backend
https://3scale.net
Apache License 2.0
36 stars 27 forks source link

add .tools-versions and ignore .env file #305

Closed akostadinov closed 2 years ago

akostadinov commented 2 years ago

follow-up to #279

in case Apisonator project prefers tools versions to be in source, then also adding .tools-versions which is used by the asdf version manager.

Ignoring .env as my understanding is that it is for local purposes and may differ from setup to setup. So avoiding to be comitted by mistake.

unleashed commented 2 years ago

@akostadinov I can't figure out what is it that this PR is fixing, so let me ask you a few questions below so that I can better understand it.

The information this new .tool-versions file is conveying already exists for the very same purpose in .ruby-version, which is the one we work with and standardized for many years across different version managers. If you work with asdf, the real fix would be for that manager to read .ruby-version and honor its values. Quite frankly, if this asdf manager is popular I'd be surprised it does not respect this standard file. Can you make it work as-is with .ruby-version? In addition, ideally, you would never run anything locally but in the development environment, which is a container that is already set up for you with the right Ruby version.

Regarding the .env file I don't understand your use case. Where are you using it that requires sourcing it? I've never had this need for the project before. Perhaps those needs are addresses once you run tests in the make dev development container?

akostadinov commented 2 years ago

@unleashed , thank you for looking at this.

asdf-vm is great for versioning many tools, not only ruby. .env is used by different tools for local environment setup when you work in a particular directory. I'm running apicast in container, importing project in IDE though is local.

The ultimate issue I'm trying to fix is to avoid git showing these files as new locally. If I add the two of them to .gitignore would that be accepted?

hallelujah commented 2 years ago

As for 3scale/porta we do not add in git the .tool-versions. On the contrary it is ignored https://github.com/3scale/porta/blob/c78c49870c5c421d3a7b522fa3445e1a039f3d3a/.gitignore#L30

Though we have a sample in porta, it is not relevant in apicast.

unleashed commented 2 years ago

@akostadinov ok, so now I understand better the needs, however I have a few more questions for you before we proceed.

So it appears asdf claims it supports .ruby-version. Have you tried it out with just the current .ruby-version file? Does your IDE not use asdf or otherwise something reading .ruby-version? If so then .tool-versions would be unnecessary.

Regarding git showing local files as new you usually solve this differently when you are introducing new tools, especially when using tooling that isn't common among the developers. In those cases you either use a global .gitignore file, ie. git config --global core.excludesfile $HOME/.config/git/ignore && echo .tool-versions >> $HOME/.config/git/ignore, or if the tooling is very specific to a particular repo you just add it to your repo's excludes file, ie. echo .tool-versions >> .git/info/exclude.

Try these out and let me know whether they work for you.

PS: @akostadinov @hallelujah I guess you meant apisonator, not apicast?

hallelujah commented 2 years ago

@unleashed yes apisonator... to many IPA Thanks for the local ignore tip!

akostadinov commented 2 years ago

I see that asdf-vm supports that with an additional setting inside ~/.asdfrc. Nice to know. Also nice tip about gitignore. Thanks.

This works for me so I'm closing PR.