zypper-upgraderepo 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,18 @@
1
- require 'zypper/upgraderepo/repository'
2
- require 'zypper/upgraderepo/request'
3
- require 'zypper/upgraderepo/os_release'
4
- require 'zypper/upgraderepo/utils'
5
- require 'zypper/upgraderepo/view'
6
- require 'zlib'
7
- require 'minitar'
1
+ # frozen_string_literal: true
8
2
 
3
+ require "zypper/upgraderepo/repository"
4
+ require "zypper/upgraderepo/request"
5
+ require "zypper/upgraderepo/os_release"
6
+ require "zypper/upgraderepo/utils"
7
+ require "zypper/upgraderepo/view"
8
+ require "zlib"
9
+ require "minitar"
9
10
 
10
11
  module Zypper
11
12
  module Upgraderepo
12
-
13
+ #
14
+ # Facade class for all the operations.
15
+ #
13
16
  class Builder
14
17
  def initialize(options)
15
18
  @os_release = OsRelease.new(options)
@@ -23,11 +26,11 @@ module Zypper
23
26
  end
24
27
 
25
28
  def backup
26
- filename = File.join(@backup_path, "repos-backup-#{Time.now.to_s.delete(': +-')[0..-5]}.tgz")
29
+ filename = File.join(@backup_path, "repos-backup-#{Time.now.to_s.delete(": +-")[0..-5]}.tgz")
27
30
 
28
31
  raise InvalidWritePermissions, filename unless File.writable? @backup_path
29
32
 
30
- Minitar.pack(RepositoryList::REPOSITORY_PATH, Zlib::GzipWriter.new(File.open(filename, 'wb')))
33
+ Minitar.pack(RepositoryList::REPOSITORY_PATH, Zlib::GzipWriter.new(File.open(filename, "wb")))
31
34
 
32
35
  Messages.ok "Backup file generated at #{filename.bold.green}"
33
36
  end
@@ -38,7 +41,8 @@ module Zypper
38
41
  end
39
42
 
40
43
  def check_next
41
- raise AlreadyUpgraded, 'latest' if @os_release.last?
44
+ raise AlreadyUpgraded, "latest" if @os_release.last?
45
+
42
46
  @repos.upgrade!(@os_release.next)
43
47
  check_repos(@os_release.next)
44
48
  end
@@ -49,25 +53,29 @@ module Zypper
49
53
  end
50
54
 
51
55
  def check_last
52
- raise AlreadyUpgraded, 'latest' if @os_release.last?
56
+ raise AlreadyUpgraded, "latest" if @os_release.last?
57
+
53
58
  @repos.upgrade!(@os_release.last)
54
59
  check_repos(@os_release.last)
55
60
  end
56
61
 
57
62
  def upgrade_to_next
58
- raise AlreadyUpgraded, 'latest' if @os_release.last?
63
+ raise AlreadyUpgraded, "latest" if @os_release.last?
64
+
59
65
  @repos.upgrade!(@os_release.next)
60
66
  upgrade_repos(@os_release.next)
61
67
  end
62
68
 
63
69
  def upgrade_to
64
70
  raise AlreadyUpgraded, @os_release.custom if @os_release.current?(@os_release.custom)
71
+
65
72
  @repos.upgrade!(@os_release.custom)
66
73
  upgrade_repos(@os_release.custom)
67
74
  end
68
75
 
69
76
  def upgrade_to_last
70
- raise AlreadyUpgraded, 'latest' if @os_release.last?
77
+ raise AlreadyUpgraded, "latest" if @os_release.last?
78
+
71
79
  @repos.upgrade!(@os_release.last)
72
80
  upgrade_repos(@os_release.last)
73
81
  end
@@ -91,13 +99,13 @@ module Zypper
91
99
  @view_class.header(@repos.max_col)
92
100
 
93
101
  @repos.each_with_number do |repo, num|
94
-
95
- @view_class.separator
102
+ @view_class.separator @repos.max_col
96
103
 
97
104
  if repo.available?
98
105
  @view_class.available num, repo, @repos.max_col
99
106
  else
100
107
  raise UnableToUpgrade, { num: num, repo: repo } if @exit_on_fail
108
+
101
109
  if repo.redirected?
102
110
  @view_class.redirected num, repo, @repos.max_col, repo.redirected_to
103
111
  elsif repo.not_found?
@@ -110,19 +118,20 @@ module Zypper
110
118
  @view_class.forbidden num, repo, @repos.max_col
111
119
  elsif repo.timeout?
112
120
  @view_class.timeout num, repo, @repos.max_col
121
+ else
122
+ @view_class.server_error num, repo, @repos.max_col
113
123
  end
114
124
  end
115
125
  end
116
126
 
117
- @view_class.footer
127
+ @view_class.footer @repos.max_col
118
128
  end
119
129
 
120
- def upgrade_repos(version)
121
- @view_class.header(@repos.max_col, true)
130
+ def upgrade_repos(_version)
131
+ @view_class.header(@repos.max_col, upgrade: true)
122
132
 
123
133
  @repos.each_with_number do |repo, num|
124
-
125
- @view_class.separator
134
+ @view_class.separator @repos.max_col
126
135
 
127
136
  if repo.upgraded?
128
137
  @view_class.upgraded num, repo, @repos.max_col
