summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab_danger.rake
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-09-06 11:21:53 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-09-06 11:21:53 +0000
commit9fc9ab2ba2b0db05f6365054aa3bddcda3c7333d (patch)
treed59a451e3300c4598f2aa66d4b6e82b0b3fa56ef /lib/tasks/gitlab_danger.rake
parent3441092b3840cecb913068542ee9242ea19a2017 (diff)
downloadgitlab-ce-9fc9ab2ba2b0db05f6365054aa3bddcda3c7333d.tar.gz
Add new GitlabDanger class
This class encapsulates our use of the Danger gem.
Diffstat (limited to 'lib/tasks/gitlab_danger.rake')
-rw-r--r--lib/tasks/gitlab_danger.rake17
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..e75539f048c
--- /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 '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