cocoapods-azure-universal-packages 0.0.2 → 0.1.0

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: e051ebb86ce103f034a0f2f2fbe5f8594933c7561c0c8c39abda6b4c27172e28
4
- data.tar.gz: ca0ec59da4f7844774c6e4c962d8887619455e1889a3c6f1e6412705d8d59ed0
3
+ metadata.gz: ca06f2fa1acb83909c756ba68cad5e3e4d150c3dd9e19cc48f2e0411e2a75146
4
+ data.tar.gz: 293193c33ad6c5ab0965d376f8f4186ebb1d20c1154cd69f90bd5ac63d18786f
5
5
  SHA512:
6
- metadata.gz: e36296b576a1f5cdc4a5af2daf7ed5c33666ee338b44b04547eabff1e15131af7b6833605352a962fa584e38c7edcba070cbf7ac0a68e1a6c4823ea80d774e10
7
- data.tar.gz: b147236832cfbd6a9f7038f472c25abecd5089c1ef16abe370bc16693f42384fbeb40667c9b804bf933f1ac7de3ec9c1cef72629af8dae7debde16bcd673a4e0
6
+ metadata.gz: 11a6165328795b41d91fc765baae5050a42daf7e26a47647c96b8895fb034407c00602246fa1b3858987bf89df93e3fba0e8750d4824a0237f5632e35a98e5f9
7
+ data.tar.gz: 49308552fd05e90fe50c935ee085cf7c86cc045435c1dc8ac0ba8297f96a86919535e343dd9384898e60115d01be32d9d3818d054bc44297f51b0719d6c5caa2
data/README.md CHANGED
@@ -30,22 +30,21 @@ _Note:_ The plugin will install the Azure CLI [DevOps extension](https://github.
30
30
  Add to your Podfile
31
31
  ```Ruby
32
32
  plugin 'cocoapods-azure-universal-packages', {
33
- :base_url => '{{BASE_URL}}'
33
+ :organization => '{{ORGANIZATION_URL}}'
34
34
  }
35
35
  ```
36
- replacing `{{BASE_URL}}` with the base URL of your Azure Artifacts feed (for example, `https://pkgs.dev.azure.com/`).
36
+ replacing `{{ORGANIZATION_URL}}` with the base URL of your Azure Artifacts feed (for example: `https://pkgs.dev.azure.com/myorg`).
37
37
 
38
38
  Then, in your podspec set the pod's source to
39
39
  ```Ruby
40
40
  # For project scoped feeds:
41
- spec.source = { :http => '{{BASE_URL}}/{{ORGANIZATION}}/{{PROJECT}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
41
+ spec.source = { :http => '{{ORGANIZATION_URL}}/{{PROJECT}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
42
42
 
43
43
  # For organization scoped feeds:
44
- spec.source = { :http => '{{BASE_URL}}/{{ORGANIZATION}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
44
+ spec.source = { :http => '{{ORGANIZATION_URL}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
45
45
  ```
46
46
  where:
47
- - `{{BASE_URL}}` is the base URL you chose above
48
- - `{{ORGANIZATION}}` is the name of your feed's organization
47
+ - `{{ORGANIZATION_URL}}` is the URL of your feed's organization
49
48
  - `{{PROJECT}}` is the name of your feed's project (you must specify this only if your feed is a project scoped feed)
50
49
  - `{{PACKAGE}}` is the name of your universal package
51
50
  - `{{VERSION}}` is the version of your universal package
@@ -54,8 +53,8 @@ where:
54
53
 
55
54
  | Parameter | Description |
56
55
  | --------- | ----------- |
57
- | `base_url` | The base URL of the Azure Artifacts feed. Required unless `base_urls` is specified. |
58
- | `base_urls` | An array of base URLs of possible Azure Artifacts feeds. Required unless `base_url` is specified. |
56
+ | `organization` | The URL of the Azure Artifacts feed's orgnization. Required unless `organizations` is specified. |
57
+ | `organizations` | An array of URLs of possible Azure Artifacts feeds' organizations. Required unless `organization` is specified. |
59
58
  | `update_cli_extension` | Whether to update the Azure CLI DevOps extensions automatically. Default to `false`. |
60
59
 
61
60
  ## Run tests for this plugin
@@ -5,10 +5,10 @@ require 'cocoapods-downloader'
5
5
  module Pod
6
6
  module Downloader
7
7
 
8
- @azure_base_urls = []
8
+ @azure_organizations = []
9
9
 
10
10
  class << self
11
- attr_accessor :azure_base_urls
11
+ attr_accessor :azure_organizations
12
12
  end
13
13
 
14
14
  class Http
@@ -20,39 +20,49 @@ module Pod
20
20
  executable :az
21
21
 
22
22
  def download!
23
- aup_uri_template = Addressable::Template.new(
24
- '{scheme}://{host}/{organization}{/project}/_apis/packaging/feeds/{feed}/upack/packages/{package}/versions/{version}'
25
- )
26
- uri = Addressable::URI.parse(url)
27
- aup_uri_components = aup_uri_template.extract(uri)
23
+ # Check if the url matches any known Azure organization
24
+ organization = Downloader.azure_organizations.find { |org| url.to_s.start_with?(org) }
28
25
 
29
- if !aup_uri_components.nil? && Downloader.azure_base_urls.include?("#{aup_uri_components['scheme']}://#{aup_uri_components['host']}")
30
- download_azure_universal_package!(aup_uri_components)
26
+ if organization.nil?
27
+ aliased_download!
28
+ else
29
+ # Parse the url
30
+ organization.delete_suffix!('/')
31
+ aup_uri_template = Addressable::Template.new(
32
+ "#{organization}{/project}/_apis/packaging/feeds/{feed}/upack/packages/{package}/versions/{version}"
33
+ )
34
+ uri = Addressable::URI.parse(url)
35
+ aup_uri_components = aup_uri_template.extract(uri)
31
36
 
32
- # Extract the file if it's the only one in the package
33
- package_files = target_path.glob('*')
34
- if package_files.count == 1 && package_files.first.file?
35
- file = package_files.first
36
- file_type = begin
37
- case file.to_s
38
- when /\.zip$/
39
- :zip
40
- when /\.(tgz|tar\.gz)$/
41
- :tgz
42
- when /\.tar$/
43
- :tar
44
- when /\.(tbz|tar\.bz2)$/
45
- :tbz
46
- when /\.(txz|tar\.xz)$/
47
- :txz
48
- when /\.dmg$/
49
- :dmg
37
+ if !aup_uri_components.nil?
38
+ download_azure_universal_package!(aup_uri_components.merge({ 'organization' => organization }))
39
+
40
+ # Extract the file if it's the only one in the package
41
+ package_files = target_path.glob('*')
42
+ if package_files.count == 1 && package_files.first.file?
43
+ file = package_files.first
44
+ file_type = begin
45
+ case file.to_s
46
+ when /\.zip$/
47
+ :zip
48
+ when /\.(tgz|tar\.gz)$/
49
+ :tgz
50
+ when /\.tar$/
51
+ :tar
52
+ when /\.(tbz|tar\.bz2)$/
53
+ :tbz
54
+ when /\.(txz|tar\.xz)$/
55
+ :txz
56
+ when /\.dmg$/
57
+ :dmg
58
+ end
50
59
  end
60
+ extract_with_type(file, file_type) unless file_type.nil?
51
61
  end
52
- extract_with_type(file, file_type) unless file_type.nil?
62
+ else
63
+ Pod::UserInterface.warn("#{url} looks like a Azure artifact feed but it's malformed")
64
+ aliased_download!
53
65
  end
54
- else
55
- aliased_download!
56
66
  end
57
67
  end
58
68
 
@@ -62,7 +72,7 @@ module Pod
62
72
  'artifacts',
63
73
  'universal',
64
74
  'download',
65
- '--organization', "#{params['scheme']}://#{params['host']}/#{params['organization']}/",
75
+ '--organization', params['organization'],
66
76
  '--feed', params['feed'],
67
77
  '--name', params['package'],
68
78
  '--version', params['version'],
@@ -1,3 +1,3 @@
1
1
  module CocoapodsAzureUniversalPackages
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -18,11 +18,11 @@ module CocoapodsAzureUniversalPackages
18
18
  end
19
19
 
20
20
  # Now we can configure the downloader to use the Azure CLI for downloading pods from the given hosts
21
- azure_base_urls = options[:base_url] || options[:base_urls]
22
- raise Pod::Informative, 'You must configure at least one Azure base url' unless azure_base_urls
21
+ azure_organizations = options[:organization] || options[:organizations]
22
+ raise Pod::Informative, 'You must configure at least one Azure organization' unless azure_organizations
23
23
 
24
- Pod::Downloader.azure_base_urls = ([] << azure_base_urls).flatten.map { |url| url.delete_suffix('/') }
25
- raise Pod::Informative, 'You must configure at least one Azure base url' if Pod::Downloader.azure_base_urls.empty?
24
+ Pod::Downloader.azure_organizations = ([] << azure_organizations).flatten.map { |url| url.delete_suffix('/') }
25
+ raise Pod::Informative, 'You must configure at least one Azure organization' if Pod::Downloader.azure_organizations.empty?
26
26
  end
27
27
 
28
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-azure-universal-packages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-08 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.3
129
+ rubygems_version: 3.0.3.1
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: A CocoaPods plugin for downloading Universal Packages from Azure Artifacts