Ruby 2.2.0 のインストール
12 月 25 日に Ruby 2.2.0 がリリースされた。Rails 使いとしては、シンボルのガベージコレクタが入ったことがかなり大きそうだ。また、新しいインクリメンタル GC のおかげで速度低下も減りそうだとのこと。せっかくなので、早速システムで使用する Ruby を 2.2.0 にアップデートする(以下の記事は 12月27日現在のものを記録している)。
まずは、ruby-build を新しくするために、brew を更新する。
$ brew update $ brew upgrade
インストール可能なリストを表示してみる。
> rbenv install -l | grep 2.2.0 2.2.0-dev 2.2.0-preview1 2.2.0-preview2 2.2.0-rc1 2.2.0 rbx-2.2.0
ちゃんと 2.2.0 が入っているので、早速インストールする。
$ rbenv install 2.2.0
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...
Installed ruby-2.2.0 to /Users/hkob/.rbenv/versions/2.2.0
デフォルトで使う Ruby を 2.2.0 に設定する。
$ rbenv global 2.2.0
Ruby version を確認し、2.2.0 になっていことを確認。
> ruby -v ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
bundler gem だけをインストールしておく。
> gem install bundler Fetching: bundler-1.7.9.gem (100%) Successfully installed bundler-1.7.9 Parsing documentation for bundler-1.7.9 Installing ri documentation for bundler-1.7.9 Done installing documentation for bundler after 2 seconds 1 gem installed
Ruby のバージョンが上がったので、vendor/bundle も再構成しておく。ここまで差分ばかりを紹介していたので、現状の Gem 一覧を載せておく。これを見ると、ものすごい数の Gem に支えられていることがわかる。
$ rm -rf vendor/bundle $ bundle install --path vendor/bundle Fetching source index from https://rubygems.org/ Using rake 10.4.2 Installing i18n 0.7.0 Using json 1.8.1 Installing minitest 5.5.0 Installing thread_safe 0.3.4 Installing tzinfo 1.2.2 Installing activesupport 4.2.0 Installing builder 3.2.2 Installing erubis 2.7.0 Installing mini_portile 0.6.1 Installing nokogiri 1.6.5 Installing rails-deprecated_sanitizer 1.0.3 Installing rails-dom-testing 1.0.5 Installing loofah 2.0.1 Installing rails-html-sanitizer 1.0.1 Installing actionview 4.2.0 Installing rack 1.6.0 Installing rack-test 0.6.2 Installing actionpack 4.2.0 Installing globalid 0.3.0 Installing activejob 4.2.0 Installing mime-types 2.4.3 Installing mail 2.6.3 Installing actionmailer 4.2.0 Installing activemodel 4.2.0 Installing arel 6.0.0 Installing activerecord 4.2.0 Installing addressable 2.3.6 Installing bcrypt 3.1.9 Installing debug_inspector 0.0.2 Installing binding_of_caller 0.7.2 Installing xpath 2.0.0 Installing capybara 2.4.4 Installing hitimes 1.2.2 Installing timers 4.0.1 Installing celluloid 0.16.0 Installing ffi 1.9.6 Installing childprocess 0.5.5 Installing coderay 1.1.0 Installing coffee-script-source 1.8.0 Installing execjs 2.2.2 Installing coffee-script 2.3.0 Installing thor 0.19.1 Installing railties 4.2.0 Installing coffee-rails 4.0.1 Installing commonjs 0.2.7 Installing database_cleaner 1.3.0 Installing orm_adapter 0.5.0 Installing responders 2.0.2 Installing warden 1.2.3 Installing devise 3.4.1 Installing net-ldap 0.5.1 Installing devise_ldap_authenticatable 0.8.1 Installing diff-lcs 1.2.5 Installing docile 1.1.5 Installing factory_girl 4.5.0 Installing factory_girl_rails 4.5.0 Installing faker 1.4.3 Installing formatador 0.2.5 Installing multi_json 1.10.1 Installing gherkin 2.12.2 Installing rb-fsevent 0.9.4 Installing rb-inotify 0.9.5 Installing listen 2.8.4 Installing lumberjack 1.0.9 Installing nenv 0.1.1 Installing method_source 0.8.2 Installing slop 3.6.0 Installing pry 0.10.1 Installing guard 2.10.5 Installing guard-compat 1.2.0 Installing rspec-support 3.1.2 Installing rspec-core 3.1.7 Installing rspec-expectations 3.1.2 Installing rspec-mocks 3.1.3 Installing rspec 3.1.0 Installing guard-rspec 4.5.0 Installing tilt 1.4.1 Installing haml 4.1.0.beta.1 Installing hpricot 0.8.6 Installing sexp_processor 4.4.4 Installing ruby_parser 3.1.3 Installing html2haml 1.0.1 Installing haml-rails 0.6.0 Installing hike 1.2.3 Installing jbuilder 2.2.6 Installing jquery-rails 4.0.2 Installing launchy 2.4.3 Installing less 2.6.0 Installing less-rails 2.6.0 Installing libv8 3.16.14.7 Installing pg 0.17.1 Using bundler 1.7.9 Installing sprockets 2.12.3 Installing sprockets-rails 2.2.2 Installing rails 4.2.0 Using rdoc 4.2.0 Installing ref 1.0.5 Installing rspec-rails 3.1.0 Installing rubyzip 1.1.6 Installing sass 3.2.19 Installing sass-rails 4.0.5 Installing sdoc 0.4.1 Installing websocket 1.2.1 Installing selenium-webdriver 2.44.0 Installing simplecov-html 0.8.0 Installing simplecov 0.9.1 Installing spring 1.2.0 Installing spring-commands-rspec 1.0.4 Installing therubyracer 0.12.1 Installing turnip 1.2.4 Installing twitter-bootswatch-rails 3.2.0.0 Installing twitter-bootswatch-rails-helpers 3.2.0.0 Installing uglifier 2.6.0 Installing web-console 2.0.0 Installing yard 0.8.7.6 Your bundle is complete! It was installed into ./vendor/bundle Post-install message from haml: HEADS UP! Haml 4.0 has many improvements, but also has changes that may break your application: * Support for Ruby 1.8.6 dropped * Support for Rails 2 dropped * Sass filter now always outputs <style> tags * Data attributes are now hyphenated, not underscored * html2haml utility moved to the html2haml gem * Textile and Maruku filters moved to the haml-contrib gem For more info see: http://rubydoc.info/github/haml/haml/file/CHANGELOG.md Post-install message from twitter-bootswatch-rails: Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS. ********************************************** ExecJS supports these runtimes: therubyracer - Google V8 embedded within Ruby therubyrhino - Mozilla Rhino embedded within JRuby Node.js **********************************************
テストマシンでうまくいくことがわかったので、Mac 環境設定用の ansible ファイルの Ruby-version を 2.2.0 に変更しておく。これでその他の Mac もみな 2.2.0 に変わる。
また、Linux 側の ansible も 2.2.0 に変更し、playbook を動かしておく。バージョンを書き換えておくだけで、勝手にインストールから設定までやり直してくれるのは本当に楽だ。と思ったが、いきなりエラー。ruby-build のログを見ると、以下のメッセージがでていた。
./libffi-3.2.1/.libs/libffi.a: error adding symbols: Bad value
調べたら、Ruby2.2.0のインストールがlibffi.a: could not read symbols: Bad valueで失敗した件を発見。libffi-dev を入れろとのこと。ubuntu だと、libffi-dev という名前でよいらしい。
$ apt-cache search libffi-dev libffi-dev - Foreign Function Interface library (development files)
さっそく ansible の install_packages に追加して、playbook を再実行してみる。以下、ansible のコンソール表示の抜粋。
TASK: [install_packages | パッケージをインストール] *************** changed: [webcitc-3-d] => (item={'name': 'libffi-dev'}) TASK: [ruby_build | 現在インストールされているバージョン一覧を得る] *** ok: [webcitc-3-d] TASK: [ruby_build | rbenv install {{ install_version }}] ********************** changed: [webcitc-3-d] TASK: [ruby_build | デフォルトを確認] ********************************* ok: [webcitc-3-d] TASK: [ruby_build | デフォルトを設定] ********************************* changed: [webcitc-3-d] TASK: [ruby_build | bundler が入っているか確認] ********************** ok: [webcitc-3-d] TASK: [ruby_build | gem install bundler] ************************************** changed: [webcitc-3-d]
こちらも vendor/bundle の差し替えと、Jenkins のワークスペースの消去を忘れないようにする。
今日はここまで。