aptly_cli 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTAwNWRjOTM2ODE3NzZhMDk1NWY1MzhlYTg4MzM4NDZhMThlZmEyMw==
4
+ ZjEwNWUyY2Y5MjliNmFjNDY0OTg2NWE5YzM0OGZhZDZhM2RhYTg1Ng==
5
5
  data.tar.gz: !binary |-
6
- MjA4MmZlMzg1ZmY1NjBjYWRkZTQ1MDhlOTI3Mzk1MGI1MTEyYjAxMA==
6
+ NTgxMTUzMDBkMGRhZTNlYTA4MTU4YWMxOWE4YWMzZmIyY2UxYjBhNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWI1YzExYzYzNGNjOTBhMjM3MzE3MmFmNjdhYTVlOTc3YmM1OWRhYTUwM2Q0
10
- YmI2ZWJiNWQyYmE1NzI2ZDk3MjFiMGFlZTE5ZDA1MDc4Y2UyNTExMGQxMWU3
11
- MmFkMDY2MTkyMWUxZGE1NmMwZjNiYzMwYjEzYzY2NTExNTk1MDA=
9
+ ZGYyODgwMGVkNTA1YmMwMGU3ZDExZWQ2ZDRlNGY3NDZhMmIzZGEyNDMwMDc4
10
+ YTAyN2JjYzZmMzIzZjY2ZjYxMjdiOGZlOGY2OGE4Njk0MjliYmY5ZmQxODk4
11
+ ODg3NjJmYzYwYmFhMDI3OWYwM2QxMzI4MWI5OGQ4NGQ0NWRkZjM=
12
12
  data.tar.gz: !binary |-
13
- OWJhYmViYTliNTdlMjJlZGFmNzEwZWYzZDVjYjExODMxMGFmYzE1M2M4Y2Rl
14
- N2ZhOGRhNmZlY2YxZjBhNjJjNWM3NGVjZWQ4MTg3ZDE0MDNkYmZhNjRmOTRk
15
- NDNlOWRmMjJjN2U4Y2M3NGM0YjE2NTVhNmQ3NzMxNmZhMGZhNjE=
13
+ MmVjYzFhZjc2NjVkNDg0YjcyYWFiYTM1NTA4Y2U5MTI5ZGRlMGJhMzUzNWQ4
14
+ NjQzODc2YTAyZDUwOGQyOGY5YTE0MzgxMjgwNTRmNzU0NzBiMDRhMDJmYzVj
15
+ ZWUyZTMyMzViMDM4ZDI3YmVhMDJhNDU0NDQ5MDNmNDQxY2U5Y2I=
data/bin/aptly-cli CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  require 'commander/import'
5
5
  require 'aptly_cli'
6
6
 
7
- program :version, '0.1.3'
7
+ program :version, '0.1.4'
8
8
  program :description, 'Aptly repository API client'
9
9
 
10
10
  command :file_list do |c|
@@ -260,6 +260,103 @@ command :publish_update do |c|
260
260
  end
261
261
  end
262
262
 
