Class: AptSpy2

Inherits:
Thor
  • Object
show all
Defined in:
lib/apt/spy2.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



35
36
37
38
39
40
41
42
43
# File 'lib/apt/spy2.rb', line 35

def check

  @writer = Apt::Spy2::Writer.new(options[:format])

  mirrors = retrieve(options[:country], use_launchpad?(options))
  filter(mirrors, options[:output])

  puts @writer.to_json if @writer.json?
end

#fixObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/apt/spy2.rb', line 18

def fix
  working = filter(retrieve(options[:country], use_launchpad?(options)), false)
  print "The closest mirror is: "
  puts "#{working[0]}".bold.magenta
  if !options[:commit]
    puts "Run with --commit to adjust /etc/apt/sources.list".yellow
  else
    puts "Updating /etc/apt/sources.list".yellow
    update(working[0])
  end
end

#listObject



49
50
51
52
53
54
55
56
57
58
# File 'lib/apt/spy2.rb', line 49

def list
  mirrors = retrieve(options[:country], use_launchpad?(options))

  @writer = Apt::Spy2::Writer.new(options[:format])

  @writer.set_complete(mirrors)

  puts @writer.to_json if @writer.json?
  puts mirrors if !@writer.json?
end

#versionObject



61
62
63
64
# File 'lib/apt/spy2.rb', line 61

def version
  puts Apt::Spy2::VERSION
  exit
end