zypper-onlinesearch 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dc869b470d64f775fc321bd9b677a08a6f166d8d48e8341dc897d58cf3ee3cb
4
- data.tar.gz: d9afc178408c4d609ba9e6c2f885e9b9a7a1fff389f9dcd2117aa4eadc1b2ecc
3
+ metadata.gz: c1efabb18f7e49b9c21fc06a529bc07e67c73e15bb5ff43cbb574f4cfe69295b
4
+ data.tar.gz: 3a9e48f16004fc4b65b3d34336a1fb56bfd9729716262e1663239ee6a51d86ae
5
5
  SHA512:
6
- metadata.gz: 7f1345be095db1d73c03e2368a9bc5c4dcdee5036eef66c0e355cb0a8ab6704f2218f277056abe1773c8ec2f559ee9f962441cf77dc0729f8adf5f2b063cf452
7
- data.tar.gz: 01d0bfdc95141355f6bbf51ce1c790e6582226dc08dced07155e7dd515af9e3e642da2ac87d870d4d209f70ca9358e97901710869df2f27f269521bd0769e34b
6
+ metadata.gz: 3d8b1ddd8ed7fe055b357cab2016fcf65039b66261bb6c3f39b4a0600600656b70fd5c0ea8484421d20b1b21b7932a91e8053805d60ee069864f5ebd1ae37ef0
7
+ data.tar.gz: 47b3d94558eab162410fdb46d754b4a9e0aaa18db4a63334f2e741ce01f9233253b3954e031fc14eda6e9f198fb035fa92036f93072f1ad8bc2ddba10fa1d0e9
data/.rubocop.yml CHANGED
@@ -56,9 +56,6 @@ Metrics/CyclomaticComplexity:
56
56
  - './lib/**/onlinesearch.rb'
57
57
  - './lib/**/data.rb'
58
58
 
59
- Lint/UriEscapeUnescape:
60
- Enabled: false
61
-
62
59
  Metrics/ParameterLists:
63
60
  Enabled: true
64
61
  Exclude:
@@ -68,17 +65,3 @@ Security/MarshalLoad:
68
65
  Enabled: true
69
66
  Exclude:
70
67
  - './lib/**/cache.rb'
71
-
72
- Style/SingleLineMethods:
73
- Enabled: true
74
- Exclude:
75
- - './lib/**/utils.rb'
76
-
77
- Style/FrozenStringLiteralComment:
78
- Enabled: true
79
- Exclude:
80
- - './bin/*'
81
- - './exe/*'
82
-
83
- Style/OptionalBooleanParameter:
84
- Enabled: false
data/Gemfile.lock CHANGED
@@ -1,67 +1,79 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zypper-onlinesearch (1.2.0)
4
+ zypper-onlinesearch (1.3.0)
5
5
  iniparse
6
6
  nokogiri
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ast (2.4.2)
12
- diff-lcs (1.5.0)
11
+ ast (2.4.3)
12
+ diff-lcs (1.6.2)
13
13
  iniparse (1.5.0)
14
- json (2.7.1)
15
- mini_portile2 (2.8.5)
16
- nokogiri (1.13.10)
17
- mini_portile2 (~> 2.8.0)
14
+ json (2.18.0)
15
+ language_server-protocol (3.17.0.5)
16
+ lint_roller (1.1.0)
17
+ nokogiri (1.18.10-x86_64-linux-gnu)
18
18
  racc (~> 1.4)
19
- parallel (1.24.0)
20
- parser (3.3.0.5)
19
+ parallel (1.27.0)
20
+ parser (3.3.10.0)
21
21
  ast (~> 2.4.1)
22
22
  racc
23
- racc (1.7.3)
23
+ prism (1.6.0)
24
+ racc (1.8.1)
24
25
  rainbow (3.1.1)
25
- rake (13.1.0)
26
- regexp_parser (2.9.0)
27
- rexml (3.2.6)
28
- rspec (3.12.0)
29
- rspec-core (~> 3.12.0)
30
- rspec-expectations (~> 3.12.0)
31
- rspec-mocks (~> 3.12.0)
32
- rspec-core (3.12.2)
33
- rspec-support (~> 3.12.0)
34
- rspec-expectations (3.12.3)
26
+ rake (13.3.1)
27
+ regexp_parser (2.11.3)
28
+ rspec (3.13.2)
29
+ rspec-core (~> 3.13.0)
30
+ rspec-expectations (~> 3.13.0)
31
+ rspec-mocks (~> 3.13.0)
32
+ rspec-core (3.13.6)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-expectations (3.13.5)
35
35
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.12.0)
37
- rspec-mocks (3.12.6)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-mocks (3.13.7)
38
38
  diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.12.0)
