zypper-upgraderepo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,110 @@
1
+ module Zypper
2
+ module Upgraderepo
3
+
4
+ class ::String
5
+ def black; "\033[30m#{self}\033[0m" end
6
+ def red; "\033[31m#{self}\033[0m" end
7
+ def green; "\033[32m#{self}\033[0m" end
8
+ def yellow; "\033[33m#{self}\033[0m" end
9
+ def blue; "\033[34m#{self}\033[0m" end
10
+ def magenta; "\033[35m#{self}\033[0m" end
11
+ def cyan; "\033[36m#{self}\033[0m" end
12
+ def gray; "\033[37m#{self}\033[0m" end
13
+ def bg_black; "\033[40m#{self}\0330m" end
14
+ def bg_red; "\033[41m#{self}\033[0m" end
15
+ def bg_green; "\033[42m#{self}\033[0m" end
16
+ def bg_brown; "\033[43m#{self}\033[0m" end
17
+ def bg_blue; "\033[44m#{self}\033[0m" end
18
+ def bg_magenta; "\033[45m#{self}\033[0m" end
19
+ def bg_cyan; "\033[46m#{self}\033[0m" end
20
+ def bg_gray; "\033[47m#{self}\033[0m" end
21
+ def bold; "\033[1m#{self}\033[22m" end
22
+ def reverse_color; "\033[7m#{self}\033[27m" end
23
+ def cr; "\r#{self}" end
24
+ def clean; "\e[K#{self}" end
25
+ def new_line; "\n#{self}" end
26
+ end
27
+
28
+
29
+ class Messages
30
+
31
+ def self.error(e)
32
+ if e.class == String
33
+ puts '[E] '.bold.red + e
34
+ else
35
+ STDERR.puts 'Error! '.bold.red + e.message
36
+ end
37
+ end
38
+
39
+ def self.ok(m)
40
+ puts '[V] '.bold.green + m
41
+ end
42
+
43
+ def self.warning(m)
44
+ puts '[W] '.bold.yellow + m
45
+ end
46
+
47
+ def self.available(num, name, url, max_col)
48
+ Messages.ok("| #{num.to_s.rjust(2)} | #{name.ljust(max_col, ' ')} |")
49
+ end
50
+
51
+ def self.redirected(num, name, url, max_col, redirected)
52
+ Messages.warning("| #{num.to_s.rjust(2)} | #{name.ljust(max_col, ' ')} | Redirection of #{url} ")
53
+ puts "\t | #{ ' ' * max_col} | #{'To:'.bold.yellow} #{redirected}"
54
+ end
55
+
56
+ def self.not_found(num, name, url, max_col)
57
+ Messages.error("| #{num.to_s.rjust(2)} | #{name.ljust(max_col, ' ')}")
58
+ end
59
+
60
+ def self.alternative(num, name, url, max_col, res)
61
+ Messages.error("| #{num.to_s.rjust(2)} | #{name.ljust(max_col, ' ')} | #{res[:message].bold.yellow}")
62
+ puts "\t | #{' ' * max_col} | #{res[:url]}" unless res[:url].to_s.empty?
63
+ end
64
+
65
+ def self.separator
66
+ puts '-' * 90
67
+ end
68
+
69
+ def self.header(max_col)
70
+ p max_col
71
+ puts " St | # | #{'Name'.ljust(max_col, ' ')} | Hint"
72
+ end
73
+
74
+ def self.footer
75
+ self.separator
76
+ end
77
+ end
78
+
79
+
80
+ class ReleaseFileNotFound < StandardError
81
+ def initialize
82
+ super 'The release file is not found.'
83
+ end
84
+ end
85
+
86
+ class InvalidVersion < StandardError
87
+ def initialize(version)
88
+ super "The version #{version} is not valid"
89
+ end
90
+ end
91
+
92
+ class InvalidPermissions < StandardError
93
+ def initialize(filename)
94
+ super "Don't have the right permission to write #{filename}"
95
+ end
96
+ end
97
+
98
+ class AlreadyUpgraded < StandardError
99
+ def initialize(version)
100
+ super "The system is already upgraded to #{version}"
101
+ end
102
+ end
103
+
104
+ class NoConnection < StandardError
105
+ def initialize
106
+ super 'Internet connection has some trouble'
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,5 @@
1
+ module Zypper
2
+ module Upgraderepo
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "zypper/upgraderepo/version"
5
+
6
+ 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"]
11
+
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 v.3"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.16"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+
28
+ spec.add_runtime_dependency "iniparse"
29
+ spec.add_runtime_dependency "minitar"
30
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zypper-upgraderepo
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Mucciante
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: iniparse
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitar
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
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.
85
+ email:
86
+ - fabio.mucciante@gmail.com
87
+ executables:
88
+ - zypper-upgraderepo
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".travis.yml"
95
+ - CODE_OF_CONDUCT.md
96
+ - Gemfile
97
+ - Gemfile.lock
98
+ - LICENSE
99
+ - README.md
100
+ - Rakefile
101
+ - bin/console
102
+ - bin/setup
103
+ - exe/zypper-upgraderepo
104
+ - lib/zypper/upgraderepo.rb
105
+ - lib/zypper/upgraderepo/cli.rb
106
+ - lib/zypper/upgraderepo/os_release.rb
107
+ - lib/zypper/upgraderepo/repository.rb
108
+ - lib/zypper/upgraderepo/utils.rb
109
+ - lib/zypper/upgraderepo/version.rb
110
+ - zypper-upgraderepo.gemspec
111
+ homepage: https://github.com/fabiomux/zypper-upgraderepo
112
+ licenses:
113
+ - GPL v.3
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.6.14
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: Zypper addon to check and upgrade local repositories.
135
+ test_files: []