Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Putting the installation method of scala-cli in an environment variable or a metadata file #670

Closed
zmerr opened this issue Feb 21, 2022 · 3 comments
Labels
priority: low requires scoping Issue requires a spike to revalidate it and assign an up-to date scope for its requirements. UX

Comments

@zmerr
Copy link
Contributor

zmerr commented Feb 21, 2022

Related to issue #543 currently, if a user forgets the previous method they used for installing scala-cli on their system, they might use another one for reinstalling. This creates a duplicate in PATH; therefore, even when a newer version is installed later, through a second method, this would be the old version that might show up first on PATH and get executed.

How it should behave:

The user types scala-cli —version or scala-cli about or scala-cli update.
Then the user receives information about the method with which they have installed scala-cli, for example Homebrew; and instructions get shown to them about how they should update scala-cli using this installation method, such as Homebrew.

How it can get Implemented :

We create a hidden command for scala-cli such as installMethod which then gets run by the installation tool, post installation. Upon receiving a command like scala-cli installMethod brew, Scala CLI creates an environment variable called $SCALA_CLI_INSTALLATION_METHOD and assigns the value brew to it.

This way, each time the about, version, or update commands are called; scala-cli can just read the value of this environment variable for knowing how it is installed, or even update itself through the same method.

Alternatively, the installation method can be written by the installation method to a metadata file put in the same directory as the executable file of scala-cli. Then scala-cli can read the contents of this file for responding to the above mentioned commands. The downside of this method is that the metadata file would get lost upon an installation directory change.

@zmerr
Copy link
Contributor Author

zmerr commented Feb 21, 2022

using Java Properties is another alternative for creating the metadata file:
https://docs.oracle.com/javase/tutorial/essential/environment/properties.html

Determining the location of this file remains an issue.

@alexarchambault
Copy link
Contributor

About this, I think a hackish way of doing could consist in appending a zip file at the end of the binaries right before putting them in packages. That zip file could contain an entry, like META-INF/scala-cli/source.json say, with a few metadata, like the package type, the typical command to update it, etc. Then the update command could try to open the binary path as a zip file, and check for that entry.

@Gedochao Gedochao added priority: low UX requires scoping Issue requires a spike to revalidate it and assign an up-to date scope for its requirements. labels Dec 13, 2023
@Gedochao
Copy link
Contributor

Given the number of installation methods and platforms we support, I do not believe it likely for us to have the resources necessary to hack this in a stable manner.
If anyone has a sane idea on how to implement this, then by all means, feel free to reopen.
Otherwise, closing for now, we won't fix this.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low requires scoping Issue requires a spike to revalidate it and assign an up-to date scope for its requirements. UX
Projects
None yet
Development

No branches or pull requests

3 participants