aptly-api 0.9.1 → 0.11.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/.travis.yml +3 -6
- data/CHANGELOG.md +26 -0
- data/README.md +0 -2
- data/aptly-api.gemspec +6 -5
- data/lib/aptly/connection.rb +5 -2
- data/lib/aptly/publish.rb +11 -0
- data/lib/aptly/publishable.rb +3 -1
- data/lib/aptly/repository.rb +4 -2
- data/lib/aptly/snapshot.rb +5 -3
- data/lib/aptly/tmpname.rb +2 -0
- data/lib/aptly/version.rb +2 -1
- data/lib/aptly.rb +13 -4
- metadata +43 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 269fe5487b43c1f890f887f41d64112ed87fe5847b6de5f463be83ff46b3be8b
|
4
|
+
data.tar.gz: 1d15d78cdd86cb01865df47e3fec4f2de85a518e3773ac25d7794673bbb3afce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae1dc863c00addaacbb19586563ab84c60c33254a4b5c7eb0919c51977171812c5f1fc7d785dbb8a96d8877c3cf79e32a262d42b9b6a252a12ff7c10385843b4
|
7
|
+
data.tar.gz: acfb847b12356161c604e18a6bc69c38a34b408e6341eb4f334641474342803bbca8719e7e5fa3f18ff1cfebd73ef507ba68b493f6344a1d31d3cd867c51202d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.11]
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Faraday 2 support
|
8
|
+
- Ruby 3 support
|
9
|
+
|
10
|
+
## [0.10.1]
|
11
|
+
### Fixed
|
12
|
+
- Publishing endpoint escaping no longer creates invalid URIs when the Prefix
|
13
|
+
already contains underscores. Prefix=foo_bar is now correctly escaped to
|
14
|
+
foo__bar.
|
15
|
+
- excon 0.71 is now required as earlier versions had open security issues.
|
16
|
+
|
17
|
+
## [0.10.0]
|
18
|
+
### Added
|
19
|
+
- `PublishedRepository#from_repositories` publishes repository sources
|
20
|
+
into the same prefix.
|
21
|
+
- `Aptly.repo` is a new shorthand for `Aptly::Repository.get` to get
|
22
|
+
a repository by name when writing code interactively in IRB, or to
|
23
|
+
write slightly less verbose code.
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
- Documentation fixes.
|
27
|
+
- `Connection.HTTP_ACTIONS` is now properly marked private.
|
28
|
+
|
3
29
|
## [0.9.1]
|
4
30
|
### Fixed
|
5
31
|
- Hint at needing `noRemove: 1` as param when loop adding files (default
|
data/README.md
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
[](http://inch-ci.org/github/KDEJewellers/aptly-api)
|
4
4
|
[](https://travis-ci.org/KDEJewellers/aptly-api)
|
5
|
-
[](https://coveralls.io/github/KDEJewellers/aptly-api?branch=master)
|
6
|
-
[](https://gemnasium.com/KDEJewellers/aptly-api)
|
7
5
|
[](https://codeclimate.com/github/KDEJewellers/aptly-api)
|
8
6
|
|
9
7
|
## Installation
|
data/aptly-api.gemspec
CHANGED
@@ -19,15 +19,16 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler', '~>
|
23
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
24
23
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
24
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
26
25
|
spec.add_development_dependency 'rake-notes', '~> 0.2'
|
27
26
|
spec.add_development_dependency 'simplecov', '~> 0.11'
|
28
27
|
spec.add_development_dependency 'webmock', '~> 3.1'
|
29
28
|
spec.add_development_dependency 'yard', '~> 0.8'
|
30
29
|
|
31
|
-
spec.add_dependency 'faraday', '~> 0
|
32
|
-
spec.add_dependency '
|
30
|
+
spec.add_dependency 'faraday', '~> 2.0'
|
31
|
+
spec.add_dependency 'faraday-multipart', '~> 1.0'
|
32
|
+
spec.add_dependency 'faraday-excon', '~> 2.0'
|
33
|
+
spec.add_dependency 'excon'
|
33
34
|
end
|
data/lib/aptly/connection.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2022 Harald Sitter <sitter@kde.org>
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -14,6 +14,8 @@
|
|
14
14
|
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
15
15
|
|
16
16
|
require 'faraday'
|
17
|
+
require 'faraday/excon'
|
18
|
+
require 'faraday/multipart'
|
17
19
|
require 'json'
|
18
20
|
require 'uri'
|
19
21
|
|
@@ -31,9 +33,10 @@ module Aptly
|
|
31
33
|
private_constant :GETISH_ACTIONS
|
32
34
|
POSTISH_ACTIONS = %i[post put].freeze
|
33
35
|
private_constant :POSTISH_ACTIONS
|
34
|
-
HTTP_ACTIONS = GETISH_ACTIONS + POSTISH_ACTIONS
|
35
36
|
WRITE_ACTIONS = (POSTISH_ACTIONS + %i[delete]).freeze
|
36
37
|
private_constant :WRITE_ACTIONS
|
38
|
+
HTTP_ACTIONS = GETISH_ACTIONS + POSTISH_ACTIONS
|
39
|
+
private_constant :HTTP_ACTIONS
|
37
40
|
|
38
41
|
CODE_ERRORS = {
|
39
42
|
400 => Errors::ClientError,
|
data/lib/aptly/publish.rb
CHANGED
@@ -42,6 +42,17 @@ module Aptly
|
|
42
42
|
query: kwords)
|
43
43
|
JSON.parse(response.body).collect { |h| new(connection, h) }
|
44
44
|
end
|
45
|
+
|
46
|
+
# Publish an array of {Repository} to a prefix.
|
47
|
+
# @param repos [Array<Repository>] array of repositories to source
|
48
|
+
# @param prefix [String] the prefix to publish under (must be escaped see
|
49
|
+
# {.escape_prefix})
|
50
|
+
# @return [PublishedRepository] newly published repository
|
51
|
+
# @since 0.10.0
|
52
|
+
def from_repositories(repos, prefix, **kwords)
|
53
|
+
sources = repos.collect { |x| { Name: x.Name } }
|
54
|
+
Aptly.publish(sources, prefix, **kwords)
|
55
|
+
end
|
45
56
|
end
|
46
57
|
|
47
58
|
private
|
data/lib/aptly/publishable.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module Aptly
|
2
|
+
# Abstract "type" of all publishable entities. Publishable entities
|
3
|
+
# are everything that can act as Source for a PublishedRepository.
|
2
4
|
module Publishable
|
3
5
|
# Lists all PublishedRepositories self is published in. Namely self must
|
4
6
|
# be a source of the published repository in order for it to appear here.
|
5
7
|
# This method always returns an array of affected published repositories.
|
6
8
|
# If you use this method with a block it will additionally yield each
|
7
9
|
# published repository that would appear in the array, making it a shorthand
|
8
|
-
# for
|
10
|
+
# for Array#each.
|
9
11
|
# @yieldparam pub [PublishedRepository]
|
10
12
|
# @return [Array<PublishedRepository>]
|
11
13
|
def published_in
|
data/lib/aptly/repository.rb
CHANGED
@@ -95,10 +95,12 @@ module Aptly
|
|
95
95
|
|
96
96
|
# Convenience wrapper around {Aptly.publish}, publishing this repository
|
97
97
|
# locally and as only source of prefix.
|
98
|
-
# @param prefix [String] prefix to publish under (i.e. published repo name)
|
98
|
+
# @param prefix [String] prefix to publish under (i.e. published repo name).
|
99
|
+
# This must be escaped (see {Aptly.escape_prefix})
|
100
|
+
# @see Aptly.escape_prefix
|
99
101
|
# @return [PublishedRepository] newly published repository
|
100
102
|
def publish(prefix, **kwords)
|
101
|
-
Aptly.publish([{ Name: self.Name }], prefix, 'local', kwords)
|
103
|
+
Aptly.publish([{ Name: self.Name }], prefix, 'local', **kwords)
|
102
104
|
end
|
103
105
|
|
104
106
|
# Edit this repository's attributes as per the parameters.
|
data/lib/aptly/snapshot.rb
CHANGED
@@ -28,7 +28,7 @@ module Aptly
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Find differences between this and another snapshot
|
31
|
-
# @param [Snapshot] to diff against
|
31
|
+
# @param other_snapshot [Snapshot] to diff against
|
32
32
|
# @return [Array<Hash>] diff between the two snashots
|
33
33
|
def diff(other_snapshot)
|
34
34
|
endpoint = "/snapshots/#{self.Name}/diff/#{other_snapshot.Name}"
|
@@ -47,10 +47,12 @@ module Aptly
|
|
47
47
|
|
48
48
|
# Convenience wrapper around {Aptly.publish}, publishing this snapshot
|
49
49
|
# locally and as only source of prefix.
|
50
|
-
# @param prefix [String] prefix to publish under (i.e. published
|
50
|
+
# @param prefix [String] prefix to publish under (i.e. published repo name).
|
51
|
+
# This must be escaped (see {Aptly.escape_prefix})
|
52
|
+
# @see Aptly.escape_prefix
|
51
53
|
# @return [PublishedRepository] newly published repository
|
52
54
|
def publish(prefix, **kwords)
|
53
|
-
Aptly.publish([{ Name: self.Name }], prefix, 'snapshot', kwords)
|
55
|
+
Aptly.publish([{ Name: self.Name }], prefix, 'snapshot', **kwords)
|
54
56
|
end
|
55
57
|
|
56
58
|
class << self
|
data/lib/aptly/tmpname.rb
CHANGED
@@ -18,6 +18,8 @@ require 'English'
|
|
18
18
|
module Aptly
|
19
19
|
# Helper to generate temporary names
|
20
20
|
module TmpName
|
21
|
+
# Generate a random temporary directory name.
|
22
|
+
# @param prefix [String] arbitrary prefix string to start the name with
|
21
23
|
# @return [String] temporary directory name (only safe characters)
|
22
24
|
def self.dir(prefix)
|
23
25
|
format('%<prefix>s-%<time>s-%<pid>s-%<tid>s-%<rand>s',
|
data/lib/aptly/version.rb
CHANGED
data/lib/aptly.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Harald Sitter <sitter@kde.org>
|
1
|
+
# Copyright (C) 2015-2020 Harald Sitter <sitter@kde.org>
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -26,18 +26,27 @@ require 'aptly/tmpname'
|
|
26
26
|
# Aptly API
|
27
27
|
module Aptly
|
28
28
|
class << self
|
29
|
+
# Configures aptly in a block.
|
29
30
|
def configure
|
30
31
|
yield configuration
|
31
32
|
end
|
32
33
|
|
34
|
+
# The global configuration instance.
|
33
35
|
def configuration
|
34
36
|
@configuration ||= Configuration.new
|
35
37
|
end
|
36
38
|
|
39
|
+
# Convenience shorthand for {Repository#get}.
|
40
|
+
# @since 0.10.0
|
41
|
+
def repo(name, connection = Connection.new, **kwords)
|
42
|
+
Repository.get(name, connection, **kwords)
|
43
|
+
end
|
44
|
+
|
37
45
|
# Publish 1 or more sources into a public repository prefix.
|
38
46
|
# @param sources [Array<Repository>] array of repositories to source
|
39
|
-
# @param prefix [String]
|
40
|
-
#
|
47
|
+
# @param prefix [String] prefix to publish under (i.e. published repo name).
|
48
|
+
# This must be escaped (see {Aptly.escape_prefix})
|
49
|
+
# @see Aptly.escape_prefix
|
41
50
|
# @param source_kind [String] the source kind (local or snapshot)
|
42
51
|
# @return [PublishedRepository] newly published repository
|
43
52
|
def publish(sources, prefix = '', source_kind = 'local',
|
@@ -60,7 +69,7 @@ module Aptly
|
|
60
69
|
# @return [String] API-safe prefix notation
|
61
70
|
# @since 0.7.0
|
62
71
|
def escape_prefix(prefix_path)
|
63
|
-
prefix_path.
|
72
|
+
prefix_path.gsub('_', '__').tr('/', '_')
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptly-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harald Sitter
|
8
8
|
- Rohan Garg
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,28 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: coveralls
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0.8'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0.8'
|
27
|
+
version: '2.0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: minitest
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,14 +45,14 @@ dependencies:
|
|
59
45
|
requirements:
|
60
46
|
- - "~>"
|
61
47
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
48
|
+
version: '13.0'
|
63
49
|
type: :development
|
64
50
|
prerelease: false
|
65
51
|
version_requirements: !ruby/object:Gem::Requirement
|
66
52
|
requirements:
|
67
53
|
- - "~>"
|
68
54
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
55
|
+
version: '13.0'
|
70
56
|
- !ruby/object:Gem::Dependency
|
71
57
|
name: rake-notes
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,28 +115,56 @@ dependencies:
|
|
129
115
|
requirements:
|
130
116
|
- - "~>"
|
131
117
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0
|
118
|
+
version: '2.0'
|
133
119
|
type: :runtime
|
134
120
|
prerelease: false
|
135
121
|
version_requirements: !ruby/object:Gem::Requirement
|
136
122
|
requirements:
|
137
123
|
- - "~>"
|
138
124
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0
|
125
|
+
version: '2.0'
|
140
126
|
- !ruby/object:Gem::Dependency
|
141
|
-
name:
|
127
|
+
name: faraday-multipart
|
142
128
|
requirement: !ruby/object:Gem::Requirement
|
143
129
|
requirements:
|
144
130
|
- - "~>"
|
145
131
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0
|
132
|
+
version: '1.0'
|
147
133
|
type: :runtime
|
148
134
|
prerelease: false
|
149
135
|
version_requirements: !ruby/object:Gem::Requirement
|
150
136
|
requirements:
|
151
137
|
- - "~>"
|
152
138
|
- !ruby/object:Gem::Version
|
153
|
-
version: '0
|
139
|
+
version: '1.0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: faraday-excon
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '2.0'
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '2.0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: excon
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :runtime
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
154
168
|
description: REST client for the Aptly API
|
155
169
|
email:
|
156
170
|
- sitter@kde.org
|
@@ -186,7 +200,7 @@ homepage: https://github.com/KDEJewellers/aptly-api/
|
|
186
200
|
licenses:
|
187
201
|
- LGPL-3.0
|
188
202
|
metadata: {}
|
189
|
-
post_install_message:
|
203
|
+
post_install_message:
|
190
204
|
rdoc_options: []
|
191
205
|
require_paths:
|
192
206
|
- lib
|
@@ -201,9 +215,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
215
|
- !ruby/object:Gem::Version
|
202
216
|
version: '0'
|
203
217
|
requirements: []
|
204
|
-
|
205
|
-
|
206
|
-
signing_key:
|
218
|
+
rubygems_version: 3.3.13
|
219
|
+
signing_key:
|
207
220
|
specification_version: 4
|
208
221
|
summary: REST client for the Aptly API
|
209
222
|
test_files: []
|