aptly_cli 0.6.0 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4fb76b5a05ffe081ad5adac38b250f0566dc13b3f6d4b59d69d5cb9b444c7ad
4
- data.tar.gz: 7f70ac81c20310b8b5ac91ad50a2f52e84dc9d028713c15184d612d97ddcc8d6
3
+ metadata.gz: 631a350ac41c500d10dbd41f2f220cbba0e94982aded5c0c4d086e462f8cfbd8
4
+ data.tar.gz: 4e60257f19662245279baae1b61b62e53339b8852554c3a86b73cffe8156495f
5
5
  SHA512:
6
- metadata.gz: c251302d85569e13f307f085a3864ecc706f730ff33438c37c530d08b1373eb196bafe1b5ae7f7172d29765131336893fc17ffaa387ab8eb21e2e2f6958322c1
7
- data.tar.gz: dba94fca72f1cb48f6ef051a2d9af5123912435352c3057ad06d9394cf3c2637b0c5d496947b6ff6c73e620088b1aaac9c79d50f637d102cc33e3dd116c07d85
6
+ metadata.gz: c0e03eea787a49f9ac8b1fd1b24ca5b3b636c880ced22f86bf7e84ca6c51c142df68dbfa3bb2d0aa8625d5f8a1fe1802ac2e4162d0d52d65d6d85b3f188eaa03
7
+ data.tar.gz: 2ca87e8d833e77ee657a09c19160c73c6c016609dead38e2070eb0bb8707516301a905d7023cd8bbcdcad96fa6a12223128260d9555365756905ff23416fb982
data/bin/aptly-cli CHANGED
@@ -156,16 +156,13 @@ command :repo_edit do |c|
156
156
  config = AptlyCli::AptlyLoad.new.configure_with($config_file)
157
157
  handle_global_options options
158
158
  aptly_command = AptlyCli::AptlyRepo.new(config, options)
159
- if options.default_distribution
160
- repo_options = { :DefaultDistribution => options.default_distribution.to_s }
161
- end
162
- if options.default_component
163
- repo_options = { :DefaultComponent => options.default_component.to_s }
164
- end
165
- if options.comment
166
- repo_options = { :Comment => options.comment.to_s }
167
- end
168
- puts aptly_command.repo_edit(options.name.to_s, repo_options || {})
159
+
160
+ repo_options = {}
161
+ repo_options[:DefaultDistribution] = options.default_distribution.to_s if options.default_distribution
162
+ repo_options[:DefaultComponent] = options.default_component.to_s if options.default_component
163
+ repo_options[:Comment] = options.comment.to_s if options.comment
164
+
165
+ puts aptly_command.repo_edit(options.name.to_s, repo_options)
169
166
  end
170
167
  end
171
168
 
@@ -1,3 +1,3 @@
1
1
  module AptlyCli
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.freeze
3
3
  end
data/lib/aptly_command.rb CHANGED
@@ -94,13 +94,13 @@ module AptlyCli
94
94
 
95
95
  raise "[Server] #{json_response['error']}" unless !json_response.is_a?(Hash) || json_response.dig('error').nil?
96
96
 
97
- raise HttpNotFoundError, "#{json_response}" if response.code == 404
98
- raise HttpInternalServerError, "#{json_response}" if response.code == 500
97
+ raise HttpNotFoundError, "[HTTP Not Found Error] JSON response:\n#{json_response}" if response.code == 404
98
+ raise HttpInternalServerError, "[HTTP Internal Server Error] JSON response:\n#{json_response}" if response.code == 500
99
99
 
100
100
  response
101
101
  rescue JSON::ParserError
102
- raise HttpNotFoundError, "#{json_response}" if response.code == 404
103
- raise HttpInternalServerError, "#{json_response}" if response.code == 500
102
+ raise HttpNotFoundError, "[HTTP Not Found Error] Response:\n#{response.body}" if response.code == 404
103
+ raise HttpInternalServerError, "[HTTP Internal Server Error] Response:\n#{response.body}" if response.code == 500
104
104
 
105
105
  response
106
106
  end
data/lib/aptly_repo.rb CHANGED
@@ -48,7 +48,9 @@ module AptlyCli
48
48
 
49
49
  def repo_list
50
50
  uri = '/repos'
51
- get(uri)
51
+ JSON.parse get(uri).body
52
+ rescue JSON::ParserError
53
+ raise "Invalid response from '#{self.class.base_uri}#{uri}'"
52
54
  end
53
55
 
54
56
  def repo_package_add(repo_options, packages)
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-06 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler