Sha256: 8868c1bb590ecb6c6f9ca26fe19079aa8ca3b0e3c87394263d423b9162269d50

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

require 'aptly_cli/version'
require 'aptly_load'
require 'httmultiparty'
require 'json'

module AptlyCli
  # Misc Aptly Class
  class AptlyMisc
    include HTTMultiParty

    # Load aptly-cli.conf and establish base_uri
    config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
    base_uri "http://#{config[:server]}:#{config[:port]}/api"

    if config[:username]
      if config[:password]
        basic_auth config[:username].to_s, config[:password].to_s
      end
    end

    debug_output $stdout if config[:debug] == true

    def get_graph(extension)
      uri = "/graph.#{extension}"
      self.class.get(uri)
    end

    def get_version
      uri = '/version'
      self.class.get(uri)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aptly_cli-0.2.7 lib/aptly_misc.rb
aptly_cli-0.2.6 lib/aptly_misc.rb
aptly_cli-0.2.5 lib/aptly_misc.rb
aptly_cli-0.2.4 lib/aptly_misc.rb