class Docker::Search

Constants

VERSION

Public Class Methods

new(config) click to toggle source
# File lib/docker/search.rb, line 22
def initialize(config)
  @hosts = {}
  config['auths'].each do |host, c|
    user, pass = c["auth"].unpack('m')[0].split(':', 2)
    @hosts[host] = [user, pass]
  end
end
run() click to toggle source
# File lib/docker/search.rb, line 10
def self.run
  config_path = "~/.docker/config.json"
  action = :search
  opt = OptionParser.new
  def opt.version; VERSION end
  opt.on('-c config_file_path'){|v| config_path = v}
  opt.on('-l', 'list up registries'){action = :list}
  opt.parse! ARGV
  search = new JSON.load(open(File.expand_path config_path).read)
  search.send action, *ARGV
end

Public Instance Methods

list() click to toggle source
# File lib/docker/search.rb, line 54
def list
  @hosts.each_with_index do |(k,v),i|
    puts "#{i + 1}. #{k}"
  end
end

Private Instance Methods

fetch(url) click to toggle source
# File lib/docker/search.rb, line 61
def fetch(url)
end