aptlyapi 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/server.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93d7b13fdda599c52c66db1d7ea397e9d461ecd6
|
4
|
+
data.tar.gz: 4394ae85f2c9ed587126565593fc52dcae2e1064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 063a551bc31a73dd0b09b025e5cfaa910479331c755b44e8c9b1df2619b72dc503f46d7086c88201c0ddb4bfee74f424b6e27cf4d0bd8bf47eb825d1fb995df5
|
7
|
+
data.tar.gz: b05100cf0da1fe547eb8e85748a584382181b4b85c12820cc40c859fc8da082ab86f843c0e7cdbca4575cd07a74d6f8982e8d535b04b1622dd50d55613afaeb1
|
data/lib/server.rb
CHANGED
@@ -100,14 +100,14 @@ module AptlyAPI
|
|
100
100
|
# Publish a repo from +sources+ (hash of "Component/Name")
|
101
101
|
#
|
102
102
|
# TODO: There are bare minimum for the moment and will change
|
103
|
-
def publish(kind, sources, distribution, keyid, password)
|
103
|
+
def publish(kind, prefix, sources, distribution, keyid, password)
|
104
104
|
body = Hash.new
|
105
105
|
body.merge!({"SourceKind" => kind})
|
106
106
|
body.merge!({"Sources" => sources})
|
107
107
|
body.merge!({"Distribution" => distribution})
|
108
108
|
body.merge!({"ForceOverwrite" => true})
|
109
109
|
body.merge!({"Signing" => { "Batch" => true, "GpgKey" => keyid, "Passphrase" => password}})
|
110
|
-
return true if hpost(
|
110
|
+
return true if hpost("/api/publish/#{prefix.to_s}", body).between?(200, 299)
|
111
111
|
return false
|
112
112
|
end
|
113
113
|
|
@@ -115,11 +115,11 @@ module AptlyAPI
|
|
115
115
|
# Update a published repo
|
116
116
|
#
|
117
117
|
# TODO: There are bare minimum for the moment and will change
|
118
|
-
def publish_update(distribution, keyid, password)
|
118
|
+
def publish_update(prefix, distribution, keyid, password)
|
119
119
|
body = Hash.new
|
120
120
|
body.merge!({"ForceOverwrite" => true})
|
121
121
|
body.merge!({"Signing" => { "Batch" => true, "GpgKey" => keyid, "Passphrase" => password}})
|
122
|
-
return true if hput("/api/publish
|
122
|
+
return true if hput("/api/publish/#{prefix.to_s}/#{distribution.to_s}", body).between?(200, 299)
|
123
123
|
return false
|
124
124
|
end
|
125
125
|
|
@@ -137,7 +137,7 @@ module AptlyAPI
|
|
137
137
|
def hget(path)
|
138
138
|
request = Net::HTTP::Get.new("#{@server.path}#{path}")
|
139
139
|
response = @http.request(request)
|
140
|
-
if response.code.to_i
|
140
|
+
if !response.code.to_i.between?(200, 299)
|
141
141
|
return response.code.to_i
|
142
142
|
end
|
143
143
|
return JSON.parse(response.body)
|