danger 5.10.1 → 5.10.2

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: 634667961b9759c0b6fa27c7c2744d2271c7ac9c12114b58471f382d0d9470f1
4
- data.tar.gz: 6f45d872e8584dbfa8729d781179e82a9336e45a9e27227cbbd33e114d5a5611
3
+ metadata.gz: f0965f3f24397615223b0f7902793a060291402040a1cce4842d8415b5cbf21c
4
+ data.tar.gz: f92dc1a2fa9b0a42e07f8da9fe82a81c9492b77044edb897f6fa967fbf5794b6
5
5
  SHA512:
6
- metadata.gz: ec23d0bf3eb2df53f43f634d0c8724e8c9bc52859f4b0ba55f197926771672701ad0398f9ee6c79b2271fe72f265c4c589d57fabd52cd44aee8812d62ccf72ec
7
- data.tar.gz: b03f42a03b130cbb475a6ab9b9d7938750823310a602ec89a554df0ab44fe241e63e5ac3252d0dfd66a41baf56dc892e11b3d37f496fd40d0709e6950eaed50d
6
+ metadata.gz: da63efdd814dab639212e648968b6a88f8e845901e0ed25412e6b7fe7420137909ea67543abb6e017c32663f415f08ac9c53cc23ef7be9418c288b973d69a457
7
+ data.tar.gz: b8b180acc53aa2fe5e3458c54d51de47af0813f38e0589469904117d9d19bfec7bf2240c35e7c5b791e2261fc774b7898b79b72b178ec0afe182d78a0911365a
@@ -78,14 +78,35 @@ module Danger
78
78
 
79
79
  self.repo_url = self.class.repo_url(env)
80
80
  self.pull_request_id = self.class.pull_request_id(env)
81
+ self.repo_slug = self.class.repo_slug(self.repo_url)
82
+ end
81
83
 
82
- repo_matches = self.repo_url.match(%r{(?:[\/:])projects\/([^\/.]+)\/repos\/([^\/.]+)}) # Bitbucket Server
83
- if repo_matches
84
- self.repo_slug = "#{repo_matches[1]}/#{repo_matches[2]}"
85
- else
86
- repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/]+)$})
87
- self.repo_slug = repo_matches[2].gsub(/\.git$/, "") unless repo_matches.nil?
88
- end
84
+ def self.repo_slug(repo_url)
85
+ slug = self.slug_ssh(repo_url)
86
+ slug = self.slug_http(repo_url) unless slug
87
+ slug = self.slug_bitbucket(repo_url) unless slug
88
+ slug = self.slug_fallback(repo_url) unless slug
89
+ return slug.gsub(/\.git$/, "") unless slug.nil?
90
+ end
91
+
92
+ def self.slug_bitbucket(repo_url)
93
+ repo_matches = repo_url.match(%r{(?:[\/:])projects\/([^\/.]+)\/repos\/([^\/.]+)})
94
+ return "#{repo_matches[1]}/#{repo_matches[2]}" if repo_matches
95
+ end
96
+
97
+ def self.slug_ssh(repo_url)
98
+ repo_matches = repo_url.match(%r{^git@.+:(.+)})
99
+ return repo_matches[1] if repo_matches
100
+ end
101
+
102
+ def self.slug_http(repo_url)
103
+ repo_matches = repo_url.match(%r{^https?.+(?>\.\w*\d*\/)(.+.git$)})
104
+ return repo_matches[1] if repo_matches
105
+ end
106
+
107
+ def self.slug_fallback(repo_url)
108
+ repo_matches = repo_url.match(%r{([\/:])([^\/]+\/[^\/]+)$})
109
+ return repo_matches[2]
89
110
  end
90
111
 
91
112
  def self.pull_request_id(env)
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "5.10.1".freeze
2
+ VERSION = "5.10.2".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.10.1
4
+ version: 5.10.2
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: 2018-12-10 00:00:00.000000000 Z
12
+ date: 2018-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide