aptlyapi 0.0.4 → 0.0.5
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/lib/server.rb +37 -0
- 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: 1bdd17febf17a5a828fd72ae08c5c9e01f35be81
|
|
4
|
+
data.tar.gz: 79805d2c202d78212cff0f0de437f558ab41bb1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2210dc4a32cc334243a2d8f4c1be76c0d1a1ab9cdb8b983c1093a37a3720a42a4729eec40a17ed878ba9c6a9c7261086a449eb365c5241aab51f857258b5f68
|
|
7
|
+
data.tar.gz: 7723a56da40a01891be7fbdca11ca00db113ce1550584a975de8020dbc02947ed3e56a3e8b895a97a2d3cf790dd6a0cc8913cf88273dde645c7ed1b92a3a81d4
|
data/lib/server.rb
CHANGED
|
@@ -96,6 +96,33 @@ module AptlyAPI
|
|
|
96
96
|
return true
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
##
|
|
100
|
+
# Publish a repo from +sources+ (array of "Component/Name")
|
|
101
|
+
#
|
|
102
|
+
# TODO: There are bare minimum for the moment and will change
|
|
103
|
+
def publish(kind, sources, distribution, keyid, password)
|
|
104
|
+
body = Hash.new
|
|
105
|
+
body.merge!({"SourceKind" => kind})
|
|
106
|
+
body.merge!({"Sources" => sources})
|
|
107
|
+
body.merge!({"Distribution" => distribution})
|
|
108
|
+
body.merge!({"ForceOverwrite" => true})
|
|
109
|
+
body.merge!({"Signing" => { "GpgKey" => keyid, "Passphrase" => password}})
|
|
110
|
+
return true if hpost('/api/publish', body) == 200
|
|
111
|
+
return false
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
##
|
|
115
|
+
# Update a published repo
|
|
116
|
+
#
|
|
117
|
+
# TODO: There are bare minimum for the moment and will change
|
|
118
|
+
def publish_update(distribution, keyid, password)
|
|
119
|
+
body = Hash.new
|
|
120
|
+
body.merge!({"ForceOverwrite" => true})
|
|
121
|
+
body.merge!({"Signing" => { "GpgKey" => keyid, "Passphrase" => password}})
|
|
122
|
+
return true if hput("/api/publish//#{distribution}", body) == 200
|
|
123
|
+
return false
|
|
124
|
+
end
|
|
125
|
+
|
|
99
126
|
##
|
|
100
127
|
# Compare two AptlyServer objects to see if they are identical
|
|
101
128
|
def ==(r)
|
|
@@ -126,6 +153,16 @@ module AptlyAPI
|
|
|
126
153
|
return response.code.to_i
|
|
127
154
|
end
|
|
128
155
|
|
|
156
|
+
##
|
|
157
|
+
# Put +data+ hash to +path+ as JSON
|
|
158
|
+
def hput(path, data)
|
|
159
|
+
request = Net::HTTP::Put.new("#{@server.path}#{path}")
|
|
160
|
+
request.add_field('Content-Type', 'application/json')
|
|
161
|
+
request.body = data.to_json
|
|
162
|
+
response = @http.request(request)
|
|
163
|
+
return response.code.to_i
|
|
164
|
+
end
|
|
165
|
+
|
|
129
166
|
##
|
|
130
167
|
# Sends HTTP delete call to +path+
|
|
131
168
|
def hdelete(path)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aptlyapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander von Gluck IV
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-08-
|
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Manage remote Aptly servers via the Aptly API
|
|
14
14
|
email: Alex.vonGluck@r1soft.com
|