Skip to content

Commit ed6c059

Browse files
authored
Merge pull request #1888 from ruby/snap
The announcement for snap release.
2 parents 725ca8f + c1685d7 commit ed6c059

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

en/documentation/installation/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Here are available installation methods:
3535
* [Package Management Systems](#package-management-systems)
3636
* [Debian, Ubuntu](#apt)
3737
* [CentOS, Fedora, RHEL](#yum)
38+
* [Snap](#snap)
3839
* [Gentoo](#portage)
3940
* [Arch Linux](#pacman)
4041
* [macOS](#homebrew)
@@ -96,6 +97,23 @@ The installed version is typically the latest version of Ruby available
9697
at the release time of the specific distribution version.
9798

9899

100+
### snap (Ubuntu or other linux distribution)
101+
{: #snap}
102+
103+
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.
104+
You can use it like this.
105+
106+
{% highlight sh %}
107+
$ sudo snap install ruby --classic
108+
{% endhighlight %}
109+
110+
We have several channels per Ruby minor series. For instance, the following commands switch to Ruby 2.3:
111+
112+
{% highlight sh %}
113+
$ sudo snap switch ruby --channel=2.3/stable
114+
$ sudo snap refresh
115+
{% endhighlight %}
116+
99117
### portage (Gentoo)
100118
{: #portage}
101119

en/news/_posts/2018-11-08-snap.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
layout: news_post
3+
title: The official ruby snap is available
4+
author: Hiroshi SHIBATA
5+
translator:
6+
date: 2018-11-08 14:58:28 +0000
7+
lang: en
8+
---
9+
10+
We released the official snap package of Ruby language.
11+
12+
https://snapcraft.io/ruby
13+
14+
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.
15+
16+
On Ubuntu 16.04 or later, you can use Ruby snap with the following command:
17+
18+
    sudo snap install ruby -classic
19+
20+
(If you use other Linux distributions, please refer to https://docs.snapcraft.io/installing-snapd/6735)
21+
22+
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:
23+
24+
    sudo snap install ruby --classic --channel=2.4/stable
25+
26+
You can also use multiple channels. The following commands switch to Ruby 2.3:
27+
28+
    sudo snap switch ruby --channel=2.3/stable
29+
    sudo snap refresh
30+
31+
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):
32+
33+
    eval `ruby.env`
34+
35+
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.
36+
37+
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.
38+
39+
Enjoy!

ja/news/_posts/2018-11-08-snap.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
layout: news_post
3+
title: The official ruby snap is available
4+
author: Hiroshi SHIBATA
5+
translator:
6+
date: 2018-11-08 14:58:28 +0000
7+
lang: ja
8+
---
9+
10+
Ruby の公式 snap パッケージをリリースしました。
11+
12+
https://snapcraft.io/ruby
13+
14+
snap は canonical が開発している新しいパッケージシステムです。独自のファイルシステムを利用して、バイナリの動作に必要なライブラリを全てパッケージングして配布することができます。snap を利用することで、 yum や apt のような Linux ディストリビューションのパッケージシステムを利用した時に、任意のバージョンをユーザーが自由に使うことができない問題を解決しました。
15+
16+
Ubuntu 16.04 以降のディストリビューションなら以下のコマンドで snap ruby を使うことができます。
17+
18+
sudo snap install ruby --classic
19+
20+
Ubuntu 以外のディストリビューションで snap を利用する場合の準備については https://docs.snapcraft.io/installing-snapd/6735 を参照してください。
21+
22+
Ruby の snap パッケージは channel と呼ばれる機能を用いて、現在メンテナンスしているバージョンを配信しています。例えば、2018/11 現在 channel を指定しない場合は 2.5.3 がインストールされますが、2.4 を利用したい場合は以下のように指定します。
23+
24+
sudo snap install ruby --classic --channel=2.4/stable
25+
26+
snap の機能を使うと複数の Ruby のバージョンを利用することができます。例えば、Ruby 2.3 に切り替えるには以下のコマンドを実行します。
27+
28+
sudo snap switch ruby --channel=2.3/stable
29+
sudo snap refresh
30+
31+
また、snap の制限事項として、RubyGems は `$HOME/.gem` にインストールされるように GEM_HOME と GEM_PATH を設定しています。そのため、rails や rspec などのコマンドを `bundle exec` を用いずに実行したい場合は以下の行を `.bashrc` などに設定する必要があります。
32+
33+
eval `ruby.env`
34+
35+
`$HOME/.gem` は複数のバージョンで共有されるため、バージョンを切り替えて利用した場合、C 拡張などは `gem pristin --extensions` コマンドを用いて再コンパイルする必要があります。
36+
37+
この ruby snap は 11/6-8 にロンドンの canonical オフィスで開催された snapcraft summit で初めて公式バージョンをリリースしました。不具合やフィードバックは https://github.com/ruby/snap.ruby で受け付けています。お楽しみください。

0 commit comments

Comments
 (0)