LoginSignup
1
2

More than 5 years have passed since last update.

プロダクトの1周年を記念してrubyとRails最新版に追っついた。

Last updated at Posted at 2017-03-11

うちのかわいいプロダクトが3月3日で1周年なことを記念してrubyとRailsを最新版にしてあげる。

Geno -遺伝子の?を!に変える-

バージョン

現状 こうしたい
ruby 2.2.0 2.3.0
Rails 4.2.0 4.2.5.1

ruby-buildを最新にする

brew update -v
brew upgrade rbenv ruby-build

クソ時間かかることがある

サーバにはbrew入ってないのでこっち

$ cd ~/.rbenv/
$ git pull origin master
$ cd plugins/ruby-build/
$ git pull origin master

ruby最新版インストール

$ rbenv install -l
$ rbenv install 2.3.0

以下をプロジェクトのルートディレクトリで行う

Gemfile
gem 'rails', '4.2.5.1'

色々あるのでGemfile.lockを削除して以下を実行

cd /var/www/geno/current
rbenv local 2.3.0
gem update bundler
gem install bundler
bundle install

ここから先はうちのかわいいプロダクトで起こった直し

AirBrake問題

AirBrake 0.5系で上手く動かないのでいったん0.4.1に戻しとく。

'default'のnotifer先がないとかそんなことを言われるんだが、Errbit叩かせない対策じゃないかと邪推している。

そのうちなおす。そもそもErrbitの新しい方向いてない。

RSpecまわり

shoulda-matchersの設定をrails_helperに書いておく必要がある

spec/rails_helper.rb
Shoulda::Matchers.configure do |config|
  config.integrate do |with|
    with.test_framework :rspec
    with.library :rails
  end
end

rubocop殿ー

とりあえずauto correct

bundle exec rubocop -a

ただし

Gift.total(date).select(&:used?).count

Gift.total(date).count(&:used?)

にしてくれちゃったりするので注意が必要。

Style/TrailingCommaは使われてないみたいなので怒られる

Error: The `Style/TrailingComma` cop no longer exists. Please use `Style/TrailingCommaInLiteral` and/or `Style/TrailingCommaInArguments` instead.
(configuration found in /Users/takeru_miyahara/works/develop/geno/.rubocop.yml)

Style/TrailingComma長いこと使われてないとか言っているけど、変更されたのは割と最近っぽい。

.rubocop.ymlを変えてあげる

.rubocop.yml
Style/TrailingCommaInLiteral:
   EnforcedStyleForMultiline: comma

ステージングサーバ

$ rbenv update
$ sudo cd "$(rbenv root)"/ && git pull
# rbenv install 2.3.0
# cd /var/www/geno/current
# gem install bundler

capでデプロイすると [DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead とかほざくのなんとかしたい。マジで。

require: 'RMagick'があると関係するライブラリが更新されないっぽい。

Gemfile.lock
gem 'rmagick', require: 'RMagick'
Gemfile.lock
gem 'rmagick'
1
2
1

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
1
2