danger 4.3.2 → 4.3.3

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: b7941b0c0f6d0d18603265ce8daed01d8075ea11
4
- data.tar.gz: eeaea8c0c7947c8f0cdbd3e90415c93dc5510999
3
+ metadata.gz: ac8016ce34c94a5e3ab531f39da5d552677ea816
4
+ data.tar.gz: 98ec9232cc83c5378e07bb7e91ca3cda5a8ab896
5
5
  SHA512:
6
- metadata.gz: bde2e5f4bdcbb18fdc5840175407c00b42929637e7de95cacd695c2ec6b440b174434d7205a995900de08543f23071dfd24f3c94c371f62daae34572eb4be26f
7
- data.tar.gz: 29f6a0d0e9dd882ca98f31d53aff9c777f7e859e0078c7a89fe7702d5974ec6f6b1b779740df9212fdba6b747c7c7bb879fed5a9b2d26f6c4de4f57489dbfcdd
6
+ metadata.gz: f3771c0464943b15a140c27c4ee7b70a414670ea88f779002fd433cda04b8cd5ce78dbe6a7824457425872e40f2e0e21aac3f78b4004fb5d1426d01c4989a92b
7
+ data.tar.gz: ef2ff358cc4841a44b03f0762c0cb997452c36f6ac19df2b8bb37c8e42e15b51c19ec05f2b8afce34bb725d70c1c9405de4be45caca5016f53e39b6d89bb7c3c
@@ -29,7 +29,7 @@ module Danger
29
29
  self.command = "danger"
30
30
  self.version = Danger::VERSION
31
31
 
32
- self.plugin_prefixes = %w(claide danger)
32
+ self.plugin_prefixes = %w[claide danger]
33
33
 
34
34
  def initialize(argv)
35
35
  dangerfile = argv.option("dangerfile", "Dangerfile")
@@ -212,7 +212,7 @@ module Danger
212
212
  return if (violations[:errors] + violations[:warnings] + violations[:messages] + status[:markdowns]).count.zero?
213
213
 
214
214
  ui.section("Results:") do
215
- %i(errors warnings messages).each do |key|
215
+ %i[errors warnings messages].each do |key|
216
216
  formatted = key.to_s.capitalize + ":"
217
217
  title = case key
218
218
  when :errors
@@ -154,7 +154,7 @@ module Danger
154
154
  def import_dangerfile_from_github(slug, branch = nil, path = nil)
155
155
  raise "`import_dangerfile_from_github` requires a string" unless slug.kind_of?(String)
156
156
  org, repo = slug.split("/")
157
- download_url = env.request_source.file_url(organisation: org, repository: repo, branch: branch || "master", path: path || "Dangerfile")
157
+ download_url = env.request_source.file_url(organisation: org, repository: repo, branch: branch, path: path || "Dangerfile")
158
158
  local_path = download(download_url)
159
159
  @dangerfile.parse(Pathname.new(local_path))
160
160
  end
@@ -234,7 +234,7 @@ module Danger
234
234
  @github.dismiss_out_of_range_messages = dismiss == true
235
235
  end
236
236
 
237
- %i(title body author labels json).each do |suffix|
237
+ %i[title body author labels json].each do |suffix|
238
238
  alias_method "mr_#{suffix}".to_sym, "pr_#{suffix}".to_sym
239
239
  end
240
240
 
@@ -207,7 +207,7 @@ module Danger
207
207
  paths.first(paths.count - 1).join(", ") + " & " + paths.last
208
208
  end
209
209
 
210
- %i(title body author labels json diff).each do |suffix|
210
+ %i[title body author labels json diff].each do |suffix|
211
211
  alias_method "pr_#{suffix}".to_sym, "mr_#{suffix}".to_sym
212
212
  end
213
213
 
@@ -416,9 +416,19 @@ module Danger
416
416
  end
417
417
 
418
418
  # @return [String] A URL to the specific file, ready to be downloaded
419
- def file_url(organisation: nil, repository: nil, branch: "master", path: nil)
419
+ def file_url(organisation: nil, repository: nil, branch: nil, path: nil)
420
420
  organisation ||= self.organisation
421
- "https://raw.githubusercontent.com/#{organisation}/#{repository}/#{branch}/#{path}"
421
+
422
+ return @download_url unless @download_url.nil?
423
+ begin
424
+ # Retrieve the download URL (default branch on nil param)
425
+ contents = client.contents("#{organisation}/#{repository}", path: path, ref: branch)
426
+ @download_url = contents["download_url"]
427
+ rescue Octokit::ClientError
428
+ # Fallback to github.com
429
+ branch ||= "master"
430
+ @download_url = "https://raw.githubusercontent.com/#{organisation}/#{repository}/#{branch}/#{path}"
431
+ end
422
432
  end
423
433
  end
424
434
  end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "4.3.2".freeze
2
+ VERSION = "4.3.3".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: 4.3.2
4
+ version: 4.3.3
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-03-30 00:00:00.000000000 Z
12
+ date: 2017-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide