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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ebc15e5d94bb1987f64914c8c4345f23837df23
4
- data.tar.gz: 852987c3cd1dab15788f7563e27114b3b7409ddd
3
+ metadata.gz: 3248c206c971afa67361a2579ff0fe2a74a6e9db
4
+ data.tar.gz: 90a4b47170efda035644bb4d9974d55af7cdb67c
5
5
  SHA512:
6
- metadata.gz: 385a51a1ff10d5670e1e91b16b3303e345c8ec39425e2f7b0d6bd37f91cda96336c42e11bc2207ad62d5504adaa004791892d1f4b1308040fa9d138b755baac2
7
- data.tar.gz: 2cdf122f2787a31b58f885970ca5e25e543a59d666f52268623816e36548679642ad21e4ba637ad05176596e8e44f56d8ca8aa504e5d409879985fbef7554b8c
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
- # commands:
15
- # - ...
16
- # - bundle exec danger
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 add the `DANGER_GITHUB_API_TOKEN` to your build user's ENV. The alternative
22
- # is to pass in the token as a prefix to the command `DANGER_GITHUB_API_TOKEN="123" bundle exec danger`.
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.key? "DRONE_REPO"
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.repo_slug = env["DRONE_REPO"]
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
- self.repo_url = GitRepo.new.origins # Drone doesn't provide a repo url env variable :/
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
@@ -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 local".yellow + "."
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
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "5.0.3".freeze
2
+ VERSION = "5.1.0".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
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.3
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-18 00:00:00.000000000 Z
12
+ date: 2017-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide