stash-api 1.1.30.0 → 1.1.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/stash-api/client.rb +8 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWMxMTMyMmQwMTc3OTViMjllNTNmMGNiZmE4MDk1ZjM1NjE1ZWI4Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjM5YjA0ZWZjZTc1ZTM3N2QzYzlmNTkxOGYxZWRiNzE4N2RjZGQ2NA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjY2ZjBhMTJhZjQ3NjlmYWRjYzcxZmIyMDEzMTJjOTBiZTRkODM0MzljYjkz
|
10
|
+
N2E1NGFjYTE3Y2ExZTE1NjkzOWUzYmEzZGZiZTk5NWRmNGVkMDFkNTc3ZDJm
|
11
|
+
Nzg0NTJlZThiZjgyOGE4MmM4Y2E1NjIyNzJmOTcwNTdiMzBiYzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmI3MDVmMmVlYWE5NDhhMzYwMWIzY2QxMjI2OGU2OGE5MDc5ODZiY2E0ZTU0
|
14
|
+
OWIwZGE0N2VlOGY5YTVhMTE0Y2YxMjhkZjFmZGY5Zjg3NGU1MjQwZjVmZjM4
|
15
|
+
Y2Y1YzZiNmJiYWQwN2Q0N2NjZTk4ZmNkNjlhYmM0YjUwNmY5OGQ=
|
data/lib/stash-api/client.rb
CHANGED
@@ -16,16 +16,12 @@ module Stash
|
|
16
16
|
|
17
17
|
match = remote_origin_url.match(/(ssh|https?):\/\/([^@]*@)?(?<server>[^\:\/]*)[^\/]*\/(scm\/)?(?<project>[^\/].*)\/(?<repository_name>[^\/]*)\.git$/)
|
18
18
|
raise "Remote origin cannot be inferred from the url: #{remote_origin_url}. Run `git remote add origin URL` to add an origin." if !match
|
19
|
-
|
20
|
-
@remote_api_url = File.join("https://#{match[:server]}", 'rest', 'api', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
|
21
|
-
@branch_permissions_url = File.join("https://#{match[:server]}", 'rest', 'branch-permissions', '2.0', 'projects', match[:project], 'repos', match[:repository_name], 'restrictions')
|
22
|
-
@branchring_model_url = File.join("https://#{match[:server]}", 'rest', 'branch-utils', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
|
23
|
-
@pull_request_settings = File.join("https://#{match[:server]}", 'rest', 'pullrequest-settings', '1.0', 'projects', match[:project], 'repos', match[:repository_name])
|
19
|
+
@server = match[:server]
|
24
20
|
|
25
21
|
repository_information = nil
|
26
22
|
RestClient::Request.new(
|
27
23
|
:method => :get,
|
28
|
-
:url => URI::encode(@
|
24
|
+
:url => URI::encode(File.join("https://#{@server}", 'rest', 'api', '1.0', 'projects', match[:project], 'repos', match[:repository_name])),
|
29
25
|
:user => @username,
|
30
26
|
:password => @password,
|
31
27
|
:headers => { :accept => :json, :content_type => :json }).execute do |response, request, result|
|
@@ -39,6 +35,12 @@ module Stash
|
|
39
35
|
@project = repository_information['project']['key']
|
40
36
|
@repository_name = repository_information['slug']
|
41
37
|
@ssh_url = repository_information['links']['clone'].select{|link| link['name'].match(/^ssh$/i)}.first['href']
|
38
|
+
|
39
|
+
#Set remote api URLs
|
40
|
+
@remote_api_url = File.join("https://#{@server}", 'rest', 'api', '1.0', 'projects', @project, 'repos', @repository_name)
|
41
|
+
@branch_permissions_url = File.join("https://#{@server}", 'rest', 'branch-permissions', '2.0', 'projects', @project, 'repos', @repository_name, 'restrictions')
|
42
|
+
@branchring_model_url = File.join("https://#{@server}", 'rest', 'branch-utils', '1.0', 'projects', @project, 'repos', @repository_name)
|
43
|
+
@pull_request_settings = File.join("https://#{@server}", 'rest', 'pullrequest-settings', '1.0', 'projects', @project, 'repos', @repository_name)
|
42
44
|
end
|
43
45
|
|
44
46
|
SETTINGS_HOOKS_URL = File.join('settings', 'hooks')
|