40
- rspec-support (3.12.1)
41
- rubocop (1.50.2)
39
+ rspec-support (~> 3.13.0)
40
+ rspec-support (3.13.6)
41
+ rubocop (1.82.0)
42
42
  json (~> 2.3)
43
+ language_server-protocol (~> 3.17.0.2)
44
+ lint_roller (~> 1.1.0)
43
45
  parallel (~> 1.10)
44
- parser (>= 3.2.0.0)
46
+ parser (>= 3.3.0.2)
45
47
  rainbow (>= 2.2.2, < 4.0)
46
- regexp_parser (>= 1.8, < 3.0)
47
- rexml (>= 3.2.5, < 4.0)
48
- rubocop-ast (>= 1.28.0, < 2.0)
48
+ regexp_parser (>= 2.9.3, < 3.0)
49
+ rubocop-ast (>= 1.48.0, < 2.0)
49
50
  ruby-progressbar (~> 1.7)
50
- unicode-display_width (>= 2.4.0, < 3.0)
51
- rubocop-ast (1.30.0)
52
- parser (>= 3.2.1.0)
53
- rubocop-capybara (2.18.0)
54
- rubocop (~> 1.41)
51
+ unicode-display_width (>= 2.4.0, < 4.0)
52
+ rubocop-ast (1.48.0)
53
+ parser (>= 3.3.7.2)
54
+ prism (~> 1.4)
55
+ rubocop-capybara (2.22.1)
56
+ lint_roller (~> 1.1)
57
+ rubocop (~> 1.72, >= 1.72.1)
58
+ rubocop-factory_bot (2.28.0)
59
+ lint_roller (~> 1.1)
60
+ rubocop (~> 1.72, >= 1.72.1)
55
61
  rubocop-rake (0.6.0)
56
62
  rubocop (~> 1.0)
57
- rubocop-rspec (2.20.0)
58
- rubocop (~> 1.33)
63
+ rubocop-rspec (2.31.0)
64
+ rubocop (~> 1.40)
59
65
  rubocop-capybara (~> 2.17)
66
+ rubocop-factory_bot (~> 2.22)
67
+ rubocop-rspec_rails (~> 2.28)
68
+ rubocop-rspec_rails (2.29.1)
69
+ rubocop (~> 1.61)
60
70
  ruby-progressbar (1.13.0)
61
- unicode-display_width (2.5.0)
71
+ unicode-display_width (3.2.0)
72
+ unicode-emoji (~> 4.1)
73
+ unicode-emoji (4.2.0)
62
74
 
63
75
  PLATFORMS
64
- ruby
76
+ x86_64-linux-gnu
65
77
 
66
78
  DEPENDENCIES
67
79
  rake (~> 13.0)
@@ -72,4 +84,4 @@ DEPENDENCIES
72
84
  zypper-onlinesearch!
73
85
 
74
86
  BUNDLED WITH
75
- 2.4.3
87
+ 2.4.22
data/exe/onlinesearch CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "zypper/onlinesearch/cli"
4
5
 
@@ -44,7 +44,7 @@ module Zypper
44
44
  private
45
45
 
46
46
  def query_to_filename(query)
47
- URI.encode query.delete("./")
47
+ URI::DEFAULT_PARSER.escape query.delete("./")
48
48
  end
49
49
  end
50
50
  end
@@ -69,7 +69,7 @@ module Zypper
69
69
  cards.each do |c|
70
70
  url = expand_link(c.xpath(XPATH_URL).text)
71
71
  name = c.xpath(XPATH_NAME).text
72
- name = File.basename(url) == name ? name : "#{File.basename(url)} (#{name})"
72
+ name = "#{File.basename(url)} (#{name})" if File.basename(url) != name
73
73
  res << { name: name, description: c.xpath(XPATH_DESC).text.strip.gsub(/\n|\ +/, " "), url: url }
74
74
  end
75
75
 
@@ -170,7 +170,7 @@ module Zypper
170
170
 
171
171
  @page.xpath(XPATH_UNSUPPORTED).each_with_index do |ver, i|
172
172
  extract(ver, res, :unsupported,
173
- XPATH_UNSUPPORTED_LABEL.gsub(/_n_/, i.next.to_s),
173
+ XPATH_UNSUPPORTED_LABEL.gsub("_n_", i.next.to_s),
174
174
  XPATH_UNSUPPORTED_VERSION, XPATH_UNSUPPORTED_LINK)
175
175
  end
176
176
 