263
+ command :snapshot_create do |c|
264
+ c.syntax = 'aptly-cli snapshot_create [options]'
265
+ c.summary = 'Create snapshot of current local repository :name contents as new snapshot with name :snapname'
266
+ c.description = 'Create snapshot, require --name'
267
+ c.example 'Creating new snapshot megasoftware22-snap from megasoftware22 repo', 'aptly-cli snapshot_create --name megasoftware22-snap --repo meagsoftware22'
268
+ c.option '--name NAME', String, 'Name of new snapshot, required'
269
+ c.option '--repo REPO', String, 'Name of repo to snapshot'
270
+ c.option '--description DESCRIPTION', String, 'Set description for snapshot'
271
+ c.action do |args, options|
272
+ aptly_command = AptlyCli::AptlySnapshot.new
273
+ puts aptly_command.snapshot_create(options.name, options.repo, options.description)
274
+ end
275
+ end
276
+
277
+ command :snapshot_delete do |c|
278
+ c.syntax = 'aptly-cli snapshot_delete [options]'
279
+ c.summary = 'Delete snapshot. Snapshot can’t be deleted if it is published. aptly would refuse to delete snapshot if it has been used as source to create other snapshots, but that could be overridden with force parameter'
280
+ c.description = 'Delete snapshot, require --name'
281
+ c.example 'Deleting the snapshot megasoftware22', 'aptly-cli snapshot_delete --name megatronsoftware22'
282
+ c.example 'Deleting the snapshot megasoftware22 with force option', 'aptly-cli snapshot_delete --name megatronsoftware22 --force'
283
+ c.option '--name NAME', String, 'Local snapshot name, required'
284
+ c.option '--force', 'Force'
285
+ c.action do |args, options|
286
+ aptly_command = AptlyCli::AptlySnapshot.new
287
+ puts aptly_command.snapshot_delete(options.name, options.force)
288
+ end
289
+ end
290
+
291
+ command :snapshot_diff do |c|
292
+ c.syntax = 'aptly-cli snapshot_diff [options]'
293
+ c.summary = 'Calculate difference between two snapshots --name (left) and --withsnapshot (right).'
294
+ c.description = 'Calculate difference between two snapshots, require --name, require --withsnapshot'
295
+ c.example 'Show difference between megatronsoftware and rocksoftware snapshots', 'aptly-cli snapshot_diff --name megatronsoftware --withsnapshot rocksoftware'
296
+ c.option '--name NAME', String, 'Local snapshot name (left)'
297
+ c.option '--withsnapshot WITHSNAPSHOT', String, 'Snapshot to diff against (right)'
298
+ c.action do |args, options|
299
+ aptly_command = AptlyCli::AptlySnapshot.new
300
+ puts aptly_command.snapshot_diff(options.name, options.withsnapshot)
301
+ end
302
+ end
303
+
304
+ command :snapshot_list do |c|
305
+ c.syntax = 'aptly-cli snapshot_list [options]'
306
+ c.summary = 'Return list of all snapshots created in the system'
307
+ c.description = 'Return list of all snapshots created in the system'
308
+ c.example 'Return list of all snapshots created in the system', 'aptly-cli snapshot_list'
309
+ c.example 'Return list sorted by time', 'aptly-cli snapshot_list --sort time'
310
+ c.option '--sort', String, 'Set sort by'
311
+ c.action do |args, options|
312
+ aptly_command = AptlyCli::AptlySnapshot.new
313
+ puts aptly_command.snapshot_list(options.name, options.sort)
314
+ end
315
+ end
316
+
317
+ command :snapshot_search do |c|
318
+ c.syntax = 'aptly-cli snapshot_search [options]'
319
+ c.summary = 'List all packages in snapshot or perform search on snapshot contents and return result'
320
+ c.description = 'List all packages in snapshot or perform search'
321
+ c.example 'List all packages in snapshot megasoftware22-snap', 'aptly-cli snapshot_search --name megasoftware22-snap'
322
+ c.example 'List all packages in snapshot megasoftware22-snap with format set to details', 'aptly-cli snapshot_search --name megasoftware22-snap --format details'
323
+ c.example 'Search for package called nginx in snapshot megasoftware22-snap', 'aptly-cli snapshot_search --name megasoftware22-snap --query nginx'
324
+ c.option '--name NAME', String, 'Name of snapshot to search, required'
325
+ c.option '--query QUERY', String, 'Specific package to query'
326
+ c.option '--withdeps', 'Include package dependencies'
327
+ c.option '--format FORMAT', String, 'Format the respone of the snapshot search results, compact by default.'
328
+ c.action do |args, options|
329
+ aptly_command = AptlyCli::AptlySnapshot.new
330
+ puts aptly_command.snapshot_search(options.name, { :query => options.query, :format => options.format, :withdeps => options.withdeps })
331
+ end
332
+ end
333
+
334
+ command :snapshot_show do |c|
335
+ c.syntax = 'aptly-cli snapshot_show [options]'
336
+ c.summary = 'Get information about snapshot by name'
337
+ c.description = 'Get information about snapshot by name., require --name'
338
+ c.example 'Show snapshot information for repo named megatronsoftware', 'aptly-cli snapshot_show --name megatronsoftware'
339
+ c.option '--name NAME', String, 'Local snapshot name, required'
340
+ c.action do |args, options|
341
+ aptly_command = AptlyCli::AptlySnapshot.new
342
+ puts aptly_command.snapshot_show(options.name)
343
+ end
344
+ end
345
+
346
+ command :snapshot_update do |c|
347
+ c.syntax = 'aptly-cli snapshot_update [options]'
348
+ c.summary = 'Update snapshot’s description or name'
349
+ c.description = 'Update snapshot’s description or name, require --name'
350
+ c.example 'Updating the snapshot megasoftware22 to a new name', 'aptly-cli snapshot_update --name megasoftware22 --new_name meagsoftware12-12-13'
351
+ c.option '--name NAME', String, 'Local snapshot name, required'
352
+ c.option '--new_name NEWNAME', String, 'New name for the snapshot'
353
+ c.option '--description DESCRIPTION', String, 'Update description for snapshot'
354
+ c.action do |args, options|
355
+ aptly_command = AptlyCli::AptlySnapshot.new
356
+ puts aptly_command.snapshot_update(options.name, options.new_name, options.description)
357
+ end
358
+ end
359
+
263
360
  command :graph do |c|
