nexus_api 1.5.0 → 2.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/Gemfile.lock +15 -15
- data/README.md +161 -14
- data/bin/test +2 -1
- data/lib/endpoints/assets.rb +1 -1
- data/lib/endpoints/components.rb +13 -13
- data/lib/endpoints/repositories.rb +131 -15
- data/lib/endpoints/search.rb +1 -1
- data/lib/endpoints/tags.rb +3 -3
- data/lib/nexus_api.rb +4 -4
- data/lib/nexus_api/nexus_connection.rb +3 -2
- data/lib/nexus_api/version.rb +1 -1
- data/lib/utilities/parameter_builder.rb +381 -41
- data/nexus_api.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 371514d3283ad019a0143c037000fd69763e0231981dd864c224ddfbdbe3924f
|
4
|
+
data.tar.gz: f3180660805e3e34f6499d8476fe32745ac5e6ee4b9630b1b4b052b84eb523dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a5948432eb3599b250ead5e7e42f3660790b461a6ca4f69fde81855e5e4aa286b56ba5e320a06d59856a3be224a241623429f213f2527833bb16ab21b0d3d4
|
7
|
+
data.tar.gz: 2d06ce5f2f4ae060772dd384fe93c89acc0e1b4806c6523f7ac6ece99bfe08d84872327fb11b3b98d649e1d07c3a7e8e365e7aefe653ca2eda70add7df10ed24
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,50 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
|
8
|
+
## [2.1.0](https://github.com/Cisco-AMP/nexus_api/compare/v2.0.1...v2.1.0) - 2020-10-13
|
9
|
+
### Added
|
10
|
+
- The ability to override HTTPS as the connection protocol for testing purposes
|
11
|
+
- The ability to specify a component name during upload that differs from the local file on disk
|
12
|
+
|
13
|
+
|
14
|
+
## [2.0.1](https://github.com/Cisco-AMP/nexus_api/compare/v2.0.0...v2.0.1) - 2020-09-08
|
15
|
+
### Security
|
16
|
+
- Use `rake` version `12.3.3` or later to avoid an [OS Command Injection](https://github.com/advisories/GHSA-jppv-gw3r-w3q8)
|
17
|
+
|
18
|
+
|
19
|
+
## [2.0.0](https://github.com/Cisco-AMP/nexus_api/compare/v1.6.1...v2.0.0) - 2020-07-27
|
20
|
+
### Added
|
21
|
+
- Fully implemented create methods for group, hosted, and proxy type repository in the following formats:
|
22
|
+
- docker
|
23
|
+
- maven
|
24
|
+
- npm
|
25
|
+
- pypi
|
26
|
+
- raw
|
27
|
+
- rubygems
|
28
|
+
- yum
|
29
|
+
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
- Method signature for `NexusAPI::API.create_repository_docker_hosted()`
|
33
|
+
- Method signature for `NexusAPI::API.create_repository_maven_hosted()`
|
34
|
+
- Method signature for `NexusAPI::API.create_repository_npm_hosted()`
|
35
|
+
- Method signature for `NexusAPI::API.create_repository_pypi_hosted()`
|
36
|
+
- Method signature for `NexusAPI::API.create_repository_raw_hosted()`
|
37
|
+
- Method signature for `NexusAPI::API.create_repository_rubygems_hosted()`
|
38
|
+
- Method signature for `NexusAPI::API.create_repository_yum_hosted()`
|
39
|
+
|
40
|
+
|
41
|
+
## [1.6.1](https://github.com/Cisco-AMP/nexus_api/compare/v1.6.0...v1.6.1) - 2020-07-20
|
42
|
+
### Fixed
|
43
|
+
- Parameters for tag creation were being JSON encoded twice resulting in data Nexus could not parse
|
44
|
+
|
45
|
+
|
46
|
+
## [1.6.0](https://github.com/Cisco-AMP/nexus_api/compare/v1.5.0...v1.6.0) - 2020-07-20
|
47
|
+
### Added
|
48
|
+
- `create_repository_raw_hosted()`
|
49
|
+
- `create_repository_rubygems_hosted()`
|
50
|
+
|
51
|
+
|
8
52
|
## [1.5.0](https://github.com/Cisco-AMP/nexus_api/compare/v1.4.1...v1.5.0) - 2020-06-10
|
9
53
|
### Added
|
10
54
|
- New methods around the `privileges` endpoint
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nexus_api (1.
|
4
|
+
nexus_api (2.1.0)
|
5
5
|
bundler (~> 2)
|
6
6
|
docker-api (~> 1.34.2)
|
7
7
|
dotenv (~> 2.7.5)
|
8
8
|
pry (~> 0.12.2)
|
9
|
-
rake (
|
9
|
+
rake (>= 12.3.3)
|
10
10
|
rest-client (~> 2.1.0)
|
11
11
|
thor (~> 0.20.3)
|
12
12
|
|
@@ -15,18 +15,18 @@ GEM
|
|
15
15
|
specs:
|
16
16
|
addressable (2.7.0)
|
17
17
|
public_suffix (>= 2.0.2, < 5.0)
|
18
|
-
coderay (1.1.
|
18
|
+
coderay (1.1.3)
|
19
19
|
crack (0.4.3)
|
20
20
|
safe_yaml (~> 1.0.0)
|
21
|
-
diff-lcs (1.
|
21
|
+
diff-lcs (1.4.4)
|
22
22
|
docile (1.3.2)
|
23
23
|
docker-api (1.34.2)
|
24
24
|
excon (>= 0.47.0)
|
25
25
|
multi_json
|
26
26
|
domain_name (0.5.20190701)
|
27
27
|
unf (>= 0.0.5, < 1.0.0)
|
28
|
-
dotenv (2.7.
|
29
|
-
excon (0.
|
28
|
+
dotenv (2.7.6)
|
29
|
+
excon (0.76.0)
|
30
30
|
hashdiff (1.0.1)
|
31
31
|
http-accept (1.7.0)
|
32
32
|
http-cookie (1.0.3)
|
@@ -35,13 +35,13 @@ GEM
|
|
35
35
|
mime-types (3.3.1)
|
36
36
|
mime-types-data (~> 3.2015)
|
37
37
|
mime-types-data (3.2020.0512)
|
38
|
-
multi_json (1.
|
38
|
+
multi_json (1.15.0)
|
39
39
|
netrc (0.11.0)
|
40
40
|
pry (0.12.2)
|
41
41
|
coderay (~> 1.1.0)
|
42
42
|
method_source (~> 0.9.0)
|
43
|
-
public_suffix (4.0.
|
44
|
-
rake (
|
43
|
+
public_suffix (4.0.6)
|
44
|
+
rake (13.0.1)
|
45
45
|
rest-client (2.1.0)
|
46
46
|
http-accept (>= 1.7.0, < 2.0)
|
47
47
|
http-cookie (>= 1.0.2, < 2.0)
|
@@ -51,17 +51,17 @@ GEM
|
|
51
51
|
rspec-core (~> 3.9.0)
|
52
52
|
rspec-expectations (~> 3.9.0)
|
53
53
|
rspec-mocks (~> 3.9.0)
|
54
|
-
rspec-core (3.9.
|
55
|
-
rspec-support (~> 3.9.
|
56
|
-
rspec-expectations (3.9.
|
54
|
+
rspec-core (3.9.2)
|
55
|
+
rspec-support (~> 3.9.3)
|
56
|
+
rspec-expectations (3.9.2)
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
58
|
rspec-support (~> 3.9.0)
|
59
|
-
rspec-mocks (3.9.
|
59
|
+
rspec-mocks (3.9.1)
|
60
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
61
|
rspec-support (~> 3.9.0)
|
62
|
-
rspec-support (3.9.
|
62
|
+
rspec-support (3.9.3)
|
63
63
|
safe_yaml (1.0.5)
|
64
|
-
simplecov (0.
|
64
|
+
simplecov (0.19.0)
|
65
65
|
docile (~> 1.1)
|
66
66
|
simplecov-html (~> 0.11)
|
67
67
|
simplecov-html (0.12.2)
|
data/README.md
CHANGED
@@ -5,10 +5,10 @@ A ruby gem that wraps the [Sonatype Nexus Repository Manager 3](https://help.son
|
|
5
5
|
## Latest Version Tested
|
6
6
|
Title | Value
|
7
7
|
---|---
|
8
|
-
**Version** | `3.
|
8
|
+
**Version** | `3.24.0-02`
|
9
9
|
**Edition** | `PRO`
|
10
|
-
**Build Revision** | `
|
11
|
-
**Build Timestamp** | `2020-03-
|
10
|
+
**Build Revision** | `302d6f23f1414581162efaf0fa7b4d81dbf9b251`
|
11
|
+
**Build Timestamp** | `2020-06-03-2332-51567`
|
12
12
|
|
13
13
|
|
14
14
|
## Installation
|
@@ -62,38 +62,170 @@ api = NexusAPI::API.new(
|
|
62
62
|
docker_pull_hostname: DOCKER_PULL_HOSTNAME, # Optional
|
63
63
|
docker_push_hostname: DOCKER_PUSH_HOSTNAME, # Optional
|
64
64
|
config: "team_configs/#{CONFIG_NAME}", # Optional
|
65
|
+
protocol: "https", # Optional
|
65
66
|
)
|
66
67
|
# NOTE: All Docker commands will fail if the docker hostnames are not initialized
|
67
68
|
|
69
|
+
|
70
|
+
# You can create various types of repositories in different formats
|
71
|
+
api.create_repository_docker_group(
|
72
|
+
name: REPOSITORY_NAME,
|
73
|
+
members: REPOSITORY_MEMBERS,
|
74
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
75
|
+
)
|
76
|
+
api.create_repository_docker_hosted(
|
77
|
+
name: REPOSITORY_NAME,
|
78
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
79
|
+
)
|
80
|
+
api.create_repository_docker_proxy(
|
81
|
+
name: REPOSITORY_NAME,
|
82
|
+
remote_url: URL_TO_PROXY,
|
83
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
84
|
+
)
|
85
|
+
|
86
|
+
api.create_repository_maven_group(
|
87
|
+
name: REPOSITORY_NAME,
|
88
|
+
members: REPOSITORY_MEMBERS,
|
89
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
90
|
+
)
|
91
|
+
api.create_repository_maven_hosted(
|
92
|
+
name: REPOSITORY_NAME,
|
93
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
94
|
+
)
|
95
|
+
api.create_repository_maven_proxy(
|
96
|
+
name: REPOSITORY_NAME,
|
97
|
+
remote_url: URL_TO_PROXY,
|
98
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
99
|
+
)
|
100
|
+
|
101
|
+
api.create_repository_npm_group(
|
102
|
+
name: REPOSITORY_NAME,
|
103
|
+
members: REPOSITORY_MEMBERS,
|
104
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
105
|
+
)
|
106
|
+
api.create_repository_npm_hosted(
|
107
|
+
name: REPOSITORY_NAME,
|
108
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
109
|
+
)
|
110
|
+
api.create_repository_npm_proxy(
|
111
|
+
name: REPOSITORY_NAME,
|
112
|
+
remote_url: URL_TO_PROXY,
|
113
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
114
|
+
)
|
115
|
+
|
116
|
+
api.create_repository_pypi_group(
|
117
|
+
name: REPOSITORY_NAME,
|
118
|
+
members: REPOSITORY_MEMBERS,
|
119
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
120
|
+
)
|
121
|
+
api.create_repository_pypi_hosted(
|
122
|
+
name: REPOSITORY_NAME,
|
123
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
124
|
+
)
|
125
|
+
api.create_repository_pypi_proxy(
|
126
|
+
name: REPOSITORY_NAME,
|
127
|
+
remote_url: URL_TO_PROXY,
|
128
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
129
|
+
)
|
130
|
+
|
131
|
+
api.create_repository_raw_group(
|
132
|
+
name: REPOSITORY_NAME,
|
133
|
+
members: REPOSITORY_MEMBERS,
|
134
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
135
|
+
)
|
136
|
+
api.create_repository_raw_hosted(
|
137
|
+
name: REPOSITORY_NAME,
|
138
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
139
|
+
)
|
140
|
+
api.create_repository_raw_proxy(
|
141
|
+
name: REPOSITORY_NAME,
|
142
|
+
remote_url: URL_TO_PROXY,
|
143
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
144
|
+
)
|
145
|
+
|
146
|
+
api.create_repository_rubygems_group(
|
147
|
+
name: REPOSITORY_NAME,
|
148
|
+
members: REPOSITORY_MEMBERS,
|
149
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
150
|
+
)
|
151
|
+
api.create_repository_rubygems_hosted(
|
152
|
+
name: REPOSITORY_NAME,
|
153
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
154
|
+
)
|
155
|
+
api.create_repository_rubygems_proxy(
|
156
|
+
name: REPOSITORY_NAME,
|
157
|
+
remote_url: URL_TO_PROXY,
|
158
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
159
|
+
)
|
160
|
+
|
161
|
+
api.create_repository_yum_group(
|
162
|
+
name: REPOSITORY_NAME,
|
163
|
+
members: REPOSITORY_MEMBERS,
|
164
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
165
|
+
)
|
166
|
+
api.create_repository_yum_hosted(
|
167
|
+
name: REPOSITORY_NAME,
|
168
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
169
|
+
)
|
170
|
+
api.create_repository_yum_proxy(
|
171
|
+
name: REPOSITORY_NAME,
|
172
|
+
remote_url: URL_TO_PROXY,
|
173
|
+
options: HASH_OF_REPOSITORY_OPTIONS # Optional
|
174
|
+
)
|
175
|
+
|
176
|
+
|
68
177
|
# You can query information through the list methods
|
69
|
-
api.
|
178
|
+
api.list_all_assets(repository: REPOSITORY_NAME)
|
179
|
+
api.list_assets(repository: REPOSITORY_NAME, paginate: BOOLEAN)
|
70
180
|
api.list_asset(id: ASSET_ID)
|
71
|
-
|
181
|
+
|
182
|
+
api.list_all_components(repository: REPOSITORY_NAME)
|
183
|
+
api.list_components(repository: REPOSITORY_NAME, paginate: BOOLEAN)
|
72
184
|
api.list_component(id: ASSET_ID)
|
185
|
+
|
73
186
|
api.list_privileges
|
187
|
+
api.list_privilege(privilege_id: ID)
|
188
|
+
|
74
189
|
api.list_repositories
|
75
190
|
api.list_repository_names
|
191
|
+
|
76
192
|
api.list_roles
|
193
|
+
api.list_role(id: ROLE_ID)
|
194
|
+
|
77
195
|
api.list_scripts
|
78
|
-
|
196
|
+
|
197
|
+
api.list_all_tags
|
198
|
+
api.list_tags(paginate: BOOLEAN)
|
199
|
+
|
79
200
|
api.list_users
|
80
201
|
|
202
|
+
|
81
203
|
# You can search for an asset by its name
|
82
204
|
# Optionally, you can pass in additional fields to filter the results
|
205
|
+
api.search_all_assets(
|
206
|
+
name: ASSET_NAME,
|
207
|
+
format: REPOSITORY_FORMAT, # Optional
|
208
|
+
repository: REPOSITORY_NAME, # Optional
|
209
|
+
sha1: SHA1, # Optional
|
210
|
+
version: VERSION, # Optional
|
211
|
+
)
|
212
|
+
# You can also paginate through the results if you want to do some additional filtering
|
83
213
|
api.search_asset(
|
84
214
|
name: ASSET_NAME,
|
85
215
|
format: REPOSITORY_FORMAT, # Optional
|
86
216
|
repository: REPOSITORY_NAME, # Optional
|
87
217
|
sha1: SHA1, # Optional
|
88
218
|
version: VERSION, # Optional
|
219
|
+
paginate: BOOLEAN # Optional
|
89
220
|
)
|
90
221
|
|
222
|
+
|
91
223
|
# The following endpoints will paginate:
|
92
224
|
# - list_assets
|
93
225
|
# - list_components
|
94
226
|
# - list_tags
|
95
227
|
# - search_asset
|
96
|
-
#
|
228
|
+
# Or you can use the following methods to automatically gather data from all pages for you:
|
97
229
|
# - list_all_assets
|
98
230
|
# - list_all_components
|
99
231
|
# - list_all_tags
|
@@ -106,9 +238,11 @@ set = Array.new.tap do |set|
|
|
106
238
|
end
|
107
239
|
end
|
108
240
|
|
241
|
+
|
109
242
|
# You can move all components that are tagged to a new destination
|
110
243
|
api.move_components_to(destination: DESTINATION, tag: TAG)
|
111
244
|
|
245
|
+
|
112
246
|
# You can download an asset by using its asset_id
|
113
247
|
# Optionally, you can rename the file on download
|
114
248
|
api.download(
|
@@ -116,50 +250,61 @@ api.download(
|
|
116
250
|
name: NEW_FILE_NAME, # Optional
|
117
251
|
)
|
118
252
|
|
253
|
+
|
119
254
|
# Different asset types require differing information to be uploaded
|
120
|
-
# Optionally, you can
|
255
|
+
# Optionally, you can:
|
256
|
+
# - tag the component, provided the tag already exists
|
257
|
+
# - specify a new component name to use when uploading into Nexus (instead of using the local file name)
|
121
258
|
api.upload_maven_component(
|
122
259
|
filename: MAVEN_FILENAME,
|
123
260
|
group_id: GROUP_ID,
|
124
261
|
artifact_id: ARTIFACT_ID,
|
125
262
|
version: VERSION,
|
126
263
|
repository: REPOSITORY_NAME,
|
127
|
-
tag: TAG,
|
264
|
+
tag: TAG, # Optional
|
265
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
128
266
|
)
|
129
267
|
api.upload_npm_component(
|
130
268
|
filename: NPM_FILENAME,
|
131
269
|
repository: REPOSITORY_NAME,
|
132
|
-
tag: TAG,
|
270
|
+
tag: TAG, # Optional
|
271
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
133
272
|
)
|
134
273
|
api.upload_pypi_component(
|
135
274
|
filename: PYPI_FILENAME,
|
136
275
|
repository: REPOSITORY_NAME,
|
137
|
-
tag: TAG,
|
276
|
+
tag: TAG, # Optional
|
277
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
138
278
|
)
|
139
279
|
api.upload_raw_component(
|
140
280
|
filename: NPM_FILENAME,
|
141
281
|
directory: PATH_IN_NEXUS,
|
142
282
|
repository: REPOSITORY_NAME,
|
143
|
-
tag: TAG,
|
283
|
+
tag: TAG, # Optional
|
284
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
144
285
|
)
|
145
286
|
api.upload_rubygems_component(
|
146
287
|
filename: RUBYGEMS_FILENAME,
|
147
288
|
repository: REPOSITORY_NAME,
|
148
|
-
tag: TAG,
|
289
|
+
tag: TAG, # Optional
|
290
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
149
291
|
)
|
150
292
|
api.upload_yum_component(
|
151
293
|
filename: YUM_FILENAME,
|
152
294
|
directory: PATH_IN_NEXUS,
|
153
295
|
repository: REPOSITORY_NAME,
|
154
|
-
tag: TAG,
|
296
|
+
tag: TAG, # Optional
|
297
|
+
upstream_filename: UPSTREAM_FILENAME, # Optional
|
155
298
|
)
|
156
299
|
|
300
|
+
|
157
301
|
# Docker is a special case and uses the local Docker daemon
|
158
302
|
# If this daemon is not installed and running these methods will fail
|
159
303
|
# NOTE: Docker login/logout is handled as part of the docker methods
|
160
304
|
api.download_docker_component(image: IMAGE_NAME, tag: DOCKER_TAG)
|
161
305
|
api.upload_docker_component(image: IMAGE_NAME, tag: DOCKER_TAG)
|
162
306
|
|
307
|
+
|
163
308
|
# You can create/delete tags and associate/disassociate them from components
|
164
309
|
# (we use the SHA1 rather than the file name because the Nexus search is inconsistent)
|
165
310
|
api.create_tag(name: TAG)
|
@@ -167,10 +312,12 @@ api.associate_tag(name: TAG, sha1: SHA1_SUM, repository: REPOSITORY_NAME)
|
|
167
312
|
api.delete_associated_tag(name: TAG, sha1: SHA1_SUM, repository: REPOSITORY_NAME)
|
168
313
|
api.delete_tag(name: TAG)
|
169
314
|
|
315
|
+
|
170
316
|
# You can query the Nexus status
|
171
317
|
api.status
|
172
318
|
api.status_writable
|
173
319
|
|
320
|
+
|
174
321
|
# Using an asset's URL you can gather its filesize as a String
|
175
322
|
api.get_asset_size(asset_url: URL)
|
176
323
|
```
|
data/bin/test
CHANGED
data/lib/endpoints/assets.rb
CHANGED
data/lib/endpoints/components.rb
CHANGED
@@ -7,7 +7,7 @@ module NexusAPI
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def list_all_components(repository: nil)
|
10
|
-
|
10
|
+
Array.new.tap do |components|
|
11
11
|
loop do
|
12
12
|
components.concat(list_components(repository: repository, paginate: true))
|
13
13
|
break unless paginate?
|
@@ -16,62 +16,62 @@ module NexusAPI
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# POST /service/rest/v1/components
|
19
|
-
def upload_maven_component(filename:, group_id:, artifact_id:, version:, repository: nil, tag: nil)
|
19
|
+
def upload_maven_component(filename:, group_id:, artifact_id:, version:, repository: nil, tag: nil, upstream_filename: nil)
|
20
20
|
repository ||= @team_config.maven_repository
|
21
21
|
parameters = {
|
22
22
|
'maven2.groupId' => group_id,
|
23
23
|
'maven2.artifactId' => artifact_id,
|
24
24
|
'maven2.version' => version,
|
25
|
-
'maven2.asset1' => File.open(filename, 'r'),
|
25
|
+
'maven2.asset1' => File.open(upstream_filename || filename, 'r'),
|
26
26
|
'maven2.asset1.extension' => filename.split('.').last,
|
27
27
|
}
|
28
28
|
parameters['maven2.tag'] = tag if tag
|
29
29
|
@connection.post(endpoint: "components?repository=#{repository}", parameters: parameters, headers: {})
|
30
30
|
end
|
31
31
|
|
32
|
-
def upload_npm_component(filename:, repository: nil, tag: nil)
|
32
|
+
def upload_npm_component(filename:, repository: nil, tag: nil, upstream_filename: nil)
|
33
33
|
repository ||= @team_config.npm_repository
|
34
34
|
parameters = {
|
35
|
-
'npm.asset' => File.open(filename, 'r'),
|
35
|
+
'npm.asset' => File.open(upstream_filename || filename, 'r'),
|
36
36
|
}
|
37
37
|
parameters['npm.tag'] = tag if tag
|
38
38
|
@connection.post(endpoint: "components?repository=#{repository}", parameters: parameters, headers: {})
|
39
39
|
end
|
40
40
|
|
41
|
-
def upload_pypi_component(filename:, repository: nil, tag: nil)
|
41
|
+
def upload_pypi_component(filename:, repository: nil, tag: nil, upstream_filename: nil)
|
42
42
|
repository ||= @team_config.pypi_repository
|
43
43
|
parameters = {
|
44
|
-
'pypi.asset' => File.open(filename, 'r'),
|
44
|
+
'pypi.asset' => File.open(upstream_filename || filename, 'r'),
|
45
45
|
}
|
46
46
|
parameters['pypi.tag'] = tag if tag
|
47
47
|
@connection.post(endpoint: "components?repository=#{repository}", parameters: parameters, headers: {})
|
48
48
|
end
|
49
49
|
|
50
|
-
def upload_raw_component(filename:, directory:, repository: nil, tag: nil)
|
50
|
+
def upload_raw_component(filename:, directory:, repository: nil, tag: nil, upstream_filename: nil)
|
51
51
|
repository ||= @team_config.raw_repository
|
52
52
|
parameters = {
|
53
53
|
'raw.directory' => directory,
|
54
|
-
'raw.asset1' => File.open(filename, 'r'),
|
54
|
+
'raw.asset1' => File.open(upstream_filename || filename, 'r'),
|
55
55
|
'raw.asset1.filename' => filename.split('/').last,
|
56
56
|
}
|
57
57
|
parameters['raw.tag'] = tag if tag
|
58
58
|
@connection.post(endpoint: "components?repository=#{repository}", parameters: parameters, headers: {})
|
59
59
|
end
|
60
60
|
|
61
|
-
def upload_rubygems_component(filename:, repository: nil, tag: nil)
|
61
|
+
def upload_rubygems_component(filename:, repository: nil, tag: nil, upstream_filename: nil)
|
62
62
|
repository ||= @team_config.rubygems_repository
|
63
63
|
parameters = {
|
64
|
-
'rubygems.asset' => File.open(filename, 'r'),
|
64
|
+
'rubygems.asset' => File.open(upstream_filename || filename, 'r'),
|
65
65
|
}
|
66
66
|
parameters['rubygems.tag'] = tag if tag
|
67
67
|
@connection.post(endpoint: "components?repository=#{repository}", parameters: parameters, headers: {})
|
68
68
|
end
|
69
69
|
|
70
|
-
def upload_yum_component(filename:, directory:, repository: nil, tag: nil)
|
70
|
+
def upload_yum_component(filename:, directory:, repository: nil, tag: nil, upstream_filename: nil)
|
71
71
|
repository ||= @team_config.yum_repository
|
72
72
|
parameters = {
|
73
73
|
'yum.directory' => directory,
|
74
|
-
'yum.asset' => File.open(filename, 'r'),
|
74
|
+
'yum.asset' => File.open(upstream_filename || filename, 'r'),
|
75
75
|
'yum.asset.filename' => filename.split('/').last,
|
76
76
|
}
|
77
77
|
parameters['yum.tag'] = tag if tag
|