Class: Zypper::Upgraderepo::View::Table
- Inherits:
-
Object
- Object
- Zypper::Upgraderepo::View::Table
- Defined in:
- lib/zypper/upgraderepo/view.rb
Overview
Table style output.
Class Method Summary collapse
- .alternative(num, repo, max_col, alt) ⇒ Object
- .available(num, repo, max_col) ⇒ Object
- .duplicates_footer(dcount, total) ⇒ Object
- .duplicates_header(max_col) ⇒ Object
- .duplicates_item(num, dnum, dcount, repo, max_col) ⇒ Object
- .footer(max_col) ⇒ Object
- .forbidden(num, repo, max_col) ⇒ Object
- .header(max_col, upgrade: false) ⇒ Object
- .not_found(num, repo, max_col) ⇒ Object
- .redirected(num, repo, max_col, redirected) ⇒ Object
- .separator(max_col, char = "-", color = :none) ⇒ Object
- .server_error(num, repo, max_col) ⇒ Object
- .status(os_release) ⇒ Object
- .timeout(num, repo, max_col) ⇒ Object
- .untouched(num, repo, max_col) ⇒ Object
- .unused_footer(ucount, total) ⇒ Object
- .unused_header(max_col) ⇒ Object
- .unused_item(num, unum, repo, max_col) ⇒ Object
- .upgraded(num, repo, max_col) ⇒ Object
Class Method Details
.alternative(num, repo, max_col, alt) ⇒ Object
152 153 154 155 156 |
# File 'lib/zypper/upgraderepo/view.rb', line 152 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
126 127 128 129 130 131 132 133 134 |
# File 'lib/zypper/upgraderepo/view.rb', line 126 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 |
.duplicates_footer(dcount, total) ⇒ Object
217 218 219 |
# File 'lib/zypper/upgraderepo/view.rb', line 217 def self.(dcount, total) puts "Total duplicated repositories: #{dcount.to_s.bold.yellow}/#{total}" end |
.duplicates_header(max_col) ⇒ Object
207 208 209 |
# File 'lib/zypper/upgraderepo/view.rb', line 207 def self.duplicates_header(max_col) puts " St. | # | #{"Name".ljust(max_col, " ")} | En. | Details" end |
.duplicates_item(num, dnum, dcount, repo, max_col) ⇒ Object
211 212 213 214 215 |
# File 'lib/zypper/upgraderepo/view.rb', line 211 def self.duplicates_item(num, dnum, dcount, repo, max_col) Messages.warning("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, " ")} " \ "| #{repo.enabled? ? " Y " : " N ".yellow} " \ "| Duplicate n.#{dnum.to_s.bold}/#{dcount.to_s.bold} ") end |
.footer(max_col) ⇒ Object
187 188 189 |
# File 'lib/zypper/upgraderepo/view.rb', line 187 def self.(max_col) separator max_col end |
.forbidden(num, repo, max_col) ⇒ Object
147 148 149 150 |
# File 'lib/zypper/upgraderepo/view.rb', line 147 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
183 184 185 |
# File 'lib/zypper/upgraderepo/view.rb', line 183 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
142 143 144 145 |
# File 'lib/zypper/upgraderepo/view.rb', line 142 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
136 137 138 139 140 |
# File 'lib/zypper/upgraderepo/view.rb', line 136 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 |
.separator(max_col, char = "-", color = :none) ⇒ Object
179 180 181 |
# File 'lib/zypper/upgraderepo/view.rb', line 179 def self.separator(max_col, char = "-", color = :none) puts (char * (max_col + 20)).send(color) end |
.server_error(num, repo, max_col) ⇒ Object
174 175 176 177 |
# File 'lib/zypper/upgraderepo/view.rb', line 174 def self.server_error(num, repo, max_col) Messages.error("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, " ")} " \ "| #{repo.enabled? ? " Y " : " N ".yellow} | #{"Error:".bold.red} #{repo.status}") end |
.status(os_release) ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/zypper/upgraderepo/view.rb', line 191 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.positive? ? os_release.next.bold.green : " - "} " \ "| #{os_release.last.send(os_release.unstable ? :red : :clean)} " \ "| #{os_release.seniority.positive? ? os_release.newer.join(", ") : "-"}" puts "--------------------------------------------------" return unless os_release.unstable Messages.warning "The #{"last".bold.red} version should be considered #{"Unstable".bold.red}" end |
.timeout(num, repo, max_col) ⇒ Object
158 159 160 161 |
# File 'lib/zypper/upgraderepo/view.rb', line 158 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
169 170 171 172 |
# File 'lib/zypper/upgraderepo/view.rb', line 169 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 |
.unused_footer(ucount, total) ⇒ Object
231 232 233 |
# File 'lib/zypper/upgraderepo/view.rb', line 231 def self.(ucount, total) puts "Total unused repositories: #{ucount.to_s.bold.yellow}/#{total}" end |
.unused_header(max_col) ⇒ Object
221 222 223 |
# File 'lib/zypper/upgraderepo/view.rb', line 221 def self.unused_header(max_col) puts " St. | # | #{"Name".ljust(max_col, " ")} | En. | Details" end |
.unused_item(num, unum, repo, max_col) ⇒ Object
225 226 227 228 229 |
# File 'lib/zypper/upgraderepo/view.rb', line 225 def self.unused_item(num, unum, repo, max_col) Messages.warning("| #{num.to_s.rjust(2)} | #{repo.name.ljust(max_col, " ")} " \ "| #{repo.enabled? ? " Y " : " N ".yellow} " \ "| Unused n.#{unum.to_s.bold}") end |
.upgraded(num, repo, max_col) ⇒ Object
163 164 165 166 167 |
# File 'lib/zypper/upgraderepo/view.rb', line 163 def self.upgraded(num, repo, max_col) 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 |