LoginSignup
7
7

More than 5 years have passed since last update.

PryでNyan Cat

Posted at

Pryは言わずとしれたRubyのREPL環境である。
NyanCatが何なのかはよく分かっていないが、分からなくてもいいかなって思っているので、気になる人はググってみて欲しい。

Macでpry中にNyanCatを流す術を書き記す。
あまりやる意味は無い。

mpg123 をインストール

MP3を再生するので、あらかじめmpg123をインストールしておく。
このためだけに。

brew install mpg123

Pry をインストール

gem install pry

nyan-catコマンドをインストール

pry中に nyan-cat コマンドを実行するには install-command nyan-cat しろと言われる。
別に gem install nyancat してもいい。それだけのこと。

$ pry
[1] pry(main)> nyan-cat

The command 'nyan-cat' is unavailable because it requires the following gems to be installed: nyancat
-
Type `install-command nyan-cat` to install the required gems and activate this command.
[2] pry(main)> install-command nyan-cat
Attempting to install `nyan-cat` command...
Installing `nyancat` gem...
Fetching: nyancat-0.2.0.gem (100%)
Installation of `nyan-cat` successful! Type `help nyan-cat` for information

nyan-catコマンドを実行する

無事インストールが終わると nyan-cat コマンドが使えるようになっているはず。
あとはボリュームを最大にしてコマンドを打つのみ。

[3] pry(main)> nyan-cat

おまけ

gemをインストールしただけなので、当然Pry上でなくても nyancat コマンドが使えるようになっている。
-l オプションを付けることで、Nyanサーバ(telnet)が起動しリモートからもニャンニャンできるようになるのだ!

$ sudo nyancat -l
Password:
[Tue Jul  1 16:27:52 2014] NyanCat::NyanServer :::23 start
$ telnet localhost 23

また、Pryには他にもしょうもないイースターエッグがある。
詳細はこちら↓。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7