server-edition icon indicating copy to clipboard operation
server-edition copied to clipboard

/usr/bin integration

Open FooBarWidget opened this issue 5 years ago • 5 comments

Rubies are now installed into their own directories that are not in PATH. This safe, but it's not very user-friendly, especially not for users who only intend to install 1 Ruby version on their system.

We should have some kind of way to provide /usr/bin/{ruby,gem,bundle,irb}. This will conflict with the system Ruby package, but c'est la vie.

On Debian/Ubuntu, we should integrate with the alternatives system.

How would this work? A proposal

We provide an optional fullstaq-ruby-system-integration package. This package contains the scripts /usr/lib/fullstaq-ruby/system-integration/bin/{ruby,gem,bundle,irb}.

These scripts simply call /usr/bin/rbenv exec ruby|gem|bundle|irb.

This package integrates with the alternatives system to ensure that /usr/bin/{ruby,gem,bundle,irb} are symlinked to the corresponding script in /usr/lib/fullstaq-ruby/system-integration/bin.

FooBarWidget avatar Jun 20 '19 12:06 FooBarWidget

I was coming to look for this -- if this means no need to run rbenv or any other version switcher? You could effectively install as the default system ruby? I am very interested in that feature!

jrochkind avatar Sep 03 '19 15:09 jrochkind

Correct, that's exactly what this is supposed to be.

FooBarWidget avatar Sep 03 '19 18:09 FooBarWidget

Ah, but reading more closely, rbenv is still there, you just don't need to know about it. "These scripts simply call /usr/bin/rbenv exec {ruby|gem|bundle|irb}".

Hmm, if that's really all they do... this is a pretty trivial implementation, I could try it out myself by just writing those four scripts myself? (I still kind of wish there was no rbenv involved at all, but i'm not sure how rational this is).

jrochkind avatar Sep 03 '19 18:09 jrochkind

Yes it should be pretty trivial (though integration with the Debian alternatives system needs to be figured out, and documentation needs to be written for it). And contributions are always welcome.

FooBarWidget avatar Sep 04 '19 18:09 FooBarWidget

I'm using update-alternatives on Ubuntu. No need for rbenv.

# install ruby 3.0
RUN apt-get update -q \
    && apt-get dist-upgrade --assume-yes \
    && apt-get install --assume-yes -q --no-install-recommends \
      curl \
      gnupg \
      apt-transport-https \
      ca-certificates

RUN curl -SLf https://raw.githubusercontent.com/fullstaq-labs/fullstaq-ruby-server-edition/main/fullstaq-ruby.asc | apt-key add - \
    && echo "deb https://apt.fullstaqruby.org ubuntu-20.04 main" > /etc/apt/sources.list.d/fullstaq-ruby.list \
    && apt-get update -q \
    && apt-get install --assume-yes -q --no-install-recommends fullstaq-ruby-3.0 \
    && apt-get autoremove --assume-yes \
    && rm -rf /var/lib/apt/lists \
    && rm -fr /var/cache/apt \
    && rm /etc/apt/sources.list.d/fullstaq-ruby.list

RUN update-alternatives --install /usr/local/bin/bundle  bundle  /usr/lib/fullstaq-ruby/versions/3.0/bin/bundle  100
RUN update-alternatives --install /usr/local/bin/bundler bundler /usr/lib/fullstaq-ruby/versions/3.0/bin/bundler 100
RUN update-alternatives --install /usr/local/bin/gem     gem     /usr/lib/fullstaq-ruby/versions/3.0/bin/gem     100
RUN update-alternatives --install /usr/local/bin/irb     irb     /usr/lib/fullstaq-ruby/versions/3.0/bin/irb     100
RUN update-alternatives --install /usr/local/bin/ruby    ruby    /usr/lib/fullstaq-ruby/versions/3.0/bin/ruby    100

p8 avatar May 23 '22 09:05 p8