cocoapods-azure-universal-packages 0.0.1
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +80 -0
- data/lib/cocoapods-azure-universal-packages.rb +3 -0
- data/lib/cocoapods-azure-universal-packages/azure_universal_package_downloader.rb +60 -0
- data/lib/cocoapods-azure-universal-packages/gem_version.rb +3 -0
- data/lib/cocoapods-azure-universal-packages/pre_install.rb +29 -0
- data/lib/cocoapods_plugin.rb +1 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 207b72a97e6c7b283572863af8c19956f93b9e88bf12946661f90e7c55832a3c
|
4
|
+
data.tar.gz: 0c6f5ef6a710f9881ef7d62621e61b7b606266da852df8a4e124045d04fbb380
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b52f628384ebaddb4f8b1f88460bdd31c03267f9ce93ab746917e9bb26ec490a8c71a60b9fd3de68345184bf461c8a56e80c060f60cdf3f5face9d1929af6321
|
7
|
+
data.tar.gz: ab61da34afb943407abd8da58b3ad93ebb4cfabcf7c5d20813a46b41b86bf88b8db840d9473f2eee0c1236c2265754b7e16d4dddeb79d94821b1e7385fdcc906
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# CocoaPods Azure Universal Packages plugin
|
2
|
+
|
3
|
+
This project is a [CocoaPods](https://github.com/CocoaPods/CocoaPods) plugin that allows to dowload pods published as [Universal Packages](https://docs.microsoft.com/en-us/azure/devops/artifacts/quickstarts/universal-packages) in [Azure Artifacts](https://azure.microsoft.com/en-gb/services/devops/artifacts/) feeds.
|
4
|
+
|
5
|
+
## Getting started
|
6
|
+
|
7
|
+
Install the plugin by adding to your `Gemfile`
|
8
|
+
```Ruby
|
9
|
+
gem "cocoapods-azure-universal-packages"
|
10
|
+
```
|
11
|
+
|
12
|
+
Under the hood the plugin uses the [Azure CLI](https://aka.ms/azcli) to download the Universal Packages, you can install it running
|
13
|
+
```shell
|
14
|
+
brew update && brew install azure-cli
|
15
|
+
```
|
16
|
+
|
17
|
+
Finally, ensure that you are logged in using
|
18
|
+
```shell
|
19
|
+
az login
|
20
|
+
```
|
21
|
+
|
22
|
+
## How it works
|
23
|
+
|
24
|
+
The plugin replaces the default CocoaPods HTTP downloader when a pod source URL points to a universal package and it uses the Azure CLI to perform the download.
|
25
|
+
|
26
|
+
_Note:_ The plugin will install the Azure CLI [DevOps extension](https://github.com/Azure/azure-devops-cli-extension) automatically when running `pod install` or `pod update` for the first time.
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Add to your Podfile
|
31
|
+
```Ruby
|
32
|
+
plugin 'cocoapods-azure-universal-packages', {
|
33
|
+
:base_url => '{{BASE_URL}}'
|
34
|
+
}
|
35
|
+
```
|
36
|
+
replacing `{{BASE_URL}}` with the base URL of your Azure Artifacts feed (for example, `https://pkgs.dev.azure.com/`).
|
37
|
+
|
38
|
+
Then, in your podspec set the pod's source to
|
39
|
+
```Ruby
|
40
|
+
# For project scoped feeds:
|
41
|
+
spec.source = { :http => '{{BASE_URL}}/{{ORGANIZATION}}/{{PROJECT}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
|
42
|
+
|
43
|
+
# For organization scoped feeds:
|
44
|
+
spec.source = { :http => '{{BASE_URL}}/{{ORGANIZATION}}/_apis/packaging/feeds/{{FEED}}/upack/packages/{{PACKAGE}}/versions/{{VERSION}}' }
|
45
|
+
```
|
46
|
+
where:
|
47
|
+
- `{{BASE_URL}}` is the base URL you chose above
|
48
|
+
- `{{ORGANIZATION}}` is the name of your feed's organization
|
49
|
+
- `{{PROJECT}}` is the name of your feed's project (you must specify this only if your feed is a project scoped feed)
|
50
|
+
- `{{PACKAGE}}` is the name of your universal package
|
51
|
+
- `{{VERSION}}` is the version of your universal package
|
52
|
+
|
53
|
+
### Plugin parameters
|
54
|
+
|
55
|
+
| Parameter | Description |
|
56
|
+
| --------- | ----------- |
|
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. |
|
59
|
+
| `update_cli_extension` | Whether to update the Azure CLI DevOps extensions automatically. Default to `false`. |
|
60
|
+
|
61
|
+
## Run tests for this plugin
|
62
|
+
|
63
|
+
To run the tests, use
|
64
|
+
```shell
|
65
|
+
rake tests
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
71
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
72
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
73
|
+
|
74
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
75
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
76
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
77
|
+
|
78
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
79
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
80
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'addressable'
|
2
|
+
require 'cocoapods'
|
3
|
+
require 'cocoapods-downloader'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
module Downloader
|
7
|
+
|
8
|
+
@azure_base_urls = []
|
9
|
+
|
10
|
+
class << self
|
11
|
+
attr_accessor :azure_base_urls
|
12
|
+
end
|
13
|
+
|
14
|
+
class Http
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
alias_method :aliased_download!, :download!
|
19
|
+
|
20
|
+
executable :az
|
21
|
+
|
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)
|
28
|
+
|
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)
|
31
|
+
else
|
32
|
+
aliased_download!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def download_azure_universal_package!(params)
|
37
|
+
ui_sub_action("Downloading #{params['package']} (#{params['version']}) from Azure feed #{params['feed']} (#{[params['organization'], params['project']].compact.join('/')})") do
|
38
|
+
parameters = [
|
39
|
+
'artifacts',
|
40
|
+
'universal',
|
41
|
+
'download',
|
42
|
+
'--organization', "#{params['scheme']}://#{params['host']}/#{params['organization']}/",
|
43
|
+
'--feed', params['feed'],
|
44
|
+
'--name', params['package'],
|
45
|
+
'--version', params['version'],
|
46
|
+
'--path', target_path.to_s
|
47
|
+
]
|
48
|
+
|
49
|
+
# If it's a project scoped feed, we need to pass a few more arguments
|
50
|
+
parameters.push('--project', params['project'], '--scope', 'project') unless params['project'].nil?
|
51
|
+
|
52
|
+
# Fetch the Universal Package
|
53
|
+
az! parameters
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CocoapodsAzureUniversalPackages
|
2
|
+
class << self
|
3
|
+
|
4
|
+
Pod::HooksManager.register('cocoapods-azure-universal-packages', :pre_install) do |context, options|
|
5
|
+
CocoapodsAzureUniversalPackages.pre_install(options)
|
6
|
+
end
|
7
|
+
|
8
|
+
def pre_install(options)
|
9
|
+
# Check if the Azure CLI is installed
|
10
|
+
raise Pod::Informative, 'Unable to locate the Azure CLI. To learn more refer to https://aka.ms/azcli' unless Pod::Executable.which('az')
|
11
|
+
|
12
|
+
# Install the azure-devops extension if necessary
|
13
|
+
Pod::Executable.execute_command('az', ['extension', 'add', '--yes', '--name', 'azure-devops'], false)
|
14
|
+
|
15
|
+
# Optionally, update the azure-devops extension
|
16
|
+
if options.fetch(:update_cli_extension, false)
|
17
|
+
Pod::Executable.execute_command('az', ['extension', 'update', '--name', 'azure-devops'], false)
|
18
|
+
end
|
19
|
+
|
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
|
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?
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-azure-universal-packages'
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-azure-universal-packages
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Microsoft Corporation
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cocoapods-downloader
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: addressable
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mocha
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.11'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.11'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- LICENSE
|
104
|
+
- README.md
|
105
|
+
- lib/cocoapods-azure-universal-packages.rb
|
106
|
+
- lib/cocoapods-azure-universal-packages/azure_universal_package_downloader.rb
|
107
|
+
- lib/cocoapods-azure-universal-packages/gem_version.rb
|
108
|
+
- lib/cocoapods-azure-universal-packages/pre_install.rb
|
109
|
+
- lib/cocoapods_plugin.rb
|
110
|
+
homepage: https://github.com/microsoft/cocoapods-azure-universal-packages
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubygems_version: 3.0.3
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: A CocoaPods plugin for downloading Universal Packages from Azure Artifacts
|
133
|
+
feeds.
|
134
|
+
test_files: []
|