diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-26 17:05:45 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-06 10:56:48 +1000 |
commit | fdc17ebc039e53dd0ed8119c92fac5fd2f43c7fe (patch) | |
tree | c56ae354ede5b9ac3af5f6f0c6c8bfe31164dd5d | |
parent | 75dae7fe8083c3c7f28eb28c4becd741c9d0628a (diff) | |
download | gitlab-ce-fdc17ebc039e53dd0ed8119c92fac5fd2f43c7fe.tar.gz |
Add new danger_local Rake task
The benefit of running the danger_local Rake task
is that it displays some informational messages
for clarity and also exits with 1 if there's any
output.
-rw-r--r-- | lib/tasks/gitlab_danger.rake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tasks/gitlab_danger.rake b/lib/tasks/gitlab_danger.rake new file mode 100644 index 00000000000..c2f5843a9a5 --- /dev/null +++ b/lib/tasks/gitlab_danger.rake @@ -0,0 +1,17 @@ +desc 'Run local Danger rules' +task :danger_local do + require 'gitlab_danger' + require_relative '../../lib/gitlab/popen' + + puts("#{GitlabDanger.local_warning_message}\n") + + # _status will _always_ be 0, regardless of failure or success :( + output, _status = Gitlab::Popen.popen(%w{danger dry_run}) + + if output.empty? + puts(GitlabDanger.success_message) + else + puts(output) + exit(1) + end +end |