danger 5.13.0 → 5.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: f22280b15d14004d5087e64d8d576819b63694288d5541a71f25eb2d6baeecdc
4
- data.tar.gz: 2964dbf7b7a4389c7be8e293dc0bbabcfe21419fe4a18b04b6d77e6b129ebf2d
2
+ SHA1:
3
+ metadata.gz: 3ad7a6d0ad0c2cac62253cf27996a549026159df
4
+ data.tar.gz: 247abc76bb8cd25047c242835330e09413268d40
5
5
  SHA512:
6
- metadata.gz: 2a6de8ea2f5cf3a80d4aa45dab2bd47980d11fcde6569d321623155b244a67668e213af664d9ee54f39f8653c7ce0d15683dcfe9030c169f28d194c65a778027
7
- data.tar.gz: cb4d77b72b305259ca17670f334988c229ab18604db04896c39a0d954fc3d742ae0a35e54d8ca56b4c89fb19a7a4a4d97a07853b2b5e358bfd49f578655f0f38
6
+ metadata.gz: fc508c5fea76dab88a9fdbc0574e8d8d8674e8a21a7f53bc4d39c94bc9ba413ca4dae3a87d2f7081c1e180234ee2c659b7922897eba840e156cb30c4636d2ac2
7
+ data.tar.gz: 3863dd8cf1b5470bda0af673ea8bf3a6b22709959335b6fc7f29394523bb96a325aed0e499bb8b844c2bc6239b5a446415acdd434dae334d9696c3718a145dc1
@@ -38,6 +38,7 @@ module Danger
38
38
  @base = argv.option("base")
39
39
  @head = argv.option("head")
40
40
  @fail_on_errors = argv.option("fail-on-errors", false)
41
+ @fail_if_no_pr = argv.option("fail-if-no-pr", false)
41
42
  @new_comment = argv.flag?("new-comment")
42
43
  @remove_previous_comments = argv.flag?("remove-previous-comments")
43
44
  @danger_id = argv.option("danger_id", "danger")
@@ -59,6 +60,7 @@ module Danger
59
60
  ["--base=[master|dev|stable]", "A branch/tag/commit to use as the base of the diff"],
60
61
  ["--head=[master|dev|stable]", "A branch/tag/commit to use as the head"],
61
62
  ["--fail-on-errors=<true|false>", "Should always fail the build process, defaults to false"],
63
+ ["--fail-if-no-pr=<true|false>", "Should fail the build process if no PR is found (useful for CircleCI), defaults to false"],
62
64
  ["--dangerfile=<path/to/dangerfile>", "The location of your Dangerfile"],
63
65
  ["--danger_id=<id>", "The identifier of this Danger instance"],
64
66
  ["--new-comment", "Makes Danger post a new comment instead of editing its previous one"],
@@ -74,6 +76,7 @@ module Danger
74
76
  danger_id: @danger_id,
75
77
  new_comment: @new_comment,
76
78
  fail_on_errors: @fail_on_errors,
79
+ fail_if_no_pr: @fail_if_no_pr,
77
80
  remove_previous_comments: @remove_previous_comments
78
81
  )
79
82
  end
@@ -13,12 +13,13 @@ module Danger
13
13
  danger_id: nil,
14
14
  new_comment: nil,
15
15
  fail_on_errors: nil,
16
+ fail_if_no_pr: nil,
16
17
  remove_previous_comments: nil)
17
18
  # Create a silent Cork instance if cork is nil, as it's likely a test
18
19
  cork ||= Cork::Board.new(silent: false, verbose: false)
19
20
 
20
21
  # Run some validations
21
- validate!(cork)
22
+ validate!(cork, fail_if_no_pr: fail_if_no_pr)
22
23
 
23
24
  # OK, we now know that Danger can run in this enviroment
24
25
  env ||= EnvironmentManager.new(system_env, cork)
@@ -41,9 +42,9 @@ module Danger
41
42
  exit(1) if fail_on_errors && ran_status
42
43
  end
43
44
 
44
- def validate!(cork)
45
+ def validate!(cork, fail_if_no_pr: false)
45
46
  validate_ci!
46
- validate_pr!(cork)
47
+ validate_pr!(cork, fail_if_no_pr)
47
48
  end
48
49
 
49
50
  private
@@ -58,11 +59,12 @@ module Danger
58
59
  end
59
60
 
60
61
  # Could we determine that the CI source is inside a PR?
61
- def validate_pr!(cork)
62
+ def validate_pr!(cork, fail_if_no_pr)
62
63
  unless EnvironmentManager.pr?(system_env)
63
64
  ci_name = EnvironmentManager.local_ci_source(system_env).name.split("::").last
64
65
  cork.puts "Not a #{ci_name} Pull Request - skipping `danger` run".yellow
65
- exit(0)
66
+
67
+ exit(fail_if_no_pr ? 1 : 0)
66
68
  end
67
69
  end
68
70
 
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "5.13.0".freeze
2
+ VERSION = "5.14.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.13.0
4
+ version: 5.14.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: 2019-01-31 00:00:00.000000000 Z
12
+ date: 2019-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  version: '0'
301
301
  requirements: []
302
302
  rubyforge_project:
303
- rubygems_version: 2.7.6
303
+ rubygems_version: 2.5.2.3
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: Like Unit Tests, but for your Team Culture.