264
361
  c.syntax = 'aptly-cli graph [options]'
265
362
  c.summary = 'Download a graph of repository layout. Current options are "svg" and "png"'
@@ -1,3 +1,3 @@
1
1
  module AptlyCli
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -12,10 +12,10 @@ module AptlyCli
12
12
  config = AptlyCli::AptlyLoad.new.configure_with("/etc/aptly-cli.conf")
13
13
  base_uri "http://#{config[:server]}:#{config[:port]}/api"
14
14
 
15
- def snapshot_delete(name, force=0)
15
+ def snapshot_delete(name, force=nil)
16
16
  uri = "/snapshots/#{name}"
17
17
 
18
- if force == 1
18
+ if force == true
19
19
  uri = uri + "?force=1"
20
20
  end
21
21
 
@@ -71,7 +71,7 @@ module AptlyCli
71
71
  @options[:query] = {q: "Name (~ #{search_options[:q]})" }
72
72
  end
73
73
 
74
- if search_options[:withDeps] == 1
74
+ if search_options[:withDeps] == true
75
75
  @options[:query] = {withDeps: "1" }
76
76
  end
77
77
 
@@ -84,13 +84,25 @@ module AptlyCli
84
84
  self.class.get(uri)
85
85
  end
86
86
 
87
- def snapshot_update(name, name_update, description=nil)
87
+ def snapshot_update(name, new_name, description=nil)
88
88
  uri = "/snapshots/#{name}"
89
89
 
90
+ unless new_name.nil?
91
+ snap_name = name
92
+ else
93
+ snap_name = new_name
94
+ end
95
+
96
+ @query = {}
97
+ @query[:Name] = snap_name
98
+
99
+ unless description.nil?
100
+ @query[:Description] = description
101
+ end
102
+ @query_json = @query.to_json
103
+
90
104
  begin
91
- self.class.put(uri, :query => { 'Name' => name_update,
92
- 'Description' => description }.to_json,
93
- :headers => {'Content-Type'=>'application/json'})
105
+ self.class.put(uri, :query => @query_json, :headers => {'Content-Type'=>'application/json'})
94
106
  rescue HTTPary::Error => e
95
107
  puts e
96
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptly_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler