aptly_cli 0.3.3 → 0.3.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDdjMWRhNTU5YjMwOGZmNzMxYmE4ZGQ2ODUyMWJlY2U1NmQxN2RlNA==
4
+ Yzc1NGY3OGE5NjE5Y2YwMWE1YjQ2MTI4NWNlZDllZDQ5ODBkZjRjYw==
5
5
  data.tar.gz: !binary |-
6
- ZTE2YTJiMzJhMjQzMTQ1Zjg1MGIyYThjOTg4ODhiN2FlNWU0ODBjNQ==
6
+ Zjc5ZjU5ZWU4ZGM5NjlkNmQwMTk3NmQxY2IyNGVmZjY4MDJhNWJhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmU4M2ExNmY4ODI0NmVmYjNjMTc2MzYxNWFmYmM3ZmQ3MzI0MzUyZWY5OWFk
10
- YWYyZjg2NDgwMDQxODlhYWUwMWNlODkwNzIxYzA2Y2Q2N2Y0ZjliZDcyYmJi
11
- YzhjMGM3OGE0NzY4NWNjNTZmZDkzYmY0YzJjMjQ5NTlmYWQyNDg=
9
+ OWE1NTM2YWNhMTViMzg0YTBhMGM2MGEyNzI2ZjM2NzhmNmY2OGZjMzI3ZDA3
10
+ MjVhMTJiMzRhZDY4Y2EzYTRlMDBjNjdmNGNkN2ZlNGJlOTdjZjA5YzkzMzNk
11
+ MmMzY2I5MDk4MDZiODNmOGQ5M2E5NDQ0MzU3NjUxM2UzODM5ZmE=
12
12
  data.tar.gz: !binary |-
13
- YjE3YWE0YWMzNTJhYjk2MzI1ZDU3M2M4ZjdhZmMwN2E0ZjBiMTAwNGU1ZDEz
14
- MzUwNzZmZDI2MjlkMWU0YjRlMzc2OGZkMWY3NWExMTI3ODY1YmIxZTBlNGM2
15
- YmQ5YzM5OGQyNjc5ZTQ5NTM2MGM2YTcwZGRmNzliZmQ2MWMzODE=
13
+ NDY3MWQ2OWY3NGMzMzg4OGFjMmU5M2ZkOWFiMGE1NzNiMjVjMDExOWRkZWZj
14
+ OTI4MjQ1OGQwZmE2M2NmYjU1NWFhNGJmNTkzZmM0YzIzMWUzOWY3YzA1ZDJm
15
+ ZjM2M2Q4NDEyMGM0NTFiYTVmY2MyMGFmMDk3YzE1ODVlYjBkMTc=
data/bin/aptly-cli CHANGED
@@ -18,7 +18,9 @@ $debug = false
18
18
  global_option('-c', '--config FILE', 'Path to YAML config file') do |config_file|
19
19
  $config_file = config_file
20
20
  end
21
-
21
+ global_option('--no-config', 'Don\'t try to read YAML config file') do |config_file|
22
+ $config_file = nil
23
+ end
22
24
  global_option('-s', '--server SERVER', 'Host name or IP address of Aptly API server') do |server|
23
25
  $server = server
24
26
  end
@@ -1,3 +1,3 @@
1
1
  module AptlyCli
2
- VERSION = '0.3.3'.freeze
2
+ VERSION = '0.3.4'.freeze
3
3
  end
data/lib/aptly_load.rb CHANGED
@@ -34,18 +34,23 @@ module AptlyCli
34
34
 
35
35
  # Configure through yaml file
36
36
  def configure_with(path_to_yaml_file)
37
- begin
38
- config = YAML.load(IO.read(path_to_yaml_file))
39
- rescue Errno::ENOENT
40
- @log.warn(
41
- "YAML configuration file couldn\'t be found at " \
42
- "#{path_to_yaml_file}. Using defaults.")
43
- return @config
44
- rescue Psych::SyntaxError
45
- @log.warn(
46
- 'YAML configuration file contains invalid syntax. Using defaults.')
47
- return @config
37
+ if path_to_yaml_file
38
+ begin
39
+ config = YAML.load(IO.read(path_to_yaml_file))
40
+ rescue Errno::ENOENT
41
+ @log.warn(
42
+ "YAML configuration file couldn\'t be found at " \
43
+ "#{path_to_yaml_file}. Using defaults.")
44
+ return @config
45
+ rescue Psych::SyntaxError
46
+ @log.warn(
47
+ 'YAML configuration file contains invalid syntax. Using defaults.')
48
+ return @config
49
+ end
50
+ else
51
+ config = {}
48
52
  end
53
+
49
54
  configure(config)
50
55
  end
51
56
  end
data/lib/aptly_repo.rb CHANGED
@@ -3,6 +3,7 @@ require 'aptly_command'
3
3
  require 'aptly_load'
4
4
  require 'httmultiparty'
5
5
  require 'json'
6
+ require 'uri'
6
7
 
7
8
  module AptlyCli
8
9
  # Aptly class to work with Repo API
@@ -58,15 +59,12 @@ module AptlyCli
58
59
  else
59
60
  uri = '/repos/' + repo_options[:name] + '/packages'
60
61
  end
61
- uri += if repo_options[:query]
62
- "?q=#{repo_options[:query]}"
63
- elsif repo_options[:format]
64
- "?format=#{repo_options[:format]}"
65
- elsif repo_options[:with_deps]
66
- '?withDeps=1'
67
- else
68
- ''
69
- end
62
+
63
+ qs_hash = {}
64
+ qs_hash['q'] = repo_options[:query] if repo_options[:query]
65
+ qs_hash['format'] = repo_options[:format] if repo_options[:format]
66
+ qs_hash['withDeps'] = 1 if repo_options[:with_deps]
67
+ uri += '?' + URI.encode_www_form(qs_hash) if qs_hash
70
68
  self.class.get uri
71
69
  end
72
70
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptly_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane