danger 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/ci_source/bitrise.rb +2 -1
- data/lib/danger/comment_generators/bitbucket_server.md.erb +1 -1
- data/lib/danger/danger_core/dangerfile.rb +8 -1
- data/lib/danger/danger_core/plugins/dangerfile_bitbucket_server_plugin.rb +26 -4
- data/lib/danger/danger_core/plugins/dangerfile_gitlab_plugin.rb +3 -3
- data/lib/danger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc585b3a42ead8015e789fab0a20800043436033
|
4
|
+
data.tar.gz: 5568de8b9b97cdf2296ff8ef386286a4dc03096d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c955e1a1a81c272e25e6abdb5b3d8e51630f2f2850ef4c696acda0e5348f37211ced89910af612a592fab1c492c4ddc6bb3ccc9c0d704a49c23330ee0d628528
|
7
|
+
data.tar.gz: 8d88d1ad781ff5705e44d3f8780191786ccbb19012fc845c062c58b3412bf6a504f2c11b73a4a8052ab43d4a243e85920deba3c76564a561009cf98d3f385c6f
|
@@ -13,7 +13,8 @@ module Danger
|
|
13
13
|
# ```
|
14
14
|
# ### Token Setup
|
15
15
|
#
|
16
|
-
# Add the `DANGER_GITHUB_API_TOKEN` to your workflow's
|
16
|
+
# Add the `DANGER_GITHUB_API_TOKEN` to your workflow's App Env Vars.
|
17
|
+
# Warning: adding the token as a Secret Env Var will not work for PR builds, as [Bitrise does not expose secret vars to PRs](https://bitrise.uservoice.com/forums/235233-general/suggestions/11701587-make-secret-env-variables-available-for-prs-from-t).
|
17
18
|
#
|
18
19
|
class Bitrise < CI
|
19
20
|
def self.validates_as_ci?(env)
|
@@ -17,4 +17,4 @@
|
|
17
17
|
<%# the previous line has to be aligned far to the left, otherwise markdown can break easily %>
|
18
18
|
<%- end -%>
|
19
19
|
|
20
|
-
Generated by 🚫 [danger](
|
20
|
+
Generated by 🚫 [danger](https://danger.systems/ "generated_by_<%= @danger_id %>")
|
@@ -125,7 +125,7 @@ module Danger
|
|
125
125
|
|
126
126
|
else
|
127
127
|
value = plugin.send(method)
|
128
|
-
value = value
|
128
|
+
value = wrap_text(value) if value.kind_of?(String)
|
129
129
|
# So that we either have one value per row
|
130
130
|
# or we have [] for an empty array
|
131
131
|
value = value.join("\n") if value.kind_of?(Array) && value.count > 0
|
@@ -247,5 +247,12 @@ module Danger
|
|
247
247
|
end
|
248
248
|
end unless rows.empty?
|
249
249
|
end
|
250
|
+
|
251
|
+
def wrap_text(text, width = 80)
|
252
|
+
text.gsub(/.{,#{width}}/) do |line|
|
253
|
+
line.strip!
|
254
|
+
"#{line}\n"
|
255
|
+
end
|
256
|
+
end
|
250
257
|
end
|
251
258
|
end
|
@@ -150,6 +150,26 @@ module Danger
|
|
150
150
|
# @return [String]
|
151
151
|
#
|
152
152
|
def html_link(paths, full_path: true)
|
153
|
+
create_link(paths, full_path) { |href, text| create_html_link(href, text) }
|
154
|
+
end
|
155
|
+
|
156
|
+
# @!group Bitbucket Server Misc
|
157
|
+
# Returns a list of Markdown links for a file, or files in the head repository.
|
158
|
+
# It returns a string of multiple links if passed an array.
|
159
|
+
# @param [String or Array<String>] paths
|
160
|
+
# A list of strings to convert to Markdown links
|
161
|
+
# @param [Bool] full_path
|
162
|
+
# Shows the full path as the link's text, defaults to `true`.
|
163
|
+
#
|
164
|
+
# @return [String]
|
165
|
+
#
|
166
|
+
def markdown_link(paths, full_path: true)
|
167
|
+
create_link(paths, full_path) { |href, text| create_markdown_link(href, text) }
|
168
|
+
end
|
169
|
+
|
170
|
+
private
|
171
|
+
|
172
|
+
def create_link(paths, full_path)
|
153
173
|
paths = [paths] unless paths.kind_of?(Array)
|
154
174
|
commit = head_commit
|
155
175
|
repo = pr_json[:fromRef][:repository][:links][:self].flat_map { |l| l[:href] }.first
|
@@ -160,17 +180,19 @@ module Danger
|
|
160
180
|
text = full_path ? path : File.basename(path)
|
161
181
|
url_path.gsub!(" ", "%20")
|
162
182
|
line_ref = line ? "##{line}" : ""
|
163
|
-
|
183
|
+
yield("#{repo}#{url_path}?at=#{commit}#{line_ref}", text)
|
164
184
|
end
|
165
185
|
|
166
186
|
return paths.first if paths.count < 2
|
167
187
|
paths.first(paths.count - 1).join(", ") + " & " + paths.last
|
168
188
|
end
|
169
189
|
|
170
|
-
|
171
|
-
|
172
|
-
def create_link(href, text)
|
190
|
+
def create_html_link(href, text)
|
173
191
|
"<a href='#{href}'>#{text}</a>"
|
174
192
|
end
|
193
|
+
|
194
|
+
def create_markdown_link(href, text)
|
195
|
+
"[#{text}](#{href})"
|
196
|
+
end
|
175
197
|
end
|
176
198
|
end
|
@@ -192,9 +192,9 @@ module Danger
|
|
192
192
|
def html_link(paths, full_path: true)
|
193
193
|
paths = [paths] unless paths.kind_of?(Array)
|
194
194
|
commit = head_commit
|
195
|
-
same_repo = mr_json[
|
196
|
-
sender_repo = ci_source.repo_slug.split("/").first + "/" +
|
197
|
-
repo = same_repo ? ci_source.repo_slug : sender_repo
|
195
|
+
same_repo = mr_json["project_id"] == mr_json["source_project_id"]
|
196
|
+
sender_repo = env.ci_source.repo_slug.split("/").first + "/" + mr_author
|
197
|
+
repo = same_repo ? env.ci_source.repo_slug : sender_repo
|
198
198
|
host = @gitlab.host
|
199
199
|
|
200
200
|
paths = paths.map do |path|
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|