Skip to content

The announcement for snap release. #1888

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

Merged
merged 7 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions en/documentation/installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Here are available installation methods:
* [Package Management Systems](#package-management-systems)
* [Debian, Ubuntu](#apt)
* [CentOS, Fedora, RHEL](#yum)
* [Snap](#snap)
* [Gentoo](#portage)
* [Arch Linux](#pacman)
* [macOS](#homebrew)
Expand Down Expand Up @@ -96,6 +97,23 @@ The installed version is typically the latest version of Ruby available
at the release time of the specific distribution version.


### snap (Ubuntu or other linux distribution)
{: #snap}

Snap is a package manager developed by Canonical. It's available out-of-the-box on Ubuntu, but snap also works on many Linux distributions.
You can use it like this.

{% highlight sh %}
$ sudo snap install ruby --classic
{% endhighlight %}

We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3:

{% highlight sh %}
$ sudo snap switch ruby --channel=2.3/stable
$ sudo snap refresh
{% endhighlight %}

### portage (Gentoo)
{: #portage}

Expand Down
39 changes: 39 additions & 0 deletions en/news/_posts/2018-11-08-snap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
layout: news_post
title: The official ruby snap is available
author: Hiroshi SHIBATA
translator:
date: 2018-11-08 14:58:28 +0000
lang: en
---

We released the official snap package of Ruby language.

https://snapcraft.io/ruby

Snap is a package system developed by Canonical. It allows you to distribute a software with its dependencies for many different Linux systems. This solves the problem that a user cannot install the latest Ruby release from the default repository of their system like in rpm or apt.

On Ubuntu 16.04 or later, you can use Ruby snap with the following command:

    sudo snap install ruby -classic

(If you use other Linux distributions, please refer to https://docs.snapcraft.io/installing-snapd/6735)

Our snap uses the "channel" feature to release multiple Ruby series concurrently. For example, without specifying a channel, 2.5.3 will be installed. But if you want to use Ruby 2.4, specify the 2.4 channel like the following:

    sudo snap install ruby --classic --channel=2.4/stable

You can also use multiple channels. The following commands switch to Ruby 2.3:

    sudo snap switch ruby --channel=2.3/stable
    sudo snap refresh

Our snap set `$HOME/.gem` to `GEM_HOME` and `GEM_PATH` environment variable. So if you want to execute commands installed by rubygems such as rails and rspec without using bundle exec, you have to add the following line to your shell rc files (like .bashrc):

    eval `ruby.env`

Since `$HOME/.gem` is shared by multiple versions, if you switch versions and use them, you will need to recompile C extensions using the `gem pristin --extensions` command.

The initial version of official Ruby snap has released during Snapcraft summit held at Canonical office in London on Nov 6-8th, 2018. Any feedbacks are welcomed at https://github.com/ruby/snap.ruby.

Enjoy!
37 changes: 37 additions & 0 deletions ja/news/_posts/2018-11-08-snap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: news_post
title: The official ruby snap is available
author: Hiroshi SHIBATA
translator:
date: 2018-11-08 14:58:28 +0000
lang: ja
---

Ruby の公式 snap パッケージをリリースしました。

https://snapcraft.io/ruby

snap は canonical が開発している新しいパッケージシステムです。独自のファイルシステムを利用して、バイナリの動作に必要なライブラリを全てパッケージングして配布することができます。snap を利用することで、 yum や apt のような Linux ディストリビューションのパッケージシステムを利用した時に、任意のバージョンをユーザーが自由に使うことができない問題を解決しました。

Ubuntu 16.04 以降のディストリビューションなら以下のコマンドで snap ruby を使うことができます。

sudo snap install ruby --classic

Ubuntu 以外のディストリビューションで snap を利用する場合の準備については https://docs.snapcraft.io/installing-snapd/6735 を参照してください。

Ruby の snap パッケージは channel と呼ばれる機能を用いて、現在メンテナンスしているバージョンを配信しています。例えば、2018/11 現在 channel を指定しない場合は 2.5.3 がインストールされますが、2.4 を利用したい場合は以下のように指定します。

sudo snap install ruby --classic --channel=2.4/stable

snap の機能を使うと複数の Ruby のバージョンを利用することができます。例えば、Ruby 2.3 に切り替えるには以下のコマンドを実行します。

sudo snap switch ruby --channel=2.3/stable
sudo snap refresh

また、snap の制限事項として、RubyGems は `$HOME/.gem` にインストールされるように GEM_HOME と GEM_PATH を設定しています。そのため、rails や rspec などのコマンドを `bundle exec` を用いずに実行したい場合は以下の行を `.bashrc` などに設定する必要があります。

eval `ruby.env`

`$HOME/.gem` は複数のバージョンで共有されるため、バージョンを切り替えて利用した場合、C 拡張などは `gem pristin --extensions` コマンドを用いて再コンパイルする必要があります。

この ruby snap は 11/6-8 にロンドンの canonical オフィスで開催された snapcraft summit で初めて公式バージョンをリリースしました。不具合やフィードバックは https://github.com/ruby/snap.ruby で受け付けています。お楽しみください。