Class: Zypper::Upgraderepo::View::Table

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



113
114
115
116
# File 'lib/zypper/upgraderepo/view.rb', line 113

def self.alternative(num, repo, max_col, alt)
  Messages.error("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{alt[:message].bold.yellow}")
  puts " #{' ' * 3} | #{' ' * 2} | #{' ' * max_col} | #{' ' * 3} | #{alt[:url]}" unless alt[:url].to_s.empty?
end

.available(num, repo, max_col) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/zypper/upgraderepo/view.rb', line 92

def self.available(num, repo, max_col)
  if repo.unversioned? && repo.old_url
    Messages.ok("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | Unversioned repository")
  else
    Messages.ok("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} |")
  end
end


139
140
141
# File 'lib/zypper/upgraderepo/view.rb', line 139

def self.footer
  self.separator
end

.forbidden(num, repo, max_col) ⇒ Object



109
110
111
# File 'lib/zypper/upgraderepo/view.rb', line 109

def self.forbidden(num, repo, max_col)
  Messages.error("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'Forbidden path'.bold.red}")
end

.header(max_col, upgrade = false) ⇒ Object



135
136
137
# File 'lib/zypper/upgraderepo/view.rb', line 135

def self.header(max_col, upgrade = false)
  puts " St. |  # | #{'Name'.ljust(max_col, ' ')} | En. | #{upgrade ? 'Details' : 'Hint' }"
end

.not_found(num, repo, max_col) ⇒ Object



105
106
107
# File 'lib/zypper/upgraderepo/view.rb', line 105

def self.not_found(num, repo, max_col)
  Messages.error("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'Not Found'.bold.red}")
end

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



100
101
102
103
# File 'lib/zypper/upgraderepo/view.rb', line 100

def self.redirected(num, repo, max_col, redirected)
  Messages.warning("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'Redirection'.bold.yellow} of #{repo.url} ")
  puts " #{' ' * 3} | #{' ' * 2} | #{ ' ' * max_col} | #{ ' ' * 3 } | #{'To:'.bold.yellow} #{redirected}"
end

.separatorObject



131
132
133
# File 'lib/zypper/upgraderepo/view.rb', line 131

def self.separator
  puts '-' * 90
end

.status(os_release) ⇒ Object



143
144
145
146
147
148
149
150
151
152
# File 'lib/zypper/upgraderepo/view.rb', line 143

def self.status(os_release)
  puts "---------------------------------------------------"
  puts " System releases based on #{os_release.fullname.bold}"
  puts "---------------------------------------------------"
  puts " Current |  Next  |  Last  | Available"
  puts "--------------------------------------------------"
  puts "   #{os_release.current}  |  #{os_release.seniority > 0 ? os_release.next.bold.green : ' -  ' }  |  #{os_release.last.send(os_release.unstable ? :red : :clean)}  | #{os_release.seniority > 0 ? os_release.newer.join(', ') : '-'}"
  puts "--------------------------------------------------"
  Messages.warning "The #{'last'.bold.red} version should be considered #{'Unstable'.bold.red}" if os_release.unstable
end

.timeout(num, repo, max_col) ⇒ Object



118
119
120
# File 'lib/zypper/upgraderepo/view.rb', line 118

def self.timeout(num, repo, max_col)
  Messages.error("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'Server Timeout'.bold.yellow}")
end

.untouched(num, repo, max_col) ⇒ Object



127
128
129
# File 'lib/zypper/upgraderepo/view.rb', line 127

def self.untouched(num, repo, max_col)
  Messages.warning("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'Untouched:'.bold.yellow} #{repo.old_url}")
end

.upgraded(num, repo, max_col) ⇒ Object

, old_data)



122
123
124
125
# File 'lib/zypper/upgraderepo/view.rb', line 122

def self.upgraded(num, repo, max_col) #, old_data)
  Messages.ok("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, ' ')} | #{repo.enabled? ? ' Y ' : ' N '.yellow} | #{'From:'.bold.green} #{repo.old_url}")
  puts " #{' ' * 3} | #{' ' * 2} | #{' ' * max_col} | #{' ' * 3} | #{'To:'.bold.green} #{repo.url}"
end