danger 5.0.3 → 5.1.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/lib/danger/ci_source/drone.rb +36 -8
- data/lib/danger/commands/init.rb +1 -1
- 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: 3248c206c971afa67361a2579ff0fe2a74a6e9db
|
4
|
+
data.tar.gz: 90a4b47170efda035644bb4d9974d55af7cdb67c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8259a349dbdd29d279c86a19f9344c3d64d58f1995b18f97bae37fc8fa7d2013209223f10fc12befa44b2bfd44d20d1b8009d522fcfd4a9afaec50ae37ac9abe
|
7
|
+
data.tar.gz: ad8acef7b9e8c8f775e57f57a41907fbef70b4ccf523cf5cc6c48986d446ed6c291a61479ff42e2cf2a02dd02444e0762b2d536d27b2861fba433149b55fd997
|
@@ -11,19 +11,31 @@ module Danger
|
|
11
11
|
# ``` shell
|
12
12
|
# build:
|
13
13
|
# image: golang
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
14
|
+
# commands:
|
15
|
+
# - ...
|
16
|
+
# - bundle exec danger
|
17
17
|
# ```
|
18
18
|
#
|
19
19
|
# ### Token Setup
|
20
20
|
#
|
21
|
-
# As this is self-hosted, you will need to
|
22
|
-
#
|
21
|
+
# As this is self-hosted, you will need to expose the `DANGER_GITHUB_API_TOKEN` as a secret to your
|
22
|
+
# builds:
|
23
23
|
#
|
24
|
+
# Drone secrets: http://readme.drone.io/usage/secret-guide/
|
25
|
+
# NOTE: This is a new syntax in DroneCI 0.6+
|
26
|
+
#
|
27
|
+
# ```
|
28
|
+
# build:
|
29
|
+
# image: golang
|
30
|
+
# secrets:
|
31
|
+
# - DANGER_GITHUB_API_TOKEN
|
32
|
+
# commands:
|
33
|
+
# - ...
|
34
|
+
# - bundle exec danger
|
35
|
+
# ```
|
24
36
|
class Drone < CI
|
25
37
|
def self.validates_as_ci?(env)
|
26
|
-
env
|
38
|
+
validates_as_ci_post_06?(env) or validates_as_ci_pre_06?(env)
|
27
39
|
end
|
28
40
|
|
29
41
|
def self.validates_as_pr?(env)
|
@@ -35,9 +47,25 @@ module Danger
|
|
35
47
|
end
|
36
48
|
|
37
49
|
def initialize(env)
|
38
|
-
self.
|
50
|
+
if self.class.validates_as_ci_post_06?(env)
|
51
|
+
self.repo_slug = "#{env['DRONE_REPO_OWNER']}/#{env['DRONE_REPO_NAME']}"
|
52
|
+
self.repo_url = env["DRONE_REPO_LINK"] if self.class.validates_as_ci_post_06?(env)
|
53
|
+
elsif self.class.validates_as_ci_pre_06?(env)
|
54
|
+
self.repo_slug = env["DRONE_REPO"]
|
55
|
+
self.repo_url = GitRepo.new.origins
|
56
|
+
end
|
57
|
+
|
39
58
|
self.pull_request_id = env["DRONE_PULL_REQUEST"]
|
40
|
-
|
59
|
+
end
|
60
|
+
|
61
|
+
# Check if this build is valid for CI with drone 0.6 or later
|
62
|
+
def self.validates_as_ci_post_06?(env)
|
63
|
+
env.key? "DRONE_REPO_OWNER" and env.key? "DRONE_REPO_NAME"
|
64
|
+
end
|
65
|
+
|
66
|
+
# Checks if this build is valid for CI with drone 0.5 or earlier
|
67
|
+
def self.validates_as_ci_pre_06?(env)
|
68
|
+
env.key? "DRONE_REPO"
|
41
69
|
end
|
42
70
|
end
|
43
71
|
end
|
data/lib/danger/commands/init.rb
CHANGED
@@ -265,7 +265,7 @@ module Danger
|
|
265
265
|
|
266
266
|
def info
|
267
267
|
ui.header "Useful info"
|
268
|
-
ui.say "- One of the best ways to test out new rules locally is via " + "bundle exec danger
|
268
|
+
ui.say "- One of the best ways to test out new rules locally is via " + "bundle exec danger pr".yellow + "."
|
269
269
|
ui.pause 0.6
|
270
270
|
ui.say "- You can have Danger output all of its variables to the console via the " + "--verbose".yellow + " option."
|
271
271
|
ui.pause 0.6
|
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: 5.0
|
4
|
+
version: 5.1.0
|
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: 2017-04-
|
12
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|