2019-09-06 07:21:53 -04:00
|
|
|
GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT = <<~MSG.freeze
|
|
|
|
%<gemfile>s was updated but %<gemfile_lock>s wasn't updated.
|
|
|
|
MSG
|
|
|
|
|
|
|
|
GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL = <<~MSG.freeze
|
|
|
|
**#{GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT}**
|
2018-07-10 06:10:54 -04:00
|
|
|
|
|
|
|
Usually, when %<gemfile>s is updated, you should run
|
|
|
|
```
|
2019-07-23 23:07:38 -04:00
|
|
|
bundle install
|
2018-07-10 06:10:54 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
```
|
|
|
|
bundle update <the-added-or-updated-gem>
|
|
|
|
```
|
|
|
|
|
|
|
|
and commit the %<gemfile_lock>s changes.
|
|
|
|
MSG
|
|
|
|
|
2018-05-21 12:41:21 -04:00
|
|
|
gemfile_modified = git.modified_files.include?("Gemfile")
|
|
|
|
gemfile_lock_modified = git.modified_files.include?("Gemfile.lock")
|
|
|
|
|
|
|
|
if gemfile_modified && !gemfile_lock_modified
|
2019-09-06 07:21:53 -04:00
|
|
|
gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
|
|
|
|
|
|
|
|
format_str = gitlab_danger.ci? ? GEMFILE_LOCK_NOT_UPDATED_MESSAGE_FULL : GEMFILE_LOCK_NOT_UPDATED_MESSAGE_SHORT
|
|
|
|
|
|
|
|
message = format(format_str,
|
|
|
|
gemfile: gitlab_danger.html_link("Gemfile"),
|
|
|
|
gemfile_lock: gitlab_danger.html_link("Gemfile.lock")
|
|
|
|
)
|
|
|
|
|
|
|
|
warn(message)
|
2018-05-21 12:41:21 -04:00
|
|
|
end
|