aptly-api 0.6.2 → 0.7.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 +16 -0
- data/lib/aptly.rb +13 -1
- data/lib/aptly/errors.rb +8 -0
- data/lib/aptly/publish.rb +1 -1
- data/lib/aptly/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9efbe6f74dd549cd105d0fcb98789e58ab3e4d79
|
4
|
+
data.tar.gz: 8f2ec5e7dc006199444dcb714c3aea3e34a0940b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c899648d86ab6eeddc83d38368958adf3c829a1881c148beca3bb3b40c48cec0f9232c4dc6f969fbf1dffad3215f6b15fb4c0c2bffe04918e2320f702e69b18
|
7
|
+
data.tar.gz: 29231774db283cfaad31859c0d6feb2355c010e1e8791ea9ec7df1d85d6b3388a2304db98b81175e054d306fecd279a9a028b355629adc8d0a0d3eca6ff445f8
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [0.7.0]
|
4
|
+
### Added
|
5
|
+
- Aptly.escape_prefix is a new helper method to turn prefixes into
|
6
|
+
REST API format.
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
- Aptly.publish and all publishing methods built on top of it now raise an
|
10
|
+
InvalidPrefixError when they encounter a forward-slash in the publishing
|
11
|
+
prefix. Aptly's REST API enforces prefixes to be encoded with _ as __ and
|
12
|
+
/ as _ unfortuantely as this is ambiguous we cannot automatically determine
|
13
|
+
if a prefix is encoded or unencoded. To retain backwards compatibility the
|
14
|
+
assumption is that is is encoded and if it clearly is not an error is raised.
|
15
|
+
For 1.0 this expectation is changing to assume the prefix is unencoded and
|
16
|
+
will be forcefully encoded!
|
data/lib/aptly.rb
CHANGED
@@ -35,11 +35,14 @@ module Aptly
|
|
35
35
|
|
36
36
|
# Publish 1 or more sources into a public repository prefix.
|
37
37
|
# @param sources [Array<Repository>] array of repositories to source
|
38
|
-
# @param prefix [String] the prefix to publish under
|
38
|
+
# @param prefix [String] the prefix to publish under (must be escaped see
|
39
|
+
# {#escape_prefix})
|
39
40
|
# @param source_kind [String] the source kind (local or snapshot)
|
40
41
|
# @return [PublishedRepository] newly published repository
|
41
42
|
def publish(sources, prefix = '', source_kind = 'local',
|
42
43
|
connection = Connection.new, **kwords)
|
44
|
+
# TODO: 1.0 break compat and invert the assertion to want unescaped
|
45
|
+
raise Errors::InvalidPrefixError if prefix.include?('/')
|
43
46
|
kwords = kwords.map { |k, v| [k.to_s.capitalize, v] }.to_h
|
44
47
|
options = kwords.merge(
|
45
48
|
SourceKind: source_kind,
|
@@ -49,5 +52,14 @@ module Aptly
|
|
49
52
|
body: JSON.generate(options))
|
50
53
|
PublishedRepository.new(connection, JSON.parse(response.body))
|
51
54
|
end
|
55
|
+
|
56
|
+
# Translates a pathish prefix (e.g. 'dev/unstable_x') to an API-safe prefix
|
57
|
+
# (e.g. 'dev_unstable__x')
|
58
|
+
# See prefix format description on https://www.aptly.info/doc/api/publish/
|
59
|
+
# @return [String] API-safe prefix notation
|
60
|
+
# @since 0.7.0
|
61
|
+
def escape_prefix(prefix_path)
|
62
|
+
prefix_path.tr('_', '__').tr('/', '_')
|
63
|
+
end
|
52
64
|
end
|
53
65
|
end
|
data/lib/aptly/errors.rb
CHANGED
@@ -67,5 +67,13 @@ module Aptly
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
# Raised when a publishing prefix contains a slash when it was expected to
|
72
|
+
# be in API-safe format.
|
73
|
+
# Unfortunately we cannot automatically coerce as the safe format has
|
74
|
+
# character overlap with an unsafe format (_ means something in both), so
|
75
|
+
# we'll expect the API consumer to only hand us suitable prefixes.
|
76
|
+
# https://www.aptly.info/doc/api/publish/
|
77
|
+
class InvalidPrefixError < StandardError; end
|
70
78
|
end
|
71
79
|
end
|
data/lib/aptly/publish.rb
CHANGED
data/lib/aptly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aptly-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harald Sitter
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- ".gitignore"
|
162
162
|
- ".rubocop.yml"
|
163
163
|
- ".travis.yml"
|
164
|
+
- CHANGELOG.md
|
164
165
|
- CODE_OF_CONDUCT.md
|
165
166
|
- COPYING.lib
|
166
167
|
- Gemfile
|
@@ -201,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
202
|
version: '0'
|
202
203
|
requirements: []
|
203
204
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.6.
|
205
|
+
rubygems_version: 2.6.11
|
205
206
|
signing_key:
|
206
207
|
specification_version: 4
|
207
208
|
summary: REST client for the Aptly API
|