Skip to content

Instantly share code, notes, and snippets.

@geraldsamosir
Forked from jhass/RubyOnArch.md
Created October 17, 2017 08:33
Show Gist options
  • Select an option

  • Save geraldsamosir/fed30bd0b4acfa9b6b0681d5bbfd99b0 to your computer and use it in GitHub Desktop.

Select an option

Save geraldsamosir/fed30bd0b4acfa9b6b0681d5bbfd99b0 to your computer and use it in GitHub Desktop.

Revisions

  1. @jhass jhass revised this gist Feb 15, 2016. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions RubyOnArch.md
    Original file line number Diff line number Diff line change
    @@ -22,8 +22,8 @@ I thought I would document my setup, since it's somewhat non-standard but workin
    ```bash
    # pacman -S ruby
    $ yaourt -S chruby ruby-bundler
    $ mkdir -p ~/.rubies/2.2/bin
    $ ln -s /usr/bin/ruby ~/.rubies/2.2/bin/ruby
    $ mkdir -p ~/.rubies/2.3/bin
    $ ln -s /usr/bin/ruby ~/.rubies/2.3/bin/ruby
    $ echo "gem: --no-user-install --env-shebang" > ~/.gemrc
    ```

    @@ -39,21 +39,21 @@ RUBIES=(/opt/ruby* $HOME/.rubies/*)
    Optionally, but the entire point of this setup, install older Ruby versions:

    ```bash
    $ yaourt -S ruby2.1 ruby2.0 ruby2.1-bundler ruby2.0-bundler
    $ yaourt -S ruby2.1 ruby2.1-bundler ruby2.2 ruby2.2-bundler
    ```

    ## Upgrading

    When the [ruby package](https://www.archlinux.org/packages/extra/x86_64/ruby/) moves to a new minor or major version (`major.minor.teensy`), do the following (adjusting the versions of course):

    ```bash
    $ mv ~/.rubies/2.2 ~/.rubies/2.3
    $ mv ~/.rubies/2.3 ~/.rubies/2.4
    ```

    Most likely I will upload a package for the old release to the AUR:

    ```bash
    $ yaourt -S ruby2.2
    $ yaourt -S ruby2.3
    ```

    ## Per project setup
  2. @jhass jhass revised this gist Mar 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion RubyOnArch.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ I thought I would document my setup, since it's somewhat non-standard but workin

    * Install files outside your home folder that are not tracked by your package manager
    * Use ruby-install, ruby-build, rbenv or RVM
    * Allow you to switch to a specific outdated patchlevel version of Ruby.
    * Allow you to switch to a specific outdated patchlevel version of Ruby, out of the box.

    ## Setup

  3. @jhass jhass revised this gist Mar 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion RubyOnArch.md
    Original file line number Diff line number Diff line change
    @@ -69,7 +69,7 @@ Use a `Gemfile` and `bundle install` to install gems into your home folder, or `

    ## System wide gem installation

    Do not do `gem install as root, install the packages from the AUR like we already did for `ruby-bundler`, `ruby2.1-bundler` and so on. If the gem you want to install system wide isn't packaged yet, create one! Have a look at existing packages for inspiration or facilitate tools like [gem2arch](https://aur.archlinux.org/packages/gem2arch/).
    Do not do `gem install` as root, install the packages from the AUR like we already did for `ruby-bundler`, `ruby2.1-bundler` and so on. If the gem you want to install system wide isn't packaged yet, create one! Have a look at existing packages for inspiration or facilitate tools like [gem2arch](https://aur.archlinux.org/packages/gem2arch/).

    ## Scripting

  4. @jhass jhass revised this gist Mar 4, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion RubyOnArch.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # Ruby on Archlinux

    I thought I would document my setup, since it's somewhat non-standard but working quite well for me.

    ## What this does

    * Install major Ruby versions at their latest patch release
    @@ -40,7 +42,7 @@ Optionally, but the entire point of this setup, install older Ruby versions:
    $ yaourt -S ruby2.1 ruby2.0 ruby2.1-bundler ruby2.0-bundler
    ```

    # Upgrading
    ## Upgrading

    When the [ruby package](https://www.archlinux.org/packages/extra/x86_64/ruby/) moves to a new minor or major version (`major.minor.teensy`), do the following (adjusting the versions of course):

  5. @jhass jhass created this gist Mar 4, 2015.
    74 changes: 74 additions & 0 deletions RubyOnArch.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    # Ruby on Archlinux

    ## What this does

    * Install major Ruby versions at their latest patch release
    * Allow to switch between them seamlessly
    * Use chruby
    * Encourage bundler usage

    ## What this does not

    * Install files outside your home folder that are not tracked by your package manager
    * Use ruby-install, ruby-build, rbenv or RVM
    * Allow you to switch to a specific outdated patchlevel version of Ruby.

    ## Setup

    `yaourt` is used as an example AUR helper, use whichever you like or do it manually. Prefixed with `#` means run as root, prefixed with `$` means run as the user you regularly work with.

    ```bash
    # pacman -S ruby
    $ yaourt -S chruby ruby-bundler
    $ mkdir -p ~/.rubies/2.2/bin
    $ ln -s /usr/bin/ruby ~/.rubies/2.2/bin/ruby
    $ echo "gem: --no-user-install --env-shebang" > ~/.gemrc
    ```

    Edit your `~/.$SHELLrc` and add:

    ```bash
    # chruby
    source /usr/share/chruby/chruby.sh
    source /usr/share/chruby/auto.sh
    RUBIES=(/opt/ruby* $HOME/.rubies/*)
    ```

    Optionally, but the entire point of this setup, install older Ruby versions:

    ```bash
    $ yaourt -S ruby2.1 ruby2.0 ruby2.1-bundler ruby2.0-bundler
    ```

    # Upgrading

    When the [ruby package](https://www.archlinux.org/packages/extra/x86_64/ruby/) moves to a new minor or major version (`major.minor.teensy`), do the following (adjusting the versions of course):

    ```bash
    $ mv ~/.rubies/2.2 ~/.rubies/2.3
    ```

    Most likely I will upload a package for the old release to the AUR:

    ```bash
    $ yaourt -S ruby2.2
    ```

    ## Per project setup

    Create a `.ruby-version` file with the desired version to use, like

    ```
    2.2
    ```

    Use a `Gemfile` and `bundle install` to install gems into your home folder, or `bundle install --path vendor/bundle` to install gems to a per project directory.


    ## System wide gem installation

    Do not do `gem install as root, install the packages from the AUR like we already did for `ruby-bundler`, `ruby2.1-bundler` and so on. If the gem you want to install system wide isn't packaged yet, create one! Have a look at existing packages for inspiration or facilitate tools like [gem2arch](https://aur.archlinux.org/packages/gem2arch/).

    ## Scripting

    Use `/usr/bin/chruby-exec 2.1 -- regular command` to switch to a different Ruby environment in your scripts. This only works for scripts run as users that have this setup. Same holds true for systemd units, while you can use `chruby-exec` in `ExecStart` and friends, your service needs to have a `User=` to one with this setup.