Class: Zypper::Upgraderepo::View::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/zypper/upgraderepo/view.rb

Class Method Summary collapse

Class Method Details

.alternative(num, repo, max_col, alt) ⇒ Object



30
31
32
33
34
35
# File 'lib/zypper/upgraderepo/view.rb', line 30

def self.alternative(num, repo, max_col, alt)
  puts " #{num.to_s.rjust(2).bold.red} | Status: #{'Not Found'.bold.red}"
  puts " #{' ' * 2} | Hint: #{alt[:message].bold.yellow}"
  puts " #{' ' * 2} | #{'Suggested:'.bold.yellow} #{alt[:url]}" unless alt[:url].to_s.empty?
  self.info(repo)
end

.available(num, repo, max_col) ⇒ Object



8
9
10
11
12
# File 'lib/zypper/upgraderepo/view.rb', line 8

def self.available(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.green} | Status: #{'Ok'.bold.green}"
  puts " #{' ' * 2} | Hint: Unversioned repository" if repo.unversioned? && repo.old_url
  self.info(repo)
end


60
61
62
# File 'lib/zypper/upgraderepo/view.rb', line 60

def self.footer
  self.separator
end

.forbidden(num, repo, max_col) ⇒ Object



25
26
27
28
# File 'lib/zypper/upgraderepo/view.rb', line 25

def self.forbidden(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.red} | Status: #{'Forbidden Path'.bold.red}"
  self.info(repo)
end

.header(max_col, upgrade = false) ⇒ Object



56
57
58
# File 'lib/zypper/upgraderepo/view.rb', line 56

def self.header(max_col, upgrade = false)
  puts "  # | Report"
end

.not_found(num, repo, max_col) ⇒ Object



20
21
22
23
# File 'lib/zypper/upgraderepo/view.rb', line 20

def self.not_found(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.red} | Status: #{'Not Found'.bold.red}"
  self.info(repo)
end

.redirected(num, repo, max_col, redirected) ⇒ Object



14
15
16
17
18
# File 'lib/zypper/upgraderepo/view.rb', line 14

def self.redirected(num, repo, max_col, redirected)
  puts " #{num.to_s.rjust(2).bold.yellow} | Status: #{'Redirected'.bold.yellow}"
  puts " #{' ' * 2} | #{'To:'.bold.yellow} #{redirected}"
  self.info(repo)
end

.separatorObject



52
53
54
# File 'lib/zypper/upgraderepo/view.rb', line 52

def self.separator
  puts '-' * 90
end

.status(os_release) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/zypper/upgraderepo/view.rb', line 64

def self.status(os_release)
  color = os_release.seniority == 0 ? :green : :yellow
  puts '----------------------------------------------'
  puts "Full name       | #{os_release.fullname.bold}"
  puts '----------------------------------------------'
  puts "Current release | #{os_release.current.send(color)}"
  puts "Next release    | #{os_release.seniority > 0 ? os_release.next.bold.green : '-'}"
  puts "Last release    | #{os_release.last.send(os_release.unstable ? :red : :clean)} (#{os_release.unstable ? 'Unstable'.bold.red : 'Stable'.bold.green})"
  puts "Available       | #{os_release.seniority > 0 ? os_release.newer.map{ |i| i.bold }.join(', ') : '-' }"
  puts '----------------------------------------------'
end

.timeout(num, repo, max_col) ⇒ Object



37
38
39
40
# File 'lib/zypper/upgraderepo/view.rb', line 37

def self.timeout(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.yellow} | Status: #{'Server Timeout'.bold.yellow}"
  self.info(repo)
end

.untouched(num, repo, max_col) ⇒ Object



47
48
49
50
# File 'lib/zypper/upgraderepo/view.rb', line 47

def self.untouched(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.yellow} | #{'Untouched'.bold.yellow}"
  self.info(repo)
end

.upgraded(num, repo, max_col) ⇒ Object



42
43
44
45
# File 'lib/zypper/upgraderepo/view.rb', line 42

def self.upgraded(num, repo, max_col)
  puts " #{num.to_s.rjust(2).bold.green} | #{'Upgraded'.bold.green}"
  self.info(repo)
end