LoginSignup
1
0

More than 5 years have passed since last update.

bundle outdated で開発用の gem だけをチェックする

Last updated at Posted at 2019-02-08

Bundlerには標準で bundle outdatedという古くなっているgemを一覧表示するコマンドがありますが、実プロジェクトでは自動テストが未整備だったりテスト工数が取れなかったりして、gemを更新できないことも多いです。

とはいえ、rspecなどの開発ツールについてはアップデートしてもproductionに影響しない1ので、うちではこんな風にdevelopment と test のライブラリのみ古くなっていないかチェックしています。

# .gitlab-ci.yml

# gem が古くなっていないかチェックする
# development, test のみをエラーにする
bundle-outdated:
  variables:
    GREP_PATTERN: 'in groups ".*\(development\|test\).*"'
  script:
  - 'set +o pipefail'
  - 'bundle outdated | grep "$GREP_PATTERN" | tee bundle-outdated-dev.txt'
  - '[ ! -s bundle-outdated-dev.txt ]'
  only:
    - master # master ブランチでのみチェック。開発ブランチでチェックするのは冗長だし、どのみち修正は別のブランチで行うため。

  1. 厳密にはproductionへ影響することもあります。bundle updateではrspecが依存するライブラリも自動でアップデートされますが、同じライブラリを本番でも使っていることもあるからです。ただ、実際にそれで不具合が起きた経験はありません。 

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