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

Distribute colorls as a standalone binary. #574

Open
2 of 5 tasks
LucaAngioloni opened this issue Feb 12, 2023 · 2 comments
Open
2 of 5 tasks

Distribute colorls as a standalone binary. #574

LucaAngioloni opened this issue Feb 12, 2023 · 2 comments

Comments

@LucaAngioloni
Copy link

LucaAngioloni commented Feb 12, 2023

Description

  • Relevant Issues : Clones in different language #52
  • Relevant PRs : (none)
  • Type of issue :
    • Installation
    • Font-related
    • Feature request
    • Bug in existing feature
    • Developer mode : Code quality / Tests / Documentation

Suggestion

Do you plan to distribute colorls as a standalone binary in the future?

I was thinking about "compiling" the gem with tools like ruby-packer or Travelling Ruby.

This way a user could install colorls without having to manage and maintain a ruby installation. Many people like me do not use ruby at all, and I have it installed in many different machines just to run colorls. Moreover, handling the PATH for Ruby ad gems slows down the shell sturtup (because the gem command is slow). Stuff like:

export PATH="$(gem environment | grep "EXECUTABLE DIRECTORY" | awk '{print $4}'):$PATH"
# or
gem which colorls

This, down the line, could result in the option of installing colorls like this:

brew install colorls
# or
sudo apt install colorls
@avdv
Copy link
Collaborator

avdv commented Mar 24, 2023

Nice idea (and that's exactly what I do with https://github.com/avdv/scalals), but...

I had a look at the projects you mentioned. Both of these had no activity for some time, and basically seem to be unmaintained.

Travelling Ruby supports Ruby up to version 2.4.10 and does not really produce a standalone binary, it packages a specially build Ruby interpreter for each platform and the code into a tarball. I would argue you're better off installing colorls from a package than using this.

ruby-packer packs the code into a squashfs container and thus produces a standalone binary. It would be interesting to see what this means for colorls' startup time. I tried to use it but it failed compilation with some incompatibilities, and I gave up. There are some (unmaintained) forks of this project that might help in making this work, but did not spent time on that. If you would like to look into that, that would be awesome!

There's also some effort for an AOT compiler for Ruby, as part of the Sorbet project: https://sorbet.org/blog/2021/07/30/open-sourcing-sorbet-compiler -- this could be a viable option, but also does not produce a standalone binary.

There is also TruffleRuby, the Ruby implementation from GraalVM. I did try it a couple years ago. At that time is was not feasible to use it, as it was too slow (IIRC). This might have changed in the meantime...

Packaging colorls for a specific distribution / package manager can be (preferably) done as is, without using a standalone binary since in this case you have dependency management and would simply declare ruby as a dependency and let the package manager do the heavy lifting. (currently colorls is available on nixpkgs / NixOS for instance)

@LucaAngioloni
Copy link
Author

LucaAngioloni commented Mar 24, 2023

Thank you for your reply!

As I mentioned, I am not a ruby expert.
I tried using ruby-packer but I run into the same issues you mentioned and I gave up.

I might try the other tools you suggested as well as the forks of ruby-packer. But I am not optimistic 😞

I understand your points though.

I will also try your clone. It might do the job for me.

This is what I want from a tool like this:

  • Easy to install and portable (I have many Linux machines and a Mac)
  • Fast!
  • Customise colours to match my custom theme
  • Git integration
  • Color coded file sizes, mod times and file permissions
  • Symbolic link references

Colorls has it all, apart from the first 2 which are so and so... This is still my best compromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants