searchlink 2.3.94 → 2.3.96
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 +4 -4
- data/lib/searchlink/exceptions.rb +7 -7
- data/lib/searchlink/searches.rb +14 -12
- data/lib/searchlink/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d445ad4fb2dc023cf6ee756b86ded361fd2bfa48de2d02579782cd2852a3b499
|
|
4
|
+
data.tar.gz: de9d2f8af33300afd14620942f89f5259a41bf37f12a61113ba78188422e0089
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e2230a1585c5a1b5187d6cc74ef61eb7112ff654d0c1d57a9a6988ba2f69fce3263750d2b87b0fa20ecf7a0796ce7111c0cda175af13b41ed8cb1d8281ba5af
|
|
7
|
+
data.tar.gz: 8b8c98c58f74237049a2aad1b5ac5ff72a9ed47f3e8068a8156333e66b924af665a52d98e130ac2886de8caedb7107900e3aa93ec77104636079f43eced82b7f
|
|
@@ -5,25 +5,25 @@ module SL
|
|
|
5
5
|
class VersionError < StandardError
|
|
6
6
|
def initialize(msg)
|
|
7
7
|
msg = msg ? ": #{msg}" : ""
|
|
8
|
-
|
|
8
|
+
warn "Versioning error#{msg}"
|
|
9
9
|
|
|
10
|
-
super()
|
|
10
|
+
super("Versioning error#{msg}")
|
|
11
11
|
|
|
12
12
|
Process.exit 1
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# Custom plugin error
|
|
16
|
+
# Custom plugin error. Does not abort the process; callers that load
|
|
17
|
+
# optional plugins should rescue this and continue.
|
|
17
18
|
class PluginError < StandardError
|
|
18
19
|
def initialize(msg = nil, plugin: nil)
|
|
19
20
|
plugin = %("#{plugin}") if plugin
|
|
20
21
|
plugin ||= "plugin"
|
|
21
22
|
msg = ": #{msg}" if msg
|
|
22
|
-
|
|
23
|
+
message = "Error in #{plugin}#{msg}"
|
|
24
|
+
warn message
|
|
23
25
|
|
|
24
|
-
super()
|
|
25
|
-
|
|
26
|
-
Process.exit 1
|
|
26
|
+
super(message)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
data/lib/searchlink/searches.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module SL
|
|
4
4
|
# Searches and plugin registration
|
|
5
|
+
# rubocop:disable Metrics/ModuleLength
|
|
5
6
|
module Searches
|
|
6
7
|
class << self
|
|
7
8
|
def plugins
|
|
@@ -132,27 +133,24 @@ module SL
|
|
|
132
133
|
plugins_folder = File.expand_path("~/.local/searchlink/plugins")
|
|
133
134
|
new_plugins_folder = File.expand_path("~/.config/searchlink/plugins")
|
|
134
135
|
|
|
135
|
-
if File.directory?(plugins_folder) && !File.directory?(new_plugins_folder)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
load_custom_scripts(plugins_folder)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
return unless File.directory?(new_plugins_folder)
|
|
136
|
+
load_custom_folder(plugins_folder) if File.directory?(plugins_folder) && !File.directory?(new_plugins_folder)
|
|
137
|
+
load_custom_folder(new_plugins_folder) if File.directory?(new_plugins_folder)
|
|
138
|
+
end
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
def load_custom_folder(plugins_folder)
|
|
141
|
+
Dir.glob(File.join(plugins_folder, "**/*.rb")).sort.each do |plugin|
|
|
146
142
|
require plugin
|
|
143
|
+
rescue PluginError, LoadError, StandardError => e
|
|
144
|
+
warn "Skipping plugin #{File.basename(plugin)}: #{e.message}"
|
|
147
145
|
end
|
|
148
146
|
|
|
149
|
-
load_custom_scripts(
|
|
147
|
+
load_custom_scripts(plugins_folder)
|
|
150
148
|
end
|
|
151
149
|
|
|
152
150
|
def load_custom_scripts(plugins_folder)
|
|
153
151
|
Dir.glob(File.join(plugins_folder, "**/*.{json,yml,yaml}")).each do |file|
|
|
154
152
|
ext = File.extname(file).sub(/^\./, "")
|
|
155
|
-
config =
|
|
153
|
+
config = File.read(file)
|
|
156
154
|
|
|
157
155
|
cfg = case ext
|
|
158
156
|
when /^y/i
|
|
@@ -163,6 +161,9 @@ module SL
|
|
|
163
161
|
cfg["filename"] = File.basename(file)
|
|
164
162
|
cfg["path"] = file.shorten_path
|
|
165
163
|
SL::ScriptSearch.new(cfg)
|
|
164
|
+
rescue PluginError, JSON::ParserError, Psych::SyntaxError => e
|
|
165
|
+
warn "Skipping plugin #{File.basename(file)}: #{e.message}"
|
|
166
|
+
next
|
|
166
167
|
end
|
|
167
168
|
end
|
|
168
169
|
|
|
@@ -179,6 +180,7 @@ module SL
|
|
|
179
180
|
end
|
|
180
181
|
end
|
|
181
182
|
end
|
|
183
|
+
# rubocop:enable Metrics/ModuleLength
|
|
182
184
|
end
|
|
183
185
|
|
|
184
186
|
# import
|
data/lib/searchlink/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: searchlink
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.96
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brett Terpstra
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|