aptly-api 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +4 -2
- data/lib/aptly/configuration.rb +46 -19
- data/lib/aptly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4366fc69e420aae0067501a98a0cc13de7e78b9
|
4
|
+
data.tar.gz: 34924e0d41b9f8c7779e7bd00aa63ae670acde88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd772f0145fef0826037da2b127d4c661aa939bde965355ae17626fccda320cd34e590819f0c7646d88ab2c6a002e97fbd3792b74159520b6b71bb6492ef8067
|
7
|
+
data.tar.gz: 262cb466331fdd8c08992174c8827604d2b0d26265de412927128e17059b11a5307120ab9676251e2af5c13e557432c364877dc57ac884a00cb05f9ac1c32aa5
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -28,8 +28,7 @@ Or install it yourself as:
|
|
28
28
|
require 'aptly'
|
29
29
|
|
30
30
|
Aptly.configure do |config|
|
31
|
-
config.
|
32
|
-
config.port = 8080
|
31
|
+
config.uri = URI::HTTP.build(host: 'localhost', port: 8080)
|
33
32
|
end
|
34
33
|
|
35
34
|
repo = Aptly::Repository.create('kewl-new-repo')
|
@@ -40,6 +39,9 @@ end
|
|
40
39
|
repo.publish('public-name', Distribution: 'wily', Architectures: %w(amd64 i386))
|
41
40
|
```
|
42
41
|
|
42
|
+
## Documentation
|
43
|
+
http://www.rubydoc.info/gems/aptly-api/Aptly/
|
44
|
+
|
43
45
|
## Development
|
44
46
|
|
45
47
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/aptly/configuration.rb
CHANGED
@@ -1,36 +1,63 @@
|
|
1
|
+
require 'rubygems/deprecate'
|
2
|
+
|
1
3
|
module Aptly
|
2
4
|
# Configuration.
|
3
5
|
class Configuration
|
6
|
+
extend Gem::Deprecate
|
7
|
+
|
8
|
+
# @!attribute uri
|
9
|
+
# @return [URI] the base URI for the API (http://localhost by default)
|
10
|
+
attr_accessor :uri
|
11
|
+
|
12
|
+
# Creates a new instance.
|
13
|
+
# @param uri see {#uri}
|
14
|
+
# @param host DEPRECATED use uri
|
15
|
+
# @param port DEPRECATED use uri
|
16
|
+
# @param path DEPRECATED use uri
|
17
|
+
def initialize(uri: URI::HTTP.build(host: 'localhost',
|
18
|
+
port: 80,
|
19
|
+
path: '/'),
|
20
|
+
host: nil, port: nil, path: nil)
|
21
|
+
@uri = uri unless host || port || path
|
22
|
+
return if @uri
|
23
|
+
@uri = fallback_uri(host, port, path)
|
24
|
+
end
|
25
|
+
|
4
26
|
# @!attribute host
|
27
|
+
# @deprecated use {#uri}
|
5
28
|
# @return [String] host name to talk to
|
6
|
-
attr_accessor :host
|
7
29
|
|
8
30
|
# @!attribute port
|
31
|
+
# @deprecated use {#uri}
|
9
32
|
# @return [Integer] port to talk to host to on
|
10
|
-
attr_accessor :port
|
11
33
|
|
12
34
|
# @!attribute path
|
35
|
+
# @deprecated use {#uri}
|
13
36
|
# @return [String] path to use (defaults to /)
|
14
|
-
attr_accessor :path
|
15
37
|
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
38
|
+
# Fake deprecated attributes and redirect them to @uri
|
39
|
+
[:host, :port, :path].each do |uri_attr|
|
40
|
+
define_method(uri_attr.to_s) do
|
41
|
+
@uri.send(uri_attr)
|
42
|
+
end
|
43
|
+
deprecate uri_attr, :uri, 2017, 1
|
44
|
+
define_method("#{uri_attr}=") do |x|
|
45
|
+
# Ruby < 2.3 does not manage to handle string ports, so we need
|
46
|
+
# to manually convert to integer.
|
47
|
+
@uri.send("#{uri_attr}=", uri_attr == :port ? safe_port(x) : x)
|
48
|
+
end
|
49
|
+
deprecate "#{uri_attr}=".to_sym, :uri, 2017, 1
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def safe_port(port)
|
55
|
+
port ? port.to_i : port
|
23
56
|
end
|
24
57
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
uri = URI.parse('')
|
29
|
-
uri.scheme = 'http'
|
30
|
-
uri.host = host
|
31
|
-
uri.port = port
|
32
|
-
uri.path = path
|
33
|
-
uri
|
58
|
+
def fallback_uri(host, port, path)
|
59
|
+
URI::HTTP.build(host: host || 'localhost', port: safe_port(port || 80),
|
60
|
+
path: path || '/')
|
34
61
|
end
|
35
62
|
end
|
36
63
|
end
|
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.5.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: 2016-
|
12
|
+
date: 2016-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|