aptly_cli 0.2.3 → 0.2.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
- OGY1ZjI5MTAwNjdiMGI0NzkxYzkxNjc1YzJjY2Q3ODY2MzdjYTE4ZQ==
4
+ ZWE5OGM3ZDMwNWNiMDMyY2I0YTJkNjQyMWRiY2E3MDJmN2EzMjEwZQ==
5
5
  data.tar.gz: !binary |-
6
- YmI5ZmFkMmIzNmRhN2I1NDg3NmU2MjE2YjdjZDUyMjFiNmJhMGEwOA==
6
+ YmQ5NDc2YThjMTUwM2VmYmNjOTg4OTg1YzM5ZDk2NWU4MTcwMTYxYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWJiMmM3NzczYTc1N2FhODViZmZhMjU1NTY5OWJjMDZjMTFmNjlhOWJhNWM3
10
- NThmMmJjNDBiMjFkM2Y1MzA0ODZlMzM5ZjdhZTk2ZmQwMTZiZmQ4YTU5MTFj
11
- OTJmZDhlNDJkOWQ4MWI0MzA1Njg1OTNiMThkMDYxYWJmODI5YTA=
9
+ NzZkMGJiZmQ0YzkxYTIzYTUyNGQ2YzRhZDVlOTgxOTM0OGI3NDYyM2ZjMWU5
10
+ MjM5Yjg1MTk5ZGFlMmMyZWY1YWI4MWQ5NjIwNTdhODVhYWMwZmYzZjE0NmIw
11
+ NTc0MjI0OWMxMTcyMThmNzI0ZjlmYzA1Zjk3MGYzMDUwMzA1ZWI=
12
12
  data.tar.gz: !binary |-
13
- NTc4MTljNTVhZWUzM2E5NjcxOWY5MTQ5MDc1OGIxOGFmZTQ2OTI1YTE5YWVh
14
- MWExODg2MjgyMzVjOTY0OGM2MWI2ZDM4YmQ3YmQ0NDE2ODkxMjE3ZDMwZmNl
15
- Yjc0MDhkZTI4M2FiM2UzMzU4MTYxOGQyODcyZDY5OTA1OWY4MGM=
13
+ NTllZGY4MGEzNGE5NTUwNGIyNzVjNmYzNzJlYWNjNTVlZjE5MDU0YjVmNTIz
14
+ ODVhMTExNTMwMDUyMTliMTQ5YTFkMzA4OTdlY2VmNjZmZGQ2NDRhYjE3YTFi
15
+ OGVhODljNDQ5ZDNiZTg3MWVjYzFmNDNjNjA1OGQ0OGU0NzI1OTM=
data/.rubocop.yml CHANGED
@@ -1,2 +1,5 @@
1
1
  SpaceAroundEqualsInParameterDefault:
2
2
  Enabled: false
3
+ TrivialAccessors:
4
+ Enabled: true
5
+ ExactNameMatch: true
data/lib/aptly_cli.rb CHANGED
@@ -1,8 +1,8 @@
1
- require "aptly_cli/version"
2
- require "httmultiparty"
1
+ require 'aptly_cli/version'
2
+ require 'httmultiparty'
3
3
 
4
+ # Initializing
4
5
  module AptlyCli
5
-
6
6
  Dir[File.dirname(__FILE__) + '/*.rb'].each do |file|
7
7
  require file
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module AptlyCli
2
- VERSION = "0.2.3".freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
data/lib/aptly_file.rb CHANGED
@@ -1,54 +1,53 @@
1
- require "aptly_cli/version"
2
- require "aptly_load"
3
- require "httmultiparty"
1
+ require 'aptly_cli/version'
2
+ require 'aptly_load'
3
+ require 'httmultiparty'
4
4
 
5
5
  module AptlyCli
6
+ # Uploading file into Aptly
6
7
  class AptlyFile
7
-
8
8
  include HTTMultiParty
9
9
  attr_accessor :file_uri, :package, :local_file_path
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with("/etc/aptly-cli.conf")
12
+ config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
13
  base_uri "http://#{config[:server]}:#{config[:port]}/api"
14
14
 
15
15
  if config[:username]
16
16
  if config[:password]
17
- basic_auth "#{config[:username]}", "#{config[:password]}"
17
+ basic_auth config[:username].to_s, config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- if config[:debug] == true
22
- debug_output $stdout
23
- end
21
+ debug_output $stdout if config[:debug] == true
24
22
 
25
23
  def initialize(file_uri=nil, package=nil, local_file_path=nil)
26
24
  end
27
25
 
28
- def file_dir()
29
- uri = "/files"
26
+ def file_dir
27
+ uri = '/files'
30
28
  self.class.get uri
31
29
  end
32
30
 
33
31
  def file_get(file_uri)
