aptly_cli 0.4.1 → 0.6.0
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 +5 -5
- data/.github/workflows/publish.yml +42 -0
- data/.travis.yml +4 -4
- data/README.md +0 -1
- data/aptly_cli.gemspec +2 -2
- data/bin/aptly-cli +2 -3
- data/lib/aptly_cli/version.rb +1 -1
- data/lib/aptly_cli.rb +1 -1
- data/lib/aptly_command.rb +41 -1
- data/lib/aptly_file.rb +12 -7
- data/lib/aptly_misc.rb +5 -4
- data/lib/aptly_package.rb +3 -3
- data/lib/aptly_publish.rb +9 -9
- data/lib/aptly_repo.rb +32 -36
- data/lib/aptly_snapshot.rb +13 -13
- metadata +13 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c4fb76b5a05ffe081ad5adac38b250f0566dc13b3f6d4b59d69d5cb9b444c7ad
|
|
4
|
+
data.tar.gz: 7f70ac81c20310b8b5ac91ad50a2f52e84dc9d028713c15184d612d97ddcc8d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c251302d85569e13f307f085a3864ecc706f730ff33438c37c530d08b1373eb196bafe1b5ae7f7172d29765131336893fc17ffaa387ab8eb21e2e2f6958322c1
|
|
7
|
+
data.tar.gz: dba94fca72f1cb48f6ef051a2d9af5123912435352c3057ad06d9394cf3c2637b0c5d496947b6ff6c73e620088b1aaac9c79d50f637d102cc33e3dd116c07d85
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
|
|
6
|
+
name: Ruby Gem
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
# Manually publish
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
# Alternatively, publish whenever changes are merged to the `main` branch.
|
|
12
|
+
push:
|
|
13
|
+
branches: [ master ]
|
|
14
|
+
pull_request:
|
|
15
|
+
branches: [ master ]
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
name: Build + Publish
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
packages: write
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v2
|
|
27
|
+
- name: Set up Ruby 2.6
|
|
28
|
+
uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
|
|
29
|
+
with:
|
|
30
|
+
ruby-version: 2.6
|
|
31
|
+
- run: bundle install
|
|
32
|
+
|
|
33
|
+
- name: Publish to RubyGems
|
|
34
|
+
run: |
|
|
35
|
+
mkdir -p $HOME/.gem
|
|
36
|
+
touch $HOME/.gem/credentials
|
|
37
|
+
chmod 0600 $HOME/.gem/credentials
|
|
38
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
39
|
+
gem build *.gemspec
|
|
40
|
+
gem push *.gem
|
|
41
|
+
env:
|
|
42
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -257,4 +257,3 @@ rake test # Run tests
|
|
|
257
257
|
|
|
258
258
|
- [ruby-aptly](https://github.com/ryanuber/ruby-aptly) - Ruby client library
|
|
259
259
|
- [aptly-web-ui](https://github.com/sdumetz/aptly-web-ui) - Web interface for aptly (JavaScript, React, Redux)
|
|
260
|
-
- [debweb](https://github.com/AutogrowSystems/debweb) - Another web interface (Ruby on Rails)
|
data/aptly_cli.gemspec
CHANGED
|
@@ -26,12 +26,12 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.required_ruby_version = '>= 2.0.0'
|
|
27
27
|
|
|
28
28
|
spec.add_development_dependency "bundler"
|
|
29
|
-
spec.add_development_dependency "rake", "
|
|
29
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
|
30
30
|
spec.add_development_dependency "minitest"
|
|
31
31
|
spec.add_development_dependency "coveralls"
|
|
32
32
|
spec.add_development_dependency "simplecov"
|
|
33
33
|
spec.add_development_dependency "rubocop"
|
|
34
34
|
|
|
35
|
-
spec.add_dependency
|
|
35
|
+
spec.add_dependency('httparty', '>= 0.16.2')
|
|
36
36
|
spec.add_dependency "commander", "~> 4.3"
|
|
37
37
|
end
|
data/bin/aptly-cli
CHANGED
|
@@ -115,7 +115,6 @@ command :repo_create do |c|
|
|
|
115
115
|
c.option '--default_distribution DISTRIBUTION', String, 'Default distribution when publishing from this local repo'
|
|
116
116
|
c.option '--default_component COMPONENT', String, 'Default component when publishing from this local repo'
|
|
117
117
|
c.action do |args, options|
|
|
118
|
-
puts options.name
|
|
119
118
|
config = AptlyCli::AptlyLoad.new.configure_with($config_file)
|
|
120
119
|
handle_global_options options
|
|
121
120
|
aptly_command = AptlyCli::AptlyRepo.new(config, options)
|
|
@@ -166,7 +165,7 @@ command :repo_edit do |c|
|
|
|
166
165
|
if options.comment
|
|
167
166
|
repo_options = { :Comment => options.comment.to_s }
|
|
168
167
|
end
|
|
169
|
-
puts aptly_command.repo_edit(options.name.to_s, repo_options)
|
|
168
|
+
puts aptly_command.repo_edit(options.name.to_s, repo_options || {})
|
|
170
169
|
end
|
|
171
170
|
end
|
|
172
171
|
|
|
@@ -501,7 +500,7 @@ command :graph do |c|
|
|
|
501
500
|
c.syntax = 'aptly-cli graph [options]'
|
|
502
501
|
c.summary = 'Download an svg or png graph of repository layout'
|
|
503
502
|
c.description = 'Download a graph of repository layout. Current options are "svg" and "png"'
|
|
504
|
-
c.example 'description', 'aptly-cli graph png > ~/repo_graph.png'
|
|
503
|
+
c.example 'description', 'aptly-cli graph --type png > ~/repo_graph.png'
|
|
505
504
|
c.option '--type GRAPH_TYPE', String, 'Type of graph to download, present options are png or svg'
|
|
506
505
|
c.action do |args, options|
|
|
507
506
|
config = AptlyCli::AptlyLoad.new.configure_with($config_file)
|
data/lib/aptly_cli/version.rb
CHANGED
data/lib/aptly_cli.rb
CHANGED
data/lib/aptly_command.rb
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module AptlyCli
|
|
2
|
+
class HttpError < StandardError; end
|
|
3
|
+
class HttpNotFoundError < HttpError; end
|
|
4
|
+
class HttpInternalServerError < HttpError; end
|
|
5
|
+
|
|
2
6
|
class AptlyCommand
|
|
3
|
-
include
|
|
7
|
+
include HTTParty
|
|
4
8
|
|
|
5
9
|
attr_accessor :config
|
|
6
10
|
def initialize(config, options = nil)
|
|
@@ -64,5 +68,41 @@ module AptlyCli
|
|
|
64
68
|
|
|
65
69
|
self.class.debug_output @config[:debug] ? $stdout : nil
|
|
66
70
|
end
|
|
71
|
+
|
|
72
|
+
def delete(path, options = {})
|
|
73
|
+
response = self.class.delete(path, options)
|
|
74
|
+
process_response(response)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def get(path, options = {})
|
|
78
|
+
response = self.class.get(path, options)
|
|
79
|
+
process_response(response)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def post(path, options = {})
|
|
83
|
+
response = self.class.post(path, options)
|
|
84
|
+
process_response(response)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def put(path, options = {})
|
|
88
|
+
response = self.class.put(path, options)
|
|
89
|
+
process_response(response)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def process_response(response)
|
|
93
|
+
json_response = JSON.parse response.body
|
|
94
|
+
|
|
95
|
+
raise "[Server] #{json_response['error']}" unless !json_response.is_a?(Hash) || json_response.dig('error').nil?
|
|
96
|
+
|
|
97
|
+
raise HttpNotFoundError, "#{json_response}" if response.code == 404
|
|
98
|
+
raise HttpInternalServerError, "#{json_response}" if response.code == 500
|
|
99
|
+
|
|
100
|
+
response
|
|
101
|
+
rescue JSON::ParserError
|
|
102
|
+
raise HttpNotFoundError, "#{json_response}" if response.code == 404
|
|
103
|
+
raise HttpInternalServerError, "#{json_response}" if response.code == 500
|
|
104
|
+
|
|
105
|
+
response
|
|
106
|
+
end
|
|
67
107
|
end
|
|
68
108
|
end
|
data/lib/aptly_file.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
|
|
6
6
|
module AptlyCli
|
|
7
7
|
# Uploading file into Aptly
|
|
@@ -10,7 +10,8 @@ module AptlyCli
|
|
|
10
10
|
|
|
11
11
|
def file_dir
|
|
12
12
|
uri = '/files'
|
|
13
|
-
|
|
13
|
+
response = get uri
|
|
14
|
+
response.parsed_response
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def file_get(file_uri)
|
|
@@ -19,20 +20,24 @@ module AptlyCli
|
|
|
19
20
|
else
|
|
20
21
|
'/files/' + file_uri
|
|
21
22
|
end
|
|
22
|
-
|
|
23
|
+
response = get uri
|
|
24
|
+
response.parsed_response
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
def file_delete(file_uri)
|
|
26
28
|
uri = '/files' + file_uri
|
|
27
|
-
|
|
29
|
+
response = delete uri
|
|
30
|
+
response.parsed_response
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
def file_post(post_options = {})
|
|
31
34
|
api_file_uri = '/files' + post_options[:file_uri].to_s
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
response = post(api_file_uri,
|
|
36
|
+
body: {
|
|
34
37
|
package: post_options[:package],
|
|
35
|
-
file: File.new(post_options[:local_file])
|
|
38
|
+
file: File.new(post_options[:local_file])
|
|
39
|
+
})
|
|
40
|
+
response.parsed_response
|
|
36
41
|
end
|
|
37
42
|
end
|
|
38
43
|
end
|
data/lib/aptly_misc.rb
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
require 'json'
|
|
6
6
|
|
|
7
7
|
module AptlyCli
|
|
8
8
|
# Misc Aptly Class
|
|
9
9
|
class AptlyMisc < AptlyCommand
|
|
10
|
-
include
|
|
10
|
+
include HTTParty
|
|
11
11
|
|
|
12
12
|
def get_graph(extension)
|
|
13
13
|
uri = "/graph.#{extension}"
|
|
14
|
-
|
|
14
|
+
get(uri)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def get_version
|
|
18
18
|
uri = '/version'
|
|
19
|
-
|
|
19
|
+
response = get(uri)
|
|
20
|
+
response.parsed_response
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
end
|
data/lib/aptly_package.rb
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
require 'json'
|
|
6
6
|
|
|
7
7
|
module AptlyCli
|
|
8
8
|
# Aptly Package API
|
|
9
9
|
class AptlyPackage < AptlyCommand
|
|
10
|
-
include
|
|
10
|
+
include HTTParty
|
|
11
11
|
|
|
12
12
|
def package_show(package_key)
|
|
13
13
|
uri = "/packages/#{package_key}"
|
|
14
|
-
|
|
14
|
+
get(uri)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
data/lib/aptly_publish.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
require 'json'
|
|
6
6
|
|
|
7
7
|
module AptlyCli
|
|
8
8
|
# :nodoc:
|
|
9
9
|
class AptlyPublish < AptlyCommand
|
|
10
|
-
include
|
|
10
|
+
include HTTParty
|
|
11
11
|
|
|
12
12
|
@@available_gpg_options = [:skip, :batch, :gpgKey, :keyring, :secretKeyring,
|
|
13
13
|
:passphrase, :passphraseFile]
|
|
@@ -26,12 +26,12 @@ module AptlyCli
|
|
|
26
26
|
|
|
27
27
|
uri += "/#{publish_options[:distribution]}"
|
|
28
28
|
uri += '?force=1' if publish_options[:force] == true
|
|
29
|
-
|
|
29
|
+
delete(uri)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def publish_list
|
|
33
33
|
uri = '/publish'
|
|
34
|
-
|
|
34
|
+
get(uri)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def _parse_snapshots(names)
|
|
@@ -92,8 +92,8 @@ module AptlyCli
|
|
|
92
92
|
|
|
93
93
|
@body_json = @body.to_json
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
body
|
|
95
|
+
post(uri, :headers => { 'Content-Type' => 'application/json' },
|
|
96
|
+
:body => @body_json)
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def publish_update(publish_options={})
|
|
@@ -112,14 +112,14 @@ module AptlyCli
|
|
|
112
112
|
uri += if publish_options[:prefix]
|
|
113
113
|
"/#{publish_options[:prefix]}"
|
|
114
114
|
else
|
|
115
|
-
'
|
|
115
|
+
'/:.'
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
uri += "/#{publish_options[:distribution]}"
|
|
119
119
|
|
|
120
120
|
@body_json = @body.to_json
|
|
121
|
-
|
|
122
|
-
body
|
|
121
|
+
put(uri, :headers => { 'Content-Type' => 'application/json' },
|
|
122
|
+
:body => @body_json)
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
end
|
data/lib/aptly_repo.rb
CHANGED
|
@@ -1,97 +1,91 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
require 'json'
|
|
6
6
|
require 'uri'
|
|
7
7
|
|
|
8
8
|
module AptlyCli
|
|
9
9
|
# Aptly class to work with Repo API
|
|
10
10
|
class AptlyRepo < AptlyCommand
|
|
11
|
-
include
|
|
11
|
+
include HTTParty
|
|
12
12
|
|
|
13
13
|
def repo_create(repo_options = { name: nil,
|
|
14
14
|
comment: nil,
|
|
15
15
|
DefaultDistribution: nil,
|
|
16
16
|
DefaultComponent: nil })
|
|
17
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
18
|
+
|
|
17
19
|
uri = '/repos'
|
|
18
20
|
name = repo_options[:name]
|
|
19
21
|
comment = repo_options[:comment]
|
|
20
22
|
default_distribution = repo_options[:DefaultDistribution]
|
|
21
23
|
default_component = repo_options[:DefaultComponent]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
post(uri,
|
|
25
|
+
:body =>
|
|
24
26
|
{ 'Name' => name, 'Comment' => comment,
|
|
25
27
|
'DefaultDistribution' => default_distribution,
|
|
26
28
|
'DefaultComponent' => default_component }.to_json,
|
|
27
|
-
headers
|
|
29
|
+
:headers => { 'Content-Type' => 'application/json' })
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def repo_delete(repo_options = { name: nil, force: nil })
|
|
33
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
34
|
+
|
|
31
35
|
uri = '/repos/' + repo_options[:name]
|
|
32
36
|
uri += '?force=1' if repo_options[:force] == true
|
|
33
|
-
|
|
37
|
+
delete(uri)
|
|
34
38
|
end
|
|
35
39
|
|
|
36
|
-
def repo_edit(name, repo_options
|
|
37
|
-
|
|
38
|
-
repo_value = ''
|
|
39
|
-
uri = '/repos/' + name unless name.nil?
|
|
40
|
-
repo_options.each do |k, v|
|
|
41
|
-
repo_option = k
|
|
42
|
-
repo_value = v
|
|
43
|
-
end
|
|
40
|
+
def repo_edit(name, repo_options)
|
|
41
|
+
raise ArgumentError, 'Repository name is required' if name.nil? || name.empty?
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
uri = "/repos/#{name}"
|
|
44
|
+
|
|
45
|
+
put(uri, :body => repo_options.to_json,
|
|
46
|
+
:headers => { 'Content-Type' => 'application/json' })
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def repo_list
|
|
50
50
|
uri = '/repos'
|
|
51
|
-
|
|
51
|
+
get(uri)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def repo_package_add(repo_options, packages)
|
|
55
|
-
if
|
|
56
|
-
raise ArgumentError.new('Must pass a repository name')
|
|
57
|
-
end
|
|
55
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
58
56
|
|
|
59
57
|
uri = '/repos/' + repo_options[:name] + '/packages'
|
|
60
|
-
|
|
58
|
+
post(
|
|
61
59
|
uri,
|
|
62
|
-
body
|
|
63
|
-
headers
|
|
60
|
+
:body => { PackageRefs: packages }.to_json,
|
|
61
|
+
:headers => { 'Content-Type' => 'application/json' }
|
|
64
62
|
)
|
|
65
63
|
end
|
|
66
64
|
|
|
67
65
|
def repo_package_delete(repo_options, packages)
|
|
68
|
-
if
|
|
69
|
-
raise ArgumentError.new('Must pass a repository name')
|
|
70
|
-
end
|
|
66
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
71
67
|
|
|
72
68
|
uri = '/repos/' + repo_options[:name] + '/packages'
|
|
73
|
-
|
|
69
|
+
delete(
|
|
74
70
|
uri,
|
|
75
|
-
body
|
|
76
|
-
headers
|
|
71
|
+
:body => { PackageRefs: packages }.to_json,
|
|
72
|
+
:headers => { 'Content-Type' => 'application/json' }
|
|
77
73
|
)
|
|
78
74
|
end
|
|
79
75
|
|
|
80
76
|
def repo_package_query(repo_options = { name: nil, query: nil,
|
|
81
77
|
with_deps: false,
|
|
82
78
|
format: nil })
|
|
83
|
-
if repo_options[:name].nil?
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
uri = '/repos/' + repo_options[:name] + '/packages'
|
|
87
|
-
end
|
|
79
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
80
|
+
|
|
81
|
+
uri = '/repos/' + repo_options[:name] + '/packages'
|
|
88
82
|
|
|
89
83
|
qs_hash = {}
|
|
90
84
|
qs_hash['q'] = repo_options[:query] if repo_options[:query]
|
|
91
85
|
qs_hash['format'] = repo_options[:format] if repo_options[:format]
|
|
92
86
|
qs_hash['withDeps'] = 1 if repo_options[:with_deps]
|
|
93
87
|
uri += '?' + URI.encode_www_form(qs_hash) if qs_hash
|
|
94
|
-
|
|
88
|
+
get uri
|
|
95
89
|
end
|
|
96
90
|
|
|
97
91
|
def repo_show(name)
|
|
@@ -100,11 +94,13 @@ module AptlyCli
|
|
|
100
94
|
else
|
|
101
95
|
'/repos/' + name
|
|
102
96
|
end
|
|
103
|
-
|
|
97
|
+
get uri
|
|
104
98
|
end
|
|
105
99
|
|
|
106
100
|
def repo_upload(repo_options = { name: nil, dir: nil, file: nil,
|
|
107
101
|
noremove: false, forcereplace: false })
|
|
102
|
+
raise ArgumentError, 'Repository name is required' if repo_options[:name].nil? || repo_options[:name].empty?
|
|
103
|
+
|
|
108
104
|
name = repo_options[:name]
|
|
109
105
|
dir = repo_options[:dir]
|
|
110
106
|
file = repo_options[:file]
|
data/lib/aptly_snapshot.rb
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
require 'aptly_cli/version'
|
|
2
2
|
require 'aptly_command'
|
|
3
3
|
require 'aptly_load'
|
|
4
|
-
require '
|
|
4
|
+
require 'httparty'
|
|
5
5
|
require 'json'
|
|
6
6
|
|
|
7
7
|
module AptlyCli
|
|
8
8
|
# Aptly class to work with Snapshot API
|
|
9
9
|
class AptlySnapshot < AptlyCommand
|
|
10
|
-
include
|
|
10
|
+
include HTTParty
|
|
11
11
|
|
|
12
12
|
def snapshot_delete(name, force=nil)
|
|
13
13
|
uri = "/snapshots/#{name}"
|
|
14
14
|
uri += '?force=1' if force == true
|
|
15
|
-
|
|
15
|
+
delete(uri)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def snapshot_list(sort=nil)
|
|
19
19
|
uri = '/snapshots'
|
|
20
20
|
uri += "?sort=#{sort}" if sort
|
|
21
|
-
|
|
21
|
+
get(uri)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def snapshot_create(name, repo, description=nil)
|
|
25
25
|
# Build uri to create snapshot, requires name of snap and name of repo
|
|
26
26
|
uri = "/repos/#{repo}/" + 'snapshots'
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
post(uri, :body =>
|
|
29
29
|
{ 'Name' => name,
|
|
30
30
|
'Description' => description }.to_json,
|
|
31
|
-
headers
|
|
31
|
+
:headers => { 'Content-Type' => 'application/json' })
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def snapshot_create_ref(name, description=nil,
|
|
35
35
|
sourcesnapshots=[], packagerefs=[])
|
|
36
36
|
uri = '/snapshots'
|
|
37
37
|
begin
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
post(uri,
|
|
39
|
+
:body => { 'Name' => name, 'Description' => description,
|
|
40
40
|
'SourceSnapshots' => sourcesnapshots,
|
|
41
41
|
'PackageRefs' => packagerefs }.to_json,
|
|
42
|
-
headers
|
|
42
|
+
:headers => { 'Content-Type' => 'application/json' })
|
|
43
43
|
rescue HTTParty::Error => e
|
|
44
44
|
return e
|
|
45
45
|
end
|
|
@@ -47,7 +47,7 @@ module AptlyCli
|
|
|
47
47
|
|
|
48
48
|
def snapshot_diff(name, with_snapshot)
|
|
49
49
|
uri = "/snapshots/#{name}/diff/#{with_snapshot}"
|
|
50
|
-
|
|
50
|
+
get(uri)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def snapshot_search(name, search_options={})
|
|
@@ -63,12 +63,12 @@ module AptlyCli
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
@options[:query] = { withDeps: '1' } if search_options[:withDeps] == true
|
|
66
|
-
|
|
66
|
+
get(uri, @options)
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def snapshot_show(name)
|
|
70
70
|
uri = "/snapshots/#{name}"
|
|
71
|
-
|
|
71
|
+
get(uri)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def snapshot_update(name, new_name, description=nil)
|
|
@@ -83,7 +83,7 @@ module AptlyCli
|
|
|
83
83
|
@query[:Description] = description unless description.nil?
|
|
84
84
|
@query_json = @query.to_json
|
|
85
85
|
begin
|
|
86
|
-
|
|
86
|
+
put(uri, :body => @query_json, :headers =>
|
|
87
87
|
{ 'Content-Type' => 'application/json' })
|
|
88
88
|
rescue HTTParty::Error => e
|
|
89
89
|
puts e
|
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.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zane
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -28,16 +28,16 @@ dependencies:
|
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 12.3.3
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 12.3.3
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: minitest
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,19 +95,19 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: httparty
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.
|
|
103
|
+
version: 0.16.2
|
|
104
104
|
type: :runtime
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.
|
|
110
|
+
version: 0.16.2
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: commander
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -130,6 +130,7 @@ executables:
|
|
|
130
130
|
extensions: []
|
|
131
131
|
extra_rdoc_files: []
|
|
132
132
|
files:
|
|
133
|
+
- ".github/workflows/publish.yml"
|
|
133
134
|
- ".gitignore"
|
|
134
135
|
- ".hound.yml"
|
|
135
136
|
- ".rubocop.yml"
|
|
@@ -177,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
178
|
- !ruby/object:Gem::Version
|
|
178
179
|
version: '0'
|
|
179
180
|
requirements: []
|
|
180
|
-
|
|
181
|
-
rubygems_version: 2.4.8
|
|
181
|
+
rubygems_version: 3.0.3.1
|
|
182
182
|
signing_key:
|
|
183
183
|
specification_version: 4
|
|
184
184
|
summary: Command line client to interact with Aptly package management system
|