summaryrefslogtreecommitdiff
path: root/danger/gemfile
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-07-10 12:10:54 +0200
committerRémy Coutable <remy@rymai.me>2018-07-11 11:52:03 +0200
commitab87e7bab1d5cc20c7b69644843bfcb1f3f16918 (patch)
tree2f908718378fbe6984d65781ea76c623ace57eb6 /danger/gemfile
parentdc629bb6b8146477fdbf9fcd11d10ebedc785029 (diff)
downloadgitlab-ce-ab87e7bab1d5cc20c7b69644843bfcb1f3f16918.tar.gz
Improve Danger files after first review
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'danger/gemfile')
-rw-r--r--danger/gemfile/Dangerfile27
1 files changed, 19 insertions, 8 deletions
diff --git a/danger/gemfile/Dangerfile b/danger/gemfile/Dangerfile
index 3d38959a9d0..b9f59d95815 100644
--- a/danger/gemfile/Dangerfile
+++ b/danger/gemfile/Dangerfile
@@ -1,15 +1,26 @@
# rubocop:disable Style/SignalException
+GEMFILE_LOCK_NOT_UPDATED_MESSAGE = <<~MSG
+**%<gemfile>s was updated but %<gemfile_lock>s wasn't updated.**
+
+Usually, when %<gemfile>s is updated, you should run
+```
+bundle install && \
+ BUNDLE_GEMFILE=Gemfile.rails5 bundle install
+```
+
+or
+
+```
+bundle update <the-added-or-updated-gem>
+```
+
+and commit the %<gemfile_lock>s changes.
+MSG
+
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(" ")
+ warn format(GEMFILE_LOCK_NOT_UPDATED_MESSAGE, gemfile: gitlab.html_link("Gemfile"), gemfile_lock: gitlab.html_link("Gemfile.lock"))
end