stash-api 1.1.28.0 → 1.1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/stash-api/client.rb +9 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGQ2ZThiMzY0MDAzNDRiMGFlZjQ4OWY4NjgzNjA5NGVjNWM1MWFhYQ==
4
+ ZmJkMGFkMDdkMjFiNjNmOTc2ZDkxOTY0MTJiMWNlZDI5YmY1MDEwMw==
5
5
  data.tar.gz: !binary |-
6
- NzczMmMwY2I4OTJkMThlYjM5ZmUxMzExN2YwN2E3ZThiYjIyODAzZQ==
6
+ OThiYjFkYWI2OTE2ZjlmZDY0ZDMxYzVmNjZmYmNmMzI4NDk3YTAwNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTI1MTMwM2JjY2I1ZmRjZTlmZThhOTcyOTA1YjU3NzYzZGM3MGQzMTQzZmEw
10
- N2UyZWRlNGI4MmRmNmY1ODM5MWRjZmJlNWFjMWMyZTQ1ZTJjNTFkY2UyMWUy
11
- NDViZGMzNWQ3ZmNkODY4ODI3NTdiMTVlOGVmM2ZkMDg1ODQ5M2U=
9
+ NGY2NmVlMzE0ZWZjYTZlMjQxN2Q0NTgwNzY4NmZhMjliNmI0ZTA2ZTQ2MTJl
10
+ NTdkMmZhMTMxNzUxM2E3YjE4YzViMmUwOGU2NGMyMzNhZTcyM2M5NTVlMDY1
11
+ NzA1Y2VhZjkwNTM1ZDk2ZGYxMTgwYjNhMWZmZGZkZGUyYjE2OTQ=
12
12
  data.tar.gz: !binary |-
13
- MzAxMTE4MzIwOWJlNTFiYmE3NGE3NjgzZDYxZTIyN2UwNWMzOWM1N2M4NzRh
14
- MjYxM2ZhYzI0Y2EwMzk0NGVhMzdlN2JjODg5YTFhZDMwNDdhZWUwMGU3Yzk1
15
- M2E1MzBhZjA0NzBiMjRjMDNkMjViMzM4NzViNmNmZDAxMThmNmE=
13
+ MTcxZjg4ZTc2ZDJhZjgwNjEzMDZkNTliMzIxNGJhODBjOWVlYTRkM2QxMmZh
14
+ MGZjMDVmMzY1YjhiZDViZDA3MGNhZTQ2NjYzNGE4NDgzNjg1YTUxODU3NDBm
15
+ MzJhYWIwOGNkNDQzZTg3ODU2MGMwYTg0NzRlOWFjODU1YTQxZWQ=
@@ -16,14 +16,11 @@ 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
- @server = match[:server]
20
- @project = match[:project]
21
- @repository_name = match[:repository_name]
22
19
 
23
- @remote_api_url = File.join("https://#{@server}", 'rest', 'api', '1.0', 'projects', @project, 'repos', @repository_name)
24
- @branch_permissions_url = File.join("https://#{@server}", 'rest', 'branch-permissions', '2.0', 'projects', @project, 'repos', @repository_name, 'restrictions')
25
- @branchring_model_url = File.join("https://#{@server}", 'rest', 'branch-utils', '1.0', 'projects', @project, 'repos', @repository_name)
26
- @pull_request_settings = File.join("https://#{@server}", 'rest', 'pullrequest-settings', '1.0', 'projects', @project, 'repos', @repository_name)
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])
27
24
 
28
25
  repository_information = nil
29
26
  RestClient::Request.new(
@@ -35,14 +32,13 @@ module Stash
35
32
  repository_information = JSON.parse(response.body)
36
33
  raise "Could not retrieve repository information - #{JSON::pretty_generate(repository_information)}" if !response.code.to_s.match(/^2\d{2}$/)
37
34
  end
38
- @ssh_url = repository_information['links']['clone'].select{|link| link['name'].match(/^ssh$/i)}.first['href']
39
35
 
40
36
  #If the repository is a fork, use it's forked source to get this information
41
- if repository_information['origin'] && config[:follow_fork]
42
- @project = repository_information['origin']['project']['key']
43
- @repository_name = repository_information['origin']['slug']
44
- @ssh_url = repository_information['origin']['links']['clone'].select{|link| link['name'].match(/^ssh$/i)}.first['href']
45
- end
37
+ repository_information = repository_information['origin'] if repository_information['origin'] && config[:follow_fork]
38
+ puts JSON::pretty_generate(repository_information)
39
+ @project = repository_information['project']['key']
40
+ @repository_name = repository_information['slug']
41
+ @ssh_url = repository_information['links']['clone'].select{|link| link['name'].match(/^ssh$/i)}.first['href']
46
42
  end
47
43
 
48
44
  SETTINGS_HOOKS_URL = File.join('settings', 'hooks')
@@ -61,7 +57,6 @@ module Stash
61
57
  raise "Could not configure hook: #{hook} - #{JSON::pretty_generate(JSON::parse(response.body))}" if !response.code.to_s.match(/^2\d{2}$/)
62
58
  end
63
59
  end
64
-
65
60
  RestClient::Request.new(
66
61
  :method => :put,
67
62
  :url => URI::encode("#{File.join(@remote_api_url, SETTINGS_HOOKS_URL)}/#{hook}/enabled"),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.28.0
4
+ version: 1.1.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warren Parad