34
- if file_uri == "/"
35
- uri = "/files"
36
- else
37
- uri = "/files/" + file_uri
38
- end
39
-
40
- self.class.get uri
32
+ uri = if file_uri == '/'
33
+ '/files'
34
+ else
35
+ '/files/' + file_uri
36
+ end
37
+ self.class.get uri
41
38
  end
42
39
 
43
40
  def file_delete(file_uri)
44
- uri = "/files" + file_uri
45
- self.class.delete uri
41
+ uri = '/files' + file_uri
42
+ self.class.delete uri
46
43
  end
47
44
 
48
45
  def file_post(post_options = {})
49
- api_file_uri = "/files" + post_options[:file_uri].to_s
50
- self.class.post(api_file_uri, :query => { :package => post_options[:package], :file => File.new(post_options[:local_file])} )
46
+ api_file_uri = '/files' + post_options[:file_uri].to_s
47
+ self.class.post(api_file_uri,
48
+ query: {
49
+ package: post_options[:package],
50
+ file: File.new(post_options[:local_file]) })
51
51
  end
52
-
53
52
  end
54
53
  end
data/lib/aptly_load.rb CHANGED
@@ -3,41 +3,44 @@ require 'yaml'
3
3
  require 'logger'
4
4
 
5
5
  module AptlyCli
6
+ # Load aptly-cli configuration
6
7
  class AptlyLoad
7
-
8
8
  def initialize
9
9
  @log = Logger.new(STDOUT)
10
10
  @log.level = Logger::WARN
11
-
11
+
12
12
  # Configuration defaults
13
13
  @config = {
14
- :server => "127.0.0.1",
15
- :port => 8082
16
- }
17
-
14
+ server: '127.0.0.1',
15
+ port: 8082
16
+ }
17
+
18
18
  @valid_config_keys = @config.keys
19
19
  end
20
-
20
+
21
21
  # Configure through hash
22
22
  def configure(opts = {})
23
- opts.each {|k,v| config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
23
+ opts.each do |k, v|
24
+ config[k.to_sym] = v if @valid_config_keys.include? k.to_sym
25
+ end
24
26
  end
25
-
27
+
26
28
  # Configure through yaml file
27
29
  def configure_with(path_to_yaml_file)
28
30
  begin
29
- config = YAML::load(IO.read(path_to_yaml_file))
31
+ config = YAML.load(IO.read(path_to_yaml_file))
30
32
  rescue Errno::ENOENT
31
- @log.warn("YAML configuration file couldn't be found at /etc/aptly-cli.conf. Using defaults.")
33
+ @log.warn('YAML configuration file couldn\'t be found at
34
+ /etc/aptly-cli.conf. Using defaults.')
32
35
  return @config
33
36
  rescue Psych::SyntaxError
34
- @log.warn("YAML configuration file contains invalid syntax. Using defaults.")
35
- return @config
37
+ @log.warn(
38
+ 'YAML configuration file contains invalid syntax. Using defaults.')
39
+ return @config
36
40
  end
37
-
38
41
  configure(config)
39
42
  end
40
-
43
+
41
44
  def config
42
45
  @config
43
46
  end
data/lib/aptly_misc.rb CHANGED
@@ -1,36 +1,33 @@
1
- require "aptly_cli/version"
2
- require "aptly_load"
3
- require "httmultiparty"
4
- require "json"
1
+ require 'aptly_cli/version'
2
+ require 'aptly_load'
3
+ require 'httmultiparty'
4
+ require 'json'
5
5
 
6
6
  module AptlyCli
7
+ # Misc Aptly Class
7
8
  class AptlyMisc
8
-
9
9
  include HTTMultiParty
10
10
 
11
11
  # Load aptly-cli.conf and establish base_uri
12
- config = AptlyCli::AptlyLoad.new.configure_with("/etc/aptly-cli.conf")
12
+ config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
13
13
  base_uri "http://#{config[:server]}:#{config[:port]}/api"
14
14
 
15
15
  if config[:username]
16
16
  if config[:password]
17
- basic_auth "#{config[:username]}", "#{config[:password]}"
17
+ basic_auth config[:username].to_s, config[:password].to_s
18
18
  end
19
19
  end
20
20
 
21
- if config[:debug] == true
22
- debug_output $stdout
23
- end
21
+ debug_output $stdout if config[:debug] == true
24
22
 
25
23
  def get_graph(extension)
26
24
  uri = "/graph.#{extension}"
27
25
  self.class.get(uri)
28
26
  end
29
27
 
30
- def get_version()
31
- uri = "/version"
28
+ def get_version
29
+ uri = '/version'
32
30
  self.class.get(uri)
33
31
  end
34
-
35
32
  end
36
33
  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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-19 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler