danger 9.5.2 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/danger +2 -0
- data/lib/danger/ci_source/appcenter.rb +2 -0
- data/lib/danger/ci_source/appcircle.rb +2 -0
- data/lib/danger/ci_source/appveyor.rb +2 -0
- data/lib/danger/ci_source/azure_pipelines.rb +2 -0
- data/lib/danger/ci_source/bamboo.rb +2 -0
- data/lib/danger/ci_source/bitbucket_pipelines.rb +2 -0
- data/lib/danger/ci_source/bitrise.rb +2 -1
- data/lib/danger/ci_source/buddybuild.rb +2 -0
- data/lib/danger/ci_source/buildkite.rb +2 -0
- data/lib/danger/ci_source/ci_source.rb +2 -0
- data/lib/danger/ci_source/circle.rb +3 -1
- data/lib/danger/ci_source/circle_api.rb +5 -3
- data/lib/danger/ci_source/cirrus.rb +2 -0
- data/lib/danger/ci_source/code_build.rb +2 -0
- data/lib/danger/ci_source/codefresh.rb +3 -1
- data/lib/danger/ci_source/codemagic.rb +2 -0
- data/lib/danger/ci_source/codeship.rb +2 -0
- data/lib/danger/ci_source/concourse.rb +2 -0
- data/lib/danger/ci_source/dotci.rb +2 -0
- data/lib/danger/ci_source/drone.rb +2 -0
- data/lib/danger/ci_source/github_actions.rb +2 -0
- data/lib/danger/ci_source/gitlab_ci.rb +2 -0
- data/lib/danger/ci_source/jenkins.rb +2 -0
- data/lib/danger/ci_source/local_git_repo.rb +1 -1
- data/lib/danger/ci_source/screwdriver.rb +2 -0
- data/lib/danger/ci_source/semaphore.rb +2 -0
- data/lib/danger/ci_source/support/commits.rb +3 -1
- data/lib/danger/ci_source/support/find_repo_info_from_logs.rb +3 -1
- data/lib/danger/ci_source/support/find_repo_info_from_url.rb +2 -0
- data/lib/danger/ci_source/support/local_pull_request.rb +3 -1
- data/lib/danger/ci_source/support/no_pull_request.rb +2 -0
- data/lib/danger/ci_source/support/no_repo_info.rb +2 -0
- data/lib/danger/ci_source/support/pull_request_finder.rb +6 -7
- data/lib/danger/ci_source/support/remote_pull_request.rb +2 -0
- data/lib/danger/ci_source/support/repo_info.rb +2 -0
- data/lib/danger/ci_source/surf.rb +2 -0
- data/lib/danger/ci_source/teamcity.rb +14 -1
- data/lib/danger/ci_source/travis.rb +2 -0
- data/lib/danger/ci_source/xcode_cloud.rb +2 -0
- data/lib/danger/ci_source/xcode_server.rb +2 -0
- data/lib/danger/clients/rubygems_client.rb +4 -2
- data/lib/danger/commands/dangerfile/gem.rb +3 -1
- data/lib/danger/commands/dangerfile/init.rb +3 -1
- data/lib/danger/commands/dry_run.rb +2 -0
- data/lib/danger/commands/init.rb +22 -20
- data/lib/danger/commands/init_helpers/interviewer.rb +6 -4
- data/lib/danger/commands/local.rb +2 -0
- data/lib/danger/commands/local_helpers/http_cache.rb +2 -0
- data/lib/danger/commands/local_helpers/local_setup.rb +4 -5
- data/lib/danger/commands/local_helpers/pry_setup.rb +3 -1
- data/lib/danger/commands/mr.rb +3 -1
- data/lib/danger/commands/plugins/plugin_json.rb +2 -0
- data/lib/danger/commands/plugins/plugin_lint.rb +2 -0
- data/lib/danger/commands/plugins/plugin_readme.rb +2 -0
- data/lib/danger/commands/pr.rb +4 -2
- data/lib/danger/commands/runner.rb +2 -0
- data/lib/danger/commands/staging.rb +2 -0
- data/lib/danger/commands/systems.rb +3 -1
- data/lib/danger/core_ext/file_list.rb +2 -0
- data/lib/danger/core_ext/string.rb +6 -4
- data/lib/danger/danger_core/dangerfile.rb +7 -4
- data/lib/danger/danger_core/dangerfile_dsl.rb +2 -0
- data/lib/danger/danger_core/dangerfile_generator.rb +2 -0
- data/lib/danger/danger_core/environment_manager.rb +13 -10
- data/lib/danger/danger_core/executor.rb +3 -1
- data/lib/danger/danger_core/messages/base.rb +7 -2
- data/lib/danger/danger_core/messages/markdown.rb +36 -6
- data/lib/danger/danger_core/plugins/dangerfile_bitbucket_cloud_plugin.rb +2 -0
- data/lib/danger/danger_core/plugins/dangerfile_bitbucket_server_plugin.rb +4 -2
- data/lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb +2 -0
- data/lib/danger/danger_core/plugins/dangerfile_git_plugin.rb +2 -0
- data/lib/danger/danger_core/plugins/dangerfile_github_plugin.rb +3 -1
- data/lib/danger/danger_core/plugins/dangerfile_gitlab_plugin.rb +3 -1
- data/lib/danger/danger_core/plugins/dangerfile_local_only_plugin.rb +2 -0
- data/lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb +19 -1
- data/lib/danger/danger_core/plugins/dangerfile_vsts_plugin.rb +4 -2
- data/lib/danger/danger_core/standard_error.rb +5 -3
- data/lib/danger/helpers/array_subclass.rb +2 -0
- data/lib/danger/helpers/comment.rb +2 -0
- data/lib/danger/helpers/comments_helper.rb +2 -0
- data/lib/danger/helpers/comments_parsing_helper.rb +6 -3
- data/lib/danger/helpers/emoji_mapper.rb +5 -3
- data/lib/danger/helpers/find_max_num_violations.rb +2 -0
- data/lib/danger/helpers/message_groups_array_helper.rb +2 -0
- data/lib/danger/plugin_support/gems_resolver.rb +2 -0
- data/lib/danger/plugin_support/plugin.rb +2 -0
- data/lib/danger/plugin_support/plugin_file_resolver.rb +3 -1
- data/lib/danger/plugin_support/plugin_linter.rb +8 -6
- data/lib/danger/request_sources/bitbucket_cloud.rb +2 -0
- data/lib/danger/request_sources/bitbucket_cloud_api.rb +2 -2
- data/lib/danger/request_sources/bitbucket_server.rb +3 -1
- data/lib/danger/request_sources/bitbucket_server_api.rb +2 -2
- data/lib/danger/request_sources/code_insights_api.rb +2 -2
- data/lib/danger/request_sources/github/github.rb +71 -11
- data/lib/danger/request_sources/github/github_review.rb +9 -7
- data/lib/danger/request_sources/github/github_review_resolver.rb +2 -0
- data/lib/danger/request_sources/github/github_review_unsupported.rb +2 -0
- data/lib/danger/request_sources/gitlab.rb +17 -18
- data/lib/danger/request_sources/local_only.rb +2 -0
- data/lib/danger/request_sources/request_source.rb +3 -3
- data/lib/danger/request_sources/support/get_ignored_violation.rb +2 -0
- data/lib/danger/request_sources/vsts.rb +2 -1
- data/lib/danger/request_sources/vsts_api.rb +2 -2
- data/lib/danger/scm_source/git_repo.rb +2 -0
- data/lib/danger/version.rb +4 -2
- data/lib/danger.rb +4 -2
- metadata +3 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c20de89d82a1a32f926300a84b0a1313a7d3c1d5c35c91b4eed2667eec5788c
|
|
4
|
+
data.tar.gz: 208508f00a6542efe5c5f7357a87f943e50384b7c999771e669c9c585df4e3a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc94ca5d7d28214e3cf4166dce28369a1a22e7173eee2d5c1c0a34a826c32c97c7d58e37ba66a9e87a2ea3540ffe6674ea64be705e0ca920166df856b7bcd116
|
|
7
|
+
data.tar.gz: 3929c665775cf4af212c36a9ea898b9850dc3358d79597707fdd4b166d4b605777d85c793b54eeb72ac8e3207be217b17be602a3d395c2a749962d076bc5aaf1
|
data/bin/danger
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# http://devcenter.bitrise.io/docs/available-environment-variables
|
|
2
4
|
require "danger/request_sources/github/github"
|
|
3
5
|
require "danger/request_sources/gitlab"
|
|
@@ -49,7 +51,6 @@ module Danger
|
|
|
49
51
|
self.pull_request_id = env["BITRISE_PULL_REQUEST"]
|
|
50
52
|
self.repo_url = env["GIT_REPOSITORY_URL"]
|
|
51
53
|
|
|
52
|
-
matcher_url = self.repo_url
|
|
53
54
|
self.repo_slug = repo_slug_from(self.repo_url)
|
|
54
55
|
end
|
|
55
56
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# https://circleci.com/docs/environment-variables
|
|
2
4
|
require "uri"
|
|
3
5
|
require "danger/ci_source/circle_api"
|
|
@@ -78,7 +80,7 @@ module Danger
|
|
|
78
80
|
pr_path = URI.parse(pr_url).path.split("/")
|
|
79
81
|
if pr_path.count == 5
|
|
80
82
|
# The first one is an extra slash, ignore it
|
|
81
|
-
self.repo_slug = pr_path[1]
|
|
83
|
+
self.repo_slug = "#{pr_path[1]}/#{pr_path[2]}"
|
|
82
84
|
self.pull_request_id = pr_path[4]
|
|
83
85
|
|
|
84
86
|
else
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "faraday"
|
|
2
4
|
|
|
3
5
|
module Danger
|
|
@@ -15,10 +17,10 @@ module Danger
|
|
|
15
17
|
url = env["CI_PULL_REQUEST"]
|
|
16
18
|
|
|
17
19
|
if url.nil? && !env["CIRCLE_PROJECT_USERNAME"].nil? && !env["CIRCLE_PROJECT_REPONAME"].nil?
|
|
18
|
-
repo_slug = env[
|
|
20
|
+
repo_slug = "#{env['CIRCLE_PROJECT_USERNAME']}/#{env['CIRCLE_PROJECT_REPONAME']}"
|
|
19
21
|
if !env["CIRCLE_PR_NUMBER"].nil?
|
|
20
22
|
host = env["DANGER_GITHUB_HOST"] || "github.com"
|
|
21
|
-
url = "https
|
|
23
|
+
url = "https://#{host}/#{repo_slug}/pull/#{env['CIRCLE_PR_NUMBER']}"
|
|
22
24
|
else
|
|
23
25
|
token = env["DANGER_CIRCLE_CI_API_TOKEN"]
|
|
24
26
|
url = fetch_pull_request_url(repo_slug, env["CIRCLE_BUILD_NUM"], token)
|
|
@@ -35,7 +37,7 @@ module Danger
|
|
|
35
37
|
def fetch_pull_request_url(repo_slug, build_number, token)
|
|
36
38
|
build_json = fetch_build(repo_slug, build_number, token)
|
|
37
39
|
pull_requests = build_json[:pull_requests]
|
|
38
|
-
return nil unless pull_requests
|
|
40
|
+
return nil unless pull_requests&.first
|
|
39
41
|
|
|
40
42
|
pull_requests.first[:url]
|
|
41
43
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# https://semaphoreci.com/docs/available-environment-variables.html
|
|
2
4
|
require "danger/request_sources/github/github"
|
|
3
5
|
|
|
@@ -35,7 +37,7 @@ module Danger
|
|
|
35
37
|
return "" if env["CF_REPO_OWNER"].to_s.empty?
|
|
36
38
|
return "" if env["CF_REPO_NAME"].to_s.empty?
|
|
37
39
|
|
|
38
|
-
"#{env['CF_REPO_OWNER']}/#{env['CF_REPO_NAME']}".downcase
|
|
40
|
+
"#{env['CF_REPO_OWNER']}/#{env['CF_REPO_NAME']}".downcase
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def initialize(env)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
|
|
2
4
|
# https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
|
|
3
5
|
require "danger/request_sources/github/github"
|
|
@@ -96,7 +96,7 @@ module Danger
|
|
|
96
96
|
).call(env: env)
|
|
97
97
|
else
|
|
98
98
|
PullRequestFinder.new(
|
|
99
|
-
env.fetch("LOCAL_GIT_PR_ID") { env.fetch("LOCAL_GIT_MR_ID"
|
|
99
|
+
env.fetch("LOCAL_GIT_PR_ID") { env.fetch("LOCAL_GIT_MR_ID", "") },
|
|
100
100
|
remote_info.slug,
|
|
101
101
|
remote: false,
|
|
102
102
|
git_logs: run_git("log --oneline -1000000")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "danger/ci_source/support/repo_info"
|
|
2
4
|
|
|
3
5
|
module Danger
|
|
@@ -20,7 +22,7 @@ module Danger
|
|
|
20
22
|
attr_reader :remote_logs, :github_host
|
|
21
23
|
|
|
22
24
|
def remote
|
|
23
|
-
remote_logs.lines.grep(/Fetch URL/)[0].split(": "
|
|
25
|
+
remote_logs.lines.grep(/Fetch URL/)[0].split(": ", 2)[1]
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def regexp
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Danger
|
|
2
4
|
class LocalPullRequest
|
|
3
5
|
attr_reader :pull_request_id, :sha
|
|
4
6
|
|
|
5
7
|
def initialize(log_line)
|
|
6
8
|
@pull_request_id = log_line.match(/#(?<id>[0-9]+)/)[:id]
|
|
7
|
-
@sha = log_line.split(" "
|
|
9
|
+
@sha = log_line.split(" ").first
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
def valid?
|
|
@@ -207,20 +207,19 @@ module Danger
|
|
|
207
207
|
|
|
208
208
|
def api_url
|
|
209
209
|
ENV.fetch("DANGER_GITHUB_API_HOST") do
|
|
210
|
-
ENV.fetch("DANGER_GITHUB_API_BASE_URL")
|
|
211
|
-
"https://api.github.com/"
|
|
212
|
-
end
|
|
210
|
+
ENV.fetch("DANGER_GITHUB_API_BASE_URL", "https://api.github.com/")
|
|
213
211
|
end
|
|
214
212
|
end
|
|
215
213
|
|
|
216
214
|
def find_scm_provider(remote_url)
|
|
217
|
-
|
|
215
|
+
case remote_url
|
|
216
|
+
when %r{/bitbucket.org/}
|
|
218
217
|
:bitbucket_cloud
|
|
219
|
-
|
|
218
|
+
when %r{/pull-requests/}
|
|
220
219
|
:bitbucket_server
|
|
221
|
-
|
|
220
|
+
when /\.visualstudio\.com/i, /dev\.azure\.com/i
|
|
222
221
|
:vsts
|
|
223
|
-
|
|
222
|
+
when /gitlab\.com/, %r{-/merge_requests/}
|
|
224
223
|
:gitlab
|
|
225
224
|
else
|
|
226
225
|
:github
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# https://www.jetbrains.com/teamcity/
|
|
2
4
|
require "danger/request_sources/github/github"
|
|
3
5
|
require "danger/request_sources/gitlab"
|
|
@@ -65,6 +67,14 @@ module Danger
|
|
|
65
67
|
# export BITBUCKET_BRANCH_NAME="%teamcity.build.branch%"
|
|
66
68
|
# ```
|
|
67
69
|
#
|
|
70
|
+
# Optionally, you can set `BITBUCKET_PULL_REQUEST_ID` to skip the API call that resolves
|
|
71
|
+
# the pull request ID from the branch name. If you are using the TeamCity
|
|
72
|
+
# [Pull Requests](https://www.jetbrains.com/help/teamcity/pull-requests.html) build feature:
|
|
73
|
+
#
|
|
74
|
+
# ```sh
|
|
75
|
+
# export BITBUCKET_PULL_REQUEST_ID="%teamcity.pullRequest.number%"
|
|
76
|
+
# ```
|
|
77
|
+
#
|
|
68
78
|
# #### BitBucket Server
|
|
69
79
|
#
|
|
70
80
|
# You will need to add the following environment variables as build parameters or by exporting them inside your
|
|
@@ -149,8 +159,11 @@ module Danger
|
|
|
149
159
|
self.repo_url = env["BITBUCKETSERVER_REPO_URL"]
|
|
150
160
|
end
|
|
151
161
|
|
|
152
|
-
#
|
|
162
|
+
# Uses BITBUCKET_PULL_REQUEST_ID from the environment if available,
|
|
163
|
+
# otherwise falls back to fetching the PR id from the Bitbucket API.
|
|
153
164
|
def bitbucket_pr_from_env(env)
|
|
165
|
+
return env["BITBUCKET_PULL_REQUEST_ID"].to_i if env["BITBUCKET_PULL_REQUEST_ID"]
|
|
166
|
+
|
|
154
167
|
branch_name = env["BITBUCKET_BRANCH_NAME"]
|
|
155
168
|
repo_slug = env["BITBUCKET_REPO_SLUG"]
|
|
156
169
|
begin
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Danger
|
|
2
4
|
class RubyGemsClient
|
|
3
|
-
API_URL = "https://rubygems.org/api/v1/versions/danger/latest.json"
|
|
4
|
-
DUMMY_VERSION = "0.0.0"
|
|
5
|
+
API_URL = "https://rubygems.org/api/v1/versions/danger/latest.json"
|
|
6
|
+
DUMMY_VERSION = "0.0.0"
|
|
5
7
|
|
|
6
8
|
def self.latest_danger_version
|
|
7
9
|
require "json"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "claide_plugin"
|
|
2
4
|
require "danger/commands/dangerfile/init"
|
|
3
5
|
|
|
@@ -17,7 +19,7 @@ module Danger
|
|
|
17
19
|
|
|
18
20
|
def initialize(argv)
|
|
19
21
|
@name = argv.shift_argument
|
|
20
|
-
prefix = "dangerfile
|
|
22
|
+
prefix = "dangerfile-"
|
|
21
23
|
unless @name.nil? || @name.empty? || @name.start_with?(prefix)
|
|
22
24
|
@name = prefix + @name.dup
|
|
23
25
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "danger/danger_core/dangerfile_generator"
|
|
2
4
|
|
|
3
5
|
# Mainly so we can have a nice structure for commands
|
|
@@ -24,7 +26,7 @@ module Danger
|
|
|
24
26
|
def run
|
|
25
27
|
content = DangerfileGenerator.create_dangerfile(".", cork)
|
|
26
28
|
File.write("Dangerfile", content)
|
|
27
|
-
cork.puts "Created
|
|
29
|
+
cork.puts "Created#{'./Dangerfile'.green}"
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
data/lib/danger/commands/init.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "danger/commands/init_helpers/interviewer"
|
|
2
4
|
require "danger/danger_core/dangerfile_generator"
|
|
3
5
|
require "danger/ci_source/local_git_repo"
|
|
@@ -18,7 +20,7 @@ module Danger
|
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def initialize(argv)
|
|
21
|
-
@bot_name = File.basename(Dir.getwd).split(
|
|
23
|
+
@bot_name = "#{File.basename(Dir.getwd).split('.').first.capitalize}Bot"
|
|
22
24
|
super
|
|
23
25
|
@ui = Interviewer.new(cork)
|
|
24
26
|
ui.no_delay = argv.flag?("impatient", false)
|
|
@@ -63,7 +65,7 @@ module Danger
|
|
|
63
65
|
|
|
64
66
|
ui.say "cat #{Dir.pwd}/Dangerfile\n".blue
|
|
65
67
|
content.lines.each do |l|
|
|
66
|
-
ui.say "
|
|
68
|
+
ui.say " #{l.chomp.green}"
|
|
67
69
|
end
|
|
68
70
|
ui.say ""
|
|
69
71
|
ui.pause 2
|
|
@@ -118,7 +120,7 @@ module Danger
|
|
|
118
120
|
|
|
119
121
|
if considered_an_oss_repo?
|
|
120
122
|
ui.say "For Open Source projects, I'd recommend giving the token the smallest scope possible."
|
|
121
|
-
ui.say "This means only providing access to
|
|
123
|
+
ui.say "This means only providing access to #{'public_repo'.yellow} in the token.\n\n"
|
|
122
124
|
ui.pause 1
|
|
123
125
|
ui.say "This token limits Danger's abilities to just writing comments on OSS projects. I recommend"
|
|
124
126
|
ui.say "this because the token can quite easily be extracted from the environment via pull requests."
|
|
@@ -126,10 +128,10 @@ module Danger
|
|
|
126
128
|
ui.say "\nIt is important that you do not store this token in your repository, as GitHub will automatically revoke it when pushed.\n"
|
|
127
129
|
elsif @is_open_source == "closed"
|
|
128
130
|
ui.say "For Closed Source projects, I'd recommend giving the token access to the whole repo scope."
|
|
129
|
-
ui.say "This means only providing access to
|
|
131
|
+
ui.say "This means only providing access to #{'repo'.yellow}, and its children in the token.\n\n"
|
|
130
132
|
ui.pause 1
|
|
131
|
-
ui.say "It's worth noting that you
|
|
132
|
-
ui.say "Make a new one for those repos with just
|
|
133
|
+
ui.say "It's worth noting that you #{'should not'.bold.white} re-use this token for OSS repos."
|
|
134
|
+
ui.say "Make a new one for those repos with just #{'public_repo'.yellow}."
|
|
133
135
|
ui.pause 1
|
|
134
136
|
ui.say "Additionally, don't forget to add your new GitHub account as a collaborator to your Closed Source project."
|
|
135
137
|
end
|
|
@@ -184,13 +186,13 @@ module Danger
|
|
|
184
186
|
danger = "bundle exec danger".yellow
|
|
185
187
|
config = YAML.load(File.read(".travis.yml"))
|
|
186
188
|
if config.kind_of?(Hash) && config["script"]
|
|
187
|
-
ui.say "Add
|
|
189
|
+
ui.say "Add #{'- '.yellow}#{danger} as a new step in the #{'script'.yellow} section of your .travis.yml file."
|
|
188
190
|
else
|
|
189
|
-
ui.say "I'd recommend adding
|
|
191
|
+
ui.say "I'd recommend adding #{'before_script: '.yellow}#{danger} to the script section of your .travis.yml file."
|
|
190
192
|
end
|
|
191
193
|
|
|
192
194
|
ui.pause 1
|
|
193
|
-
ui.say "You shouldn't use
|
|
195
|
+
ui.say "You shouldn't use #{'after_success, after_failure, after_script'.red} as they cannot fail your builds."
|
|
194
196
|
end
|
|
195
197
|
|
|
196
198
|
def uses_circle
|
|
@@ -199,9 +201,9 @@ module Danger
|
|
|
199
201
|
|
|
200
202
|
if config.kind_of?(Hash) && config["test"]
|
|
201
203
|
if config["test"]["post"]
|
|
202
|
-
ui.say "Add
|
|
204
|
+
ui.say "Add #{danger} as a new step in the #{'test:post:'.yellow} section of your circle.yml file."
|
|
203
205
|
else
|
|
204
|
-
ui.say "Add
|
|
206
|
+
ui.say "Add #{danger} as a new step in the #{'test:override:'.yellow} section of your circle.yml file."
|
|
205
207
|
end
|
|
206
208
|
else
|
|
207
209
|
ui.say "Add this to the bottom of your circle.yml file:"
|
|
@@ -214,7 +216,7 @@ module Danger
|
|
|
214
216
|
def unsure_ci
|
|
215
217
|
danger = "bundle exec danger".yellow
|
|
216
218
|
ui.say "As I'm not sure what CI you want to run Danger on based on the files in your repo, I'll just offer some generic"
|
|
217
|
-
ui.say "advice. You want to run
|
|
219
|
+
ui.say "advice. You want to run #{danger} after your tests have finished running, it should still be during the testing"
|
|
218
220
|
ui.say "process so the build can fail."
|
|
219
221
|
end
|
|
220
222
|
|
|
@@ -222,7 +224,7 @@ module Danger
|
|
|
222
224
|
# https://travis-ci.org/artsy/eigen/settings
|
|
223
225
|
ui.say "In order to add an environment variable, go to:"
|
|
224
226
|
ui.link "https://travis-ci.org/#{current_repo_slug}/settings"
|
|
225
|
-
ui.say "\nThe name is
|
|
227
|
+
ui.say "\nThe name is #{'DANGER_GITHUB_API_TOKEN'.yellow} and the value is the GitHub Personal Access Token."
|
|
226
228
|
if @is_open_source
|
|
227
229
|
ui.say 'Make sure to have "Display value in build log" enabled.'
|
|
228
230
|
end
|
|
@@ -239,7 +241,7 @@ module Danger
|
|
|
239
241
|
ui.say "I'll give you a minute to read it..."
|
|
240
242
|
ui.wait_for_return
|
|
241
243
|
|
|
242
|
-
ui.say "On danger/danger we turn on
|
|
244
|
+
ui.say "On danger/danger we turn on #{'Permissive building of fork pull requests'.yellow} this exposes the token to Danger"
|
|
243
245
|
ui.say "You can find this setting at:"
|
|
244
246
|
ui.link "https://circleci.com/gh/#{current_repo_slug}/edit#advanced-settings\n"
|
|
245
247
|
ui.say "I'll hold..."
|
|
@@ -248,12 +250,12 @@ module Danger
|
|
|
248
250
|
|
|
249
251
|
ui.say "In order to expose an environment variable, go to:"
|
|
250
252
|
ui.link "https://circleci.com/gh/#{current_repo_slug}/edit#env-vars"
|
|
251
|
-
ui.say "The name is
|
|
253
|
+
ui.say "The name is #{'DANGER_GITHUB_API_TOKEN'.yellow} and the value is the GitHub Personal Access Token."
|
|
252
254
|
end
|
|
253
255
|
|
|
254
256
|
def unsure_token
|
|
255
|
-
ui.say "You need to expose a token called
|
|
256
|
-
ui.say "Depending on the CI system, this may need to be done on the machine (in the
|
|
257
|
+
ui.say "You need to expose a token called #{'DANGER_GITHUB_API_TOKEN'.yellow} and the value is the GitHub Personal Access Token."
|
|
258
|
+
ui.say "Depending on the CI system, this may need to be done on the machine (in the #{'~/.bashprofile'.yellow}) or in a web UI somewhere."
|
|
257
259
|
ui.say "We have a guide for all supported CI systems on danger.systems:"
|
|
258
260
|
ui.link "https://danger.systems/guides/getting_started.html#setting-up-danger-to-run-on-your-ci"
|
|
259
261
|
end
|
|
@@ -270,9 +272,9 @@ module Danger
|
|
|
270
272
|
|
|
271
273
|
def info
|
|
272
274
|
ui.header "Useful info"
|
|
273
|
-
ui.say "- One of the best ways to test out new rules locally is via
|
|
275
|
+
ui.say "- One of the best ways to test out new rules locally is via #{'bundle exec danger pr'.yellow}."
|
|
274
276
|
ui.pause 0.6
|
|
275
|
-
ui.say "- You can have Danger output all of her variables to the console via the
|
|
277
|
+
ui.say "- You can have Danger output all of her variables to the console via the #{'--verbose'.yellow} option."
|
|
276
278
|
ui.pause 0.6
|
|
277
279
|
ui.say "- You can look at the following Dangerfiles to get some more ideas:"
|
|
278
280
|
ui.pause 0.6
|
|
@@ -286,7 +288,7 @@ module Danger
|
|
|
286
288
|
ui.pause 0.6
|
|
287
289
|
|
|
288
290
|
ui.say "And you're good to go. Danger is a collaboration between Orta Therox, Gem 'Danger' McShane and Felix Krause."
|
|
289
|
-
ui.say "If you like Danger, let others know. If you want to know more, follow
|
|
291
|
+
ui.say "If you like Danger, let others know. If you want to know more, follow #{'@orta'.yellow} and #{'@KrauseFx'.yellow} on Twitter."
|
|
290
292
|
ui.say "If you don't like Danger, help us improve the project! xxx"
|
|
291
293
|
end
|
|
292
294
|
|