@@ -208,7 +208,7 @@ module Zypper
208
208
  link = expand_link(pack.xpath(xpath_link).text)
209
209
 
210
210
  if repo =~ /Expert Download/
211
- res[:versions] << { distro: ver.text.gsub(/:/, " "), link: link, type: type,
211
+ res[:versions] << { distro: ver.text.gsub(":", " "), link: link, type: type,
212
212
  repo: @old_repo, format: :extra, arch: arch, version: version }
213
213
  next
214
214
  end
@@ -249,7 +249,7 @@ module Zypper
249
249
 
250
250
  @page.xpath(XPATH_PACKAGES).each do |pack|
251
251
  version = pack.xpath(XPATH_VERSION).text.split("-")[0].to_s
252
- distro = pack.xpath(XPATH_DISTRO).text.gsub(/_/, " ")
252
+ distro = pack.xpath(XPATH_DISTRO).text.gsub("_", " ")
253
253
  arch = pack.xpath(XPATH_ARCH).text.strip.to_sym
254
254
  link = pack.xpath(XPATH_LINK).text
255
255
 
@@ -322,7 +322,7 @@ module Zypper
322
322
 
323
323
  def data
324
324
  res = { versions: [] }
325
- distro = @page.xpath(XPATH_LINK_DISTRO).text.gsub(/_/, " ")
325
+ distro = @page.xpath(XPATH_LINK_DISTRO).text.gsub("_", " ")
326
326
  @page.xpath(XPATH_LINK_BIN).each do |pack|
327
327
  link = pack.text
328
328
  res[:versions] << {
@@ -145,8 +145,8 @@ module Zypper
145
145
  URL = "https://software.opensuse.org/search"
146
146
 
147
147
  def initialize(query, cache, timeout, cookies = [])
148
- super query, cache, timeout,
149
- cookies << "baseproject=ALL;search_devel=true;search_debug=false;search_lang=false"
148
+ super(query, cache, timeout,
149
+ cookies << "baseproject=ALL;search_devel=true;search_debug=false;search_lang=false")
150
150
  end
151
151
 
152
152
  def uri
@@ -178,12 +178,12 @@ module Zypper
178
178
  URL = "https://software.opensuse.org/package/"
179
179
 
180
180
  def initialize(query, cache, timeout, cookies = [])
181
- super query, cache, timeout,
182
- cookies << "baseproject=ALL;search_devel=true;search_debug=false;search_lang=false"
181
+ super(query, cache, timeout,
182
+ cookies << "baseproject=ALL;search_devel=true;search_debug=false;search_lang=false")
183
183
  end
184
184
 
185
185
  def uri
186
- URI(URL + URI.encode(@query))
186
+ URI(URL + URI::DEFAULT_PARSER.escape(@query))
187
187
  end
188
188
  end
189
189
 
@@ -194,7 +194,7 @@ module Zypper
194
194
  URL = "http://packman.links2linux.org/package/"
195
195
 
196
196
  def uri
197
- URI(URL + URI.encode(@query))
197
+ URI(URL + URI::DEFAULT_PARSER.escape(@query))
198
198
  end
199
199
  end
200
200
  end
@@ -208,7 +208,7 @@ module Zypper
208
208
 
209
209
  def initialize(query, refresh, timeout = 60, cookies = [])
210
210
  query = URI(query).query
211
- super query, refresh, timeout, cookies
211
+ super
212
212
  end
213
213
 
214
214
  def uri
@@ -224,11 +224,11 @@ module Zypper
224
224
 
225
225
  def initialize(query, refresh, timeout = 60, cookies = [])
226
226
  query = query.split("/")[-2..-1].join("/") if query =~ %r{://}
227
- super query, refresh, timeout, cookies
227
+ super
228
228
  end
229
229
 
230
230
  def uri
231
- URI(@query =~ %r{://} ? @query : "#{URL}#{URI.encode(@query)}")
231
+ URI(@query =~ %r{://} ? @query : "#{URL}#{URI::DEFAULT_PARSER.escape(@query)}")
232
232
  end
233
233
  end
234
234
  end
@@ -9,28 +9,93 @@ module Zypper
9
9
  # String class patch.
10
10
  #
11
11
  class ::String
12
- def black; "\033[30m#{self}\033[0m" end
13
- def red; "\033[31m#{self}\033[0m" end
14
- def green; "\033[32m#{self}\033[0m" end
15
- def yellow; "\033[33m#{self}\033[0m" end
16
- def blue; "\033[34m#{self}\033[0m" end
17
- def magenta; "\033[35m#{self}\033[0m" end
18
- def cyan; "\033[36m#{self}\033[0m" end
19
- def gray; "\033[37m#{self}\033[0m" end
20
- def bg_black; "\033[40m#{self}\0330m" end
21
- def bg_red; "\033[41m#{self}\033[0m" end
22
- def bg_green; "\033[42m#{self}\033[0m" end
23
- def bg_brown; "\033[43m#{self}\033[0m" end
24
- def bg_blue; "\033[44m#{self}\033[0m" end
25
- def bg_magenta; "\033[45m#{self}\033[0m" end
26
- def bg_cyan; "\033[46m#{self}\033[0m" end
27
- def bg_gray; "\033[47m#{self}\033[0m" end
28
- def bold; "\033[1m#{self}\033[22m" end
29
- def reverse_color; "\033[7m#{self}\033[27m" end
30
- def cr; "\r#{self}" end
31
- def clean; "\e[K#{self}" end
32
- def new_line; "\n#{self}" end
33
- def none; self end
12
+ def black
13
+ "\033[30m#{self}\033[0m"
14
+ end
15
+
16
+ def red
17
+ "\033[31m#{self}\033[0m"
18
+ end
19
+
20
+ def green
21
+ "\033[32m#{self}\033[0m"
22
+ end
23
+
24
+ def yellow
25
+ "\033[33m#{self}\033[0m"
26
+ end
27
+
28
+ def blue
29
+ "\033[34m#{self}\033[0m"
30
+ end
31
+
32
+ def magenta
33
+ "\033[35m#{self}\033[0m"
34
+ end
35
+
36
+ def cyan
37
+ "\033[36m#{self}\033[0m"
38
+ end
39
+
40
+ def gray
41
+ "\033[37m#{self}\033[0m"
42
+ end
43
+
44
+ def bg_black
45
+ "\033[40m#{self}\0330m"
46
+ end
47
+
48
+ def bg_red
49
+ "\033[41m#{self}\033[0m"
50
+ end
51
+
52
+ def bg_green
53
+ "\033[42m#{self}\033[0m"
54
+ end
55
+
56
+ def bg_brown
57
+ "\033[43m#{self}\033[0m"
58
+ end
59
+
60
+ def bg_blue
61
+ "\033[44m#{self}\033[0m"
62
+ end
63
+
64
+ def bg_magenta
65
+ "\033[45m#{self}\033[0m"
66
+ end
67
+
68
+ def bg_cyan
69
+ "\033[46m#{self}\033[0m"
70
+ end
71
+
72
+ def bg_gray
73
+ "\033[47m#{self}\033[0m"
74
+ end
75
+
76
+ def bold
77
+ "\033[1m#{self}\033[22m"
78
+ end
79
+
80
+ def reverse_color
81
+ "\033[7m#{self}\033[27m"
82
+ end
83
+
84
+ def cr
85
+ "\r#{self}"
86
+ end
87
+
88
+ def clean
89
+ "\e[K#{self}"
90
+ end
91
+
92
+ def new_line
93
+ "\n#{self}"
94
+ end
95
+
96
+ def none
97
+ self
98
+ end
34
99
  end
35
100
 
36
101
  #
@@ -92,7 +157,7 @@ module Zypper
92
157
  #
93
158
  class QueryStringTooShort < StandardError
94
159
  def initialize(query)
95
- super "The query string '#{query}' is too short, be sure to use more than 3 characters."
160
+ super("The query string '#{query}' is too short, be sure to use more than 3 characters.")
96
161
  end
97
162
 
98
163
  def error_code
@@ -105,7 +170,7 @@ module Zypper
105
170
  #
106
171
  class TooManyRedirections < StandardError
107
172
  def initialize(url)
108
- super "#{url} generates too many redirections!"
173
+ super("#{url} generates too many redirections!")
109
174
  end
110
175
  end
111
176
 
@@ -114,7 +179,7 @@ module Zypper
114
179
  #
115
180
  class InvalidEngine < StandardError
116
181
  def initialize(engine)
117
- super "#{engine} is not a valid engine!"
182
+ super("#{engine} is not a valid engine!")
118
183
  end
119
184
 
120
185
  def error_code
@@ -127,7 +192,7 @@ module Zypper
127
192
  #
128
193
  class MissingItemNumber < StandardError
129
194
  def initialize
130
- super "No item number has been provided!"
195
+ super("No item number has been provided!")
131
196
  end
132
197
  end
133
198
 
@@ -136,7 +201,7 @@ module Zypper
136
201
  #
137
202
  class EmptyCache < StandardError
138
203
  def initialize
139
- super "The cache folder is already empty!"
204
+ super("The cache folder is already empty!")
140
205
  end
141
206
  end
142
207
 
@@ -145,7 +210,7 @@ module Zypper
145
210
  #
146
211
  class NoConnection < StandardError
147
212
  def initialize
148
- super "Internet connection has some trouble"
213
+ super("Internet connection has some trouble")
149
214
  end
150
215
 
151
216
  def error_code
@@ -158,7 +223,7 @@ module Zypper
158
223
  #
159
224
  class Interruption < StandardError
160
225
  def initialize
161
- super "Ok ok... Exiting!"
226
+ super("Ok ok... Exiting!")
162
227
  end
163
228
  end
164
229
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Zypper
4
4
  module Onlinesearch
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
@@ -144,7 +144,7 @@ module Zypper
144
144
 
145
145
  def self.no_packages(compatible)
146
146
  separator
147
- puts "#{" " * 3} - | No #{compatible ? "compatible" : ""} packages found!"
147
+ puts "#{" " * 3} - | No #{compatible ? "compatible" : nil.to_s} packages found!"
148
148
  separator
149
149
  end
150
150
 
@@ -262,7 +262,7 @@ module Zypper
262
262
  #
263
263
  class Table < Common
264
264
  def self.header(args)
265
- super args
265
+ super
266
266
  separator
267
267
  puts "#{" " * 3} # | Format | Arch | Link"
268
268
  separator
@@ -100,7 +100,7 @@ module Zypper
100
100
  refresh: @search.refresh,
101
101
  query: pack[:link]
102
102
 
103
- result.engines.each do |_k, v|
103
+ result.engines.each_value do |v|
104
104
  next unless v.available?
105
105
 
106
106
  v.to_data[:versions].each do |f|
@@ -108,10 +108,10 @@ module Zypper
108
108
  f[:repo] = pack[:repo]
109
109
  f[:version] ||= pack[:version]
110
110
  f[:distro] ||= pack[:distro]
111
- packages << f if package_select?(f, true)
111
+ packages << f if package_select?(f, format_and_arch: true)
112
112
  end
113
113
  end
114
- elsif package_select?(pack, true)
114
+ elsif package_select?(pack, format_and_arch: true)
115
115
  packages << pack
116
116
  end
117
117
  end
@@ -137,7 +137,7 @@ module Zypper
137
137
  refresh: @search.refresh,
138
138
  cache_time: args[:cache_time]
139
139
 
140
- if packages.count.positive?
140
+ if packages.any?
141
141
  @view_class.header first_col: packages.max_column(args[:first_col]),
142
142
  second_col: packages.max_column(args[:second_col])
143
143
 
@@ -157,7 +157,7 @@ module Zypper
157
157
  @arch == :compatible ? @release.arch : :all
158
158
  end
159
159
 
160
- def package_select?(package, format_and_arch = false)
160
+ def package_select?(package, format_and_arch: false)
161
161
  res = if @arch == :compatible
162
162
  [:src, :noarch, @release.arch].include?(package[:arch])
163
163
  else
@@ -165,8 +165,7 @@ module Zypper
165
165
  end
166
166
 
167
167
  if @distributions == :compatible
168
- res &&= ((package[:distro] == :current) ||
169
- package[:distro].match?(Regexp.new(@release.pretty_name, "i")))
168
+ res &&= (package[:distro] == :current) || package[:distro].match?(Regexp.new(@release.pretty_name, "i"))
170
169
  end
171
170
  res = false unless @types.include?(package[:type])
172
171
 
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- spec.add_runtime_dependency "iniparse"
36
- spec.add_runtime_dependency "nokogiri"
35
+ spec.add_dependency "iniparse"
36
+ spec.add_dependency "nokogiri"
37
37
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zypper-onlinesearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Mucciante
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: iniparse
@@ -76,7 +75,6 @@ metadata:
76
75
  changelog_uri: https://freeaptitude.altervista.org/projects/zypper-onlinesearch.html#changelog
77
76
  wiki_uri: https://github.com/fabiomux/zypper-onlinesearch/wiki
78
77
  rubygems_mfa_required: 'true'
79
- post_install_message:
80
78
  rdoc_options: []
81
79
  require_paths:
82
80
  - lib
@@ -91,8 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
89
  - !ruby/object:Gem::Version
92
90
  version: '0'
93
91
  requirements: []
94
- rubygems_version: 3.4.3
95
- signing_key:
92
+ rubygems_version: 3.6.7
96
93
  specification_version: 4
97
94
  summary: Zypper addon to search packages online through the openSUSE software search
98
95
  website.