@@ -131,13 +140,11 @@ module Zypper
131
140
  end
132
141
  end
133
142
 
134
- @view_class.separator
143
+ @view_class.separator @repos.max_col
135
144
 
136
145
  @repos.save
137
- Messages.ok 'Repositories upgraded!'
146
+ Messages.ok "Repositories upgraded!"
138
147
  end
139
-
140
148
  end
141
-
142
149
  end
143
150
  end
@@ -1,40 +1,38 @@
1
+ # frozen_string_literal: true
1
2
 
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'zypper/upgraderepo/version'
3
+ require_relative "lib/zypper/upgraderepo/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = 'zypper-upgraderepo'
8
- spec.version = Zypper::Upgraderepo::VERSION
9
- spec.authors = ['Fabio Mucciante']
10
- spec.email = ['fabio.mucciante@gmail.com']
6
+ spec.name = "zypper-upgraderepo"
7
+ spec.version = Zypper::Upgraderepo::VERSION
8
+ spec.authors = ["Fabio Mucciante"]
9
+ spec.email = ["fabio.mucciante@gmail.com"]
11
10
 
12
- spec.summary = %q{Zypper addon to check and upgrade local repositories.}
13
- spec.description = %q{This is just a complement to zypper command which helps to upgrade the local repositories before executing zypper dup.}
14
- spec.homepage = 'https://github.com/fabiomux/zypper-upgraderepo'
15
- spec.license = 'GPL-3.0'
11
+ spec.summary = "Zypper addon to check and upgrade local repositories."
12
+ spec.description = "A complement to the zypper CLI tool to upgrade the repositories before executing zypper dup."
13
+ spec.homepage = "https://github.com/fabiomux/zypper-upgraderepo"
14
+ spec.license = "GPL-3.0"
15
+ spec.required_ruby_version = ">= 2.5.0"
16
16
 
17
- spec.metadata = {
18
- "bug_tracker_uri" => 'https://github.com/fabiomux/zypper-upgraderepo/issues',
19
- "changelog_uri" => 'https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelog',
20
- "documentation_uri" => "https://www.rubydoc.info/gems/zypper-upgraderepo/#{spec.version}",
21
- "homepage_uri" => 'https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html',
22
- #"mailing_list_uri" => '',
23
- "source_code_uri" => 'https://github.com/fabiomux/zypper-upgraderepo',
24
- "wiki_uri" => 'https://github.com/fabiomux/zypper-upgraderepo/wiki'
17
+ spec.metadata = {
18
+ "homepage_uri" => spec.homepage,
19
+ "source_code_uri" => "https://github.com/fabiomux/zypper-upgraderepo",
20
+ "changelog_uri" => "https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelog",
21
+ "wiki_uri" => "https://github.com/fabiomux/zypper-upgraderepo/wiki",
22
+ "rubygems_mfa_required" => "true"
25
23
  }
26
24
 
27
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
26
  f.match(%r{^(test|spec|features|.github)/|(.gitignore|.travis.yml|CODE_OF_CONDUCT.md)$})
29
27
  end
30
- spec.bindir = 'exe'
28
+ spec.bindir = "exe"
31
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
- spec.require_paths = ['lib']
30
+ spec.require_paths = ["lib"]
33
31
 
34
- spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'rspec', '~> 3.0'
32
+ spec.add_development_dependency "bundler", "~> 2.0"
33
+ spec.add_development_dependency "rake", "~> 13.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
37
35
 
38
- spec.add_runtime_dependency 'iniparse'
39
- spec.add_runtime_dependency 'minitar'
36
+ spec.add_runtime_dependency "iniparse"
37
+ spec.add_runtime_dependency "minitar"
40
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zypper-upgraderepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Mucciante
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-03 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,8 +80,8 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: This is just a complement to zypper command which helps to upgrade the
84
- local repositories before executing zypper dup.
83
+ description: A complement to the zypper CLI tool to upgrade the repositories before
84
+ executing zypper dup.
85
85
  email:
86
86
  - fabio.mucciante@gmail.com
87
87
  executables:
@@ -90,6 +90,7 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - ".rspec"
93
+ - ".rubocop.yml"
93
94
  - Gemfile
94
95
  - Gemfile.lock
95
96
  - LICENSE
@@ -114,12 +115,11 @@ homepage: https://github.com/fabiomux/zypper-upgraderepo
114
115
  licenses:
115
116
  - GPL-3.0
116
117
  metadata:
117
- bug_tracker_uri: https://github.com/fabiomux/zypper-upgraderepo/issues
118
- changelog_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelog
119
- documentation_uri: https://www.rubydoc.info/gems/zypper-upgraderepo/1.8.0
120
- homepage_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html
118
+ homepage_uri: https://github.com/fabiomux/zypper-upgraderepo
121
119
  source_code_uri: https://github.com/fabiomux/zypper-upgraderepo
120
+ changelog_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelog
122
121
  wiki_uri: https://github.com/fabiomux/zypper-upgraderepo/wiki
122
+ rubygems_mfa_required: 'true'
123
123
  post_install_message:
124
124
  rdoc_options: []
125
125
  require_paths:
@@ -128,14 +128,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 2.5.0
132
132
  required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.2.3
138
+ rubygems_version: 3.4.3
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Zypper addon to check and upgrade local repositories.