aptly-api 0.9.1 → 0.10.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 +12 -0
- data/lib/aptly.rb +10 -2
- data/lib/aptly/connection.rb +2 -1
- data/lib/aptly/publish.rb +11 -0
- data/lib/aptly/publishable.rb +3 -1
- data/lib/aptly/snapshot.rb +1 -1
- data/lib/aptly/tmpname.rb +2 -0
- data/lib/aptly/version.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef67a756d6233d6522678531b0b0b221303a19120b14d80c834e62ad04b061f3
|
4
|
+
data.tar.gz: bc8c50900970fcd89e47302d43f49e9b6b3c6fd34d008e8f34b9c473c2a71856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf61c4b10714a527b5cf699ca9f9e77dd0cee51ce8e8a23f8d6f59b70bdb136091a1c3422ac1c39093038188fc5d6ccb4ca91c84fd7f42c08be48f3aa2b6f541
|
7
|
+
data.tar.gz: 1baed9a8971546a8c41a8101e56ec07e66a4d8a7eb801b1fcb5ac844afdd6f9ed7f8e0ef46bde5cfd5d75598b6915909c6420cdb7ea7d32f44e47b599fc19a0c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.10.0]
|
4
|
+
### Added
|
5
|
+
- `PublishedRepository#from_repositories` publishes repository sources
|
6
|
+
into the same prefix.
|
7
|
+
- `Aptly.repo` is a new shorthand for `Aptly::Repository.get` to get
|
8
|
+
a repository by name when writing code interactively in IRB, or to
|
9
|
+
write slightly less verbose code.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- Documentation fixes.
|
13
|
+
- `Connection.HTTP_ACTIONS` is now properly marked private.
|
14
|
+
|
3
15
|
## [0.9.1]
|
4
16
|
### Fixed
|
5
17
|
- Hint at needing `noRemove: 1` as param when loop adding files (default
|
data/lib/aptly.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015 Harald Sitter <sitter@kde.org>
|
1
|
+
# Copyright (C) 2015-2018 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,26 @@ 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
47
|
# @param prefix [String] the prefix to publish under (must be escaped see
|
40
|
-
# {
|
48
|
+
# {.escape_prefix})
|
41
49
|
# @param source_kind [String] the source kind (local or snapshot)
|
42
50
|
# @return [PublishedRepository] newly published repository
|
43
51
|
def publish(sources, prefix = '', source_kind = 'local',
|
data/lib/aptly/connection.rb
CHANGED
@@ -31,9 +31,10 @@ module Aptly
|
|
31
31
|
private_constant :GETISH_ACTIONS
|
32
32
|
POSTISH_ACTIONS = %i[post put].freeze
|
33
33
|
private_constant :POSTISH_ACTIONS
|
34
|
-
HTTP_ACTIONS = GETISH_ACTIONS + POSTISH_ACTIONS
|
35
34
|
WRITE_ACTIONS = (POSTISH_ACTIONS + %i[delete]).freeze
|
36
35
|
private_constant :WRITE_ACTIONS
|
36
|
+
HTTP_ACTIONS = GETISH_ACTIONS + POSTISH_ACTIONS
|
37
|
+
private_constant :HTTP_ACTIONS
|
37
38
|
|
38
39
|
CODE_ERRORS = {
|
39
40
|
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/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}"
|
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
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.10.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: 2018-
|
12
|
+
date: 2018-03-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|