danger 6.0.6 → 6.0.7

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
  SHA256:
3
- metadata.gz: e6399c2198aa30f430f23acac0880e17511981dc2ff30aea5870621cb85e9e65
4
- data.tar.gz: 81efc6836e4664d805360368f3ede80ec2c758f6327e622ed9875e7dca53ea65
3
+ metadata.gz: aa6b37fb17398fe4c260d3061dc0f70e65a78394d7457d315073d44dba7b879f
4
+ data.tar.gz: 0ab01536474a4520b80f06451dd0c94d4f3965b0094968745c72d58780ee0307
5
5
  SHA512:
6
- metadata.gz: 4042bc459386e5873c0468e1579ab5cd5512229be5743a75fc17573e1e7ce67bfab2569dbe9986db8d5dd0554ee927d31b8fbf6e6d6cadf027b4543d26b5dc9a
7
- data.tar.gz: ef91e279bc7889fa61a3f4cb6c370fe6d186d3a25607252f2bb0250c26347ceadf0a8aa1ae556eb41ce95ec59b9e5f3f807562ca867a53fe28f25d16a6b31399
6
+ metadata.gz: c79ca524ee16c5e5bf9e7c5e99895bbadcc3ee3979ba5fda2b8510bae5f08a0ee48eef52675566bb745f05799ba2b5ab32e1110b924a0bc205d3510b1da908a9
7
+ data.tar.gz: 31ad9d9cb0e42ec3954d5ba510106fe2ebb4b3bbaca7bb92916018eb6c4690e3fe73f3bb975683ff1e99e94c9118e55682bf78870fcec8f02949204247e90ba0
@@ -76,8 +76,10 @@ module Danger
76
76
  warn "Use `import_dangerfile(github: '#{opts}')` instead of `import_dangerfile '#{opts}'`."
77
77
  import_dangerfile_from_github(opts)
78
78
  elsif opts.kind_of?(Hash)
79
- if opts.key?(:github) || opts.key?(:gitlab)
80
- import_dangerfile_from_github(opts[:github] || opts[:gitlab], opts[:branch], opts[:path])
79
+ if opts.key?(:github)
80
+ import_dangerfile_from_github(opts[:github], opts[:branch], opts[:path])
81
+ elsif opts.key?(:gitlab_project_id)
82
+ import_dangerfile_from_gitlab(opts[:gitlab_project_id], opts[:branch], opts[:path])
81
83
  elsif opts.key?(:path)
82
84
  import_dangerfile_from_path(opts[:path])
83
85
  elsif opts.key?(:gem)
@@ -161,6 +163,24 @@ module Danger
161
163
  @dangerfile.parse(Pathname.new(local_path))
162
164
  end
163
165
 
166
+ # @!group Danger
167
+ # Download and execute a remote Dangerfile.
168
+ #
169
+ # @param [Int] project_id
170
+ # The id of the repo where the Dangerfile is.
171
+ # @param [String] branch
172
+ # A branch from repo where the Dangerfile is.
173
+ # @param [String] path
174
+ # The path at the repo where Dangerfile is.
175
+ # @return [void]
176
+ #
177
+ def import_dangerfile_from_gitlab(project_id, branch = nil, path = nil)
178
+ raise "`import_dangerfile_from_gitlab` requires a integer" unless project_id.kind_of?(Integer)
179
+ download_url = env.request_source.file_url(repository: project_id, branch: branch, path: path || "Dangerfile")
180
+ local_path = download(download_url)
181
+ @dangerfile.parse(Pathname.new(local_path))
182
+ end
183
+
164
184
  # @!group Plugins
165
185
  # Download a local or remote plugin or Dangerfile.
166
186
  # This method will not import the file for you, use plugin.import instead
@@ -297,8 +297,8 @@ module Danger
297
297
  # @return [String] A URL to the specific file, ready to be downloaded
298
298
  def file_url(organisation: nil, repository: nil, branch: nil, path: nil)
299
299
  branch ||= 'master'
300
-
301
- "https://#{host}/#{organisation}/#{repository}/raw/#{branch}/#{path}"
300
+ token = @environment["DANGER_GITLAB_API_TOKEN"]
301
+ "#{endpoint}/projects/#{repository}/repository/files/#{path}/raw?ref=#{branch}&private_token=#{token}"
302
302
  end
303
303
 
304
304
  def regular_violations_group(warnings: [], errors: [], messages: [], markdowns: [])
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "6.0.6".freeze
2
+ VERSION = "6.0.7".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: 6.0.6
4
+ version: 6.0.7
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-04-19 00:00:00.000000000 Z
12
+ date: 2019-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '1.0'
90
+ version: '2.0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.0'
97
+ version: '2.0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: kramdown
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -316,8 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  - !ruby/object:Gem::Version
317
317
  version: '0'
318
318
  requirements: []
319
- rubyforge_project:
320
- rubygems_version: 2.7.6
319
+ rubygems_version: 3.0.3
321
320
  signing_key:
322
321
  specification_version: 4
323
322
  summary: Like Unit Tests, but for your Team Culture.