lib/aptly_publish.rb in aptly_cli-0.2.6 vs lib/aptly_publish.rb in aptly_cli-0.2.7
- old
+ new
@@ -43,11 +43,19 @@
def publish_list
uri = '/publish'
self.class.get(uri)
end
- def parse_names(names, label_type)
+ def _parse_snapshots(names)
+ snapshots_to_publish = []
+ names.each_pair do |k, v|
+ snapshots_to_publish << { Component: v.to_s, Name: k.to_s }
+ end
+ return snapshots_to_publish
+ end
+
+ def _parse_names(names, label_type)
repos_to_publish = []
names = [names] if names.is_a? String
names.each do |k|
if k.include? '/'
repo, component = k.split('/')
@@ -80,11 +88,11 @@
end
def publish_repo(names, publish_options={})
uri = '/publish'
label_type = 'Name'
- repos = parse_names(names, label_type)
+ repos = _parse_names(names, label_type)
gpg_options = parse_gpg_options(@@available_gpg_options,
publish_options)
@body = {}
@body[:SourceKind] = publish_options[:sourcekind]
@body[:Sources] = repos
@@ -97,19 +105,16 @@
self.class.post(uri, headers: { 'Content-Type' => 'application/json' },
body: @body_json)
end
- def publish_update(snapshots=[], publish_options={})
+ def publish_update(publish_options={})
uri = '/publish'
- label_type = 'Snapshots'
gpg_options = parse_gpg_options(@@available_gpg_options, publish_options)
@body = {}
- unless snapshots.nil?
- snapshots = parse_names(snapshots, label_type)
- @body[:Snapshots] = snapshots
+ unless publish_options[:snapshots].nil?
+ @body[:Snapshots] = _parse_snapshots(publish_options[:snapshots])
end
-
unless gpg_options.empty?
@body[:Signing] = gpg_options
end
build_body(@@available_options_for_update, publish_options, @body)