danger 3.4.0 → 3.4.1

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
2
  SHA1:
3
- metadata.gz: 331ec016762064e8a92668e5b9b56521e5873f50
4
- data.tar.gz: 69fb9998dbe05c5465301a4a0396a28ce4ebf1ca
3
+ metadata.gz: de42011bfb76e71cb7b4a3307648b54695b9b725
4
+ data.tar.gz: 06eb74831ab383be09312427e072f9d49096089d
5
5
  SHA512:
6
- metadata.gz: 0abf5fed8d027d3368573054d82b87c4010bf806ef83d0d41f8b964d438e44fd35dd99f822de9ebc581c3d3d59ea6810145235a08b7ed7a20682f4ae35e80019
7
- data.tar.gz: 2189b8616f4a18ee79d12863c5ce0db5dc803996635c5e14b6f56f66050b97207cb76198fc36cadad80399e4b3ed6c0901814f653972236d57ab4a5f37015583
6
+ metadata.gz: c8ce21aa3ad48d64b7ac92623ec924220f05a98ff3a80dd8a41fa5354d92296625f00ab0796396d7c06882cbff5147cd62af5f802499c1a192ca04a796c64f29
7
+ data.tar.gz: 907dd19d7d3c044fe7f6c6e30dfbec053864de5b412e92bdbe7ebd05d29726d87c67f2de0c448f6c4e77bb6dfaf9a146a801adc4d03aefb3b09c9325b6dbb78c
@@ -19,7 +19,7 @@ module Danger
19
19
  end
20
20
 
21
21
  def supports?(request_source)
22
- supported_request_sources.include? request_source
22
+ supported_request_sources.include?(request_source)
23
23
  end
24
24
 
25
25
  def self.validates_as_ci?(_env)
@@ -15,6 +15,16 @@ module Danger
15
15
  local_ci_source(env).validates_as_pr?(env)
16
16
  end
17
17
 
18
+ # @return [String] danger's default head branch
19
+ def self.danger_head_branch
20
+ "danger_head".freeze
21
+ end
22
+
23
+ # @return [String] danger's default base branch
24
+ def self.danger_base_branch
25
+ "danger_base".freeze
26
+ end
27
+
18
28
  def initialize(env, ui)
19
29
  ci_klass = self.class.local_ci_source(env)
20
30
  self.ci_source = ci_klass.new(env)
@@ -53,20 +63,12 @@ module Danger
53
63
  end
54
64
  end
55
65
 
56
- def meta_info_for_base
57
- scm.exec("--no-pager log #{EnvironmentManager.danger_base_branch} -n1")
58
- end
59
-
60
66
  def meta_info_for_head
61
67
  scm.exec("--no-pager log #{EnvironmentManager.danger_head_branch} -n1")
62
68
  end
63
69
 
64
- def self.danger_head_branch
65
- "danger_head"
66
- end
67
-
68
- def self.danger_base_branch
69
- "danger_base"
70
+ def meta_info_for_base
71
+ scm.exec("--no-pager log #{EnvironmentManager.danger_base_branch} -n1")
70
72
  end
71
73
 
72
74
  def raise_error_for_no_request_source(env, ui)
@@ -29,6 +29,10 @@ module Danger
29
29
  #
30
30
  # danger.import_dangerfile(gitlab: "ruby-grape/danger")
31
31
  #
32
+ # @example Run a Dangerfile from inside a repo branch and path
33
+ #
34
+ # danger.import_dangerfile(github: "ruby-grape/danger", branch: "custom", path: "path/to/Dangerfile")
35
+ #
32
36
  # @see danger/danger
33
37
  # @tags core, plugins
34
38
 
@@ -73,7 +77,7 @@ module Danger
73
77
  import_dangerfile_from_github(opts)
74
78
  elsif opts.kind_of?(Hash)
75
79
  if opts.key?(:github) || opts.key?(:gitlab)
76
- import_dangerfile_from_github(opts[:github] || opts[:gitlab])
80
+ import_dangerfile_from_github(opts[:github] || opts[:gitlab], opts[:branch], opts[:path])
77
81
  elsif opts.key?(:path)
78
82
  import_dangerfile_from_path(opts[:path])
79
83
  elsif opts.key?(:gem)
@@ -141,12 +145,16 @@ module Danger
141
145
  #
142
146
  # @param [String] slug
143
147
  # A slug that represents the repo where the Dangerfile is.
148
+ # @param [String] branch
149
+ # A branch from repo where the Dangerfile is.
150
+ # @param [String] path
151
+ # The path at the repo where Dangerfile is.
144
152
  # @return [void]
145
153
  #
146
- def import_dangerfile_from_github(slug)
154
+ def import_dangerfile_from_github(slug, branch = nil, path = nil)
147
155
  raise "`import_dangerfile_from_github` requires a string" unless slug.kind_of?(String)
148
156
  org, repo = slug.split("/")
149
- download_url = env.request_source.file_url(organisation: org, repository: repo, branch: "master", path: "Dangerfile")
157
+ download_url = env.request_source.file_url(organisation: org, repository: repo, branch: branch || "master", path: path || "Dangerfile")
150
158
  local_path = download(download_url)
151
159
  @dangerfile.parse(Pathname.new(local_path))
152
160
  end
@@ -208,7 +216,7 @@ module Danger
208
216
  def validate_file_contains_plugin!(file)
209
217
  content = IO.read(file)
210
218
 
211
- if content.scan(/class\s+(?<plugin_class>[\w]+)\s+<\s+Plugin/i).empty?
219
+ if content.scan(/class\s+(?<plugin_class>[\w]+)\s+<\s+((Danger::)?Plugin)/i).empty?
212
220
  raise("#{file} doesn't contain any valid danger plugin.")
213
221
  end
214
222
  end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "3.4.0".freeze
2
+ VERSION = "3.4.1".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: 3.4.0
4
+ version: 3.4.1
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-29 00:00:00.000000000 Z
12
+ date: 2016-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -459,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
459
459
  version: '0'
460
460
  requirements: []
461
461
  rubyforge_project:
462
- rubygems_version: 2.2.2
462
+ rubygems_version: 2.6.4
463
463
  signing_key:
464
464
  specification_version: 4
465
465
  summary: Like Unit Tests, but for your Team Culture.