summaryrefslogtreecommitdiff
path: root/danger/gemfile/Dangerfile
blob: 3d38959a9d06d8365c73dd8600ff58ae8ee360fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# rubocop:disable Style/SignalException

gemfile_modified = git.modified_files.include?("Gemfile")
gemfile_lock_modified = git.modified_files.include?("Gemfile.lock")

if gemfile_modified && !gemfile_lock_modified
  msg = [
    "#{gitlab.html_link("Gemfile")} was edited but #{gitlab.html_link("Gemfile.lock")} wasn't.",
    "Usually, when #{gitlab.html_link("Gemfile")} is updated, you should run",
    "`bundle install && BUNDLE_GEMFILE=Gemfile.rails5 bundle install` or",
    "`bundle update <the-added-or-updated-gem>` and commit the #{gitlab.html_link("Gemfile.lock")} changes."
  ]

  warn msg.join(" ")
end