searchlink 2.3.74 → 2.3.77

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/searchlink/config.rb +23 -23
  3. data/lib/searchlink/curl/html.rb +38 -38
  4. data/lib/searchlink/curl/json.rb +19 -17
  5. data/lib/searchlink/curl.rb +2 -2
  6. data/lib/searchlink/exceptions.rb +2 -2
  7. data/lib/searchlink/help.rb +13 -13
  8. data/lib/searchlink/output.rb +21 -21
  9. data/lib/searchlink/parse.rb +116 -113
  10. data/lib/searchlink/plist.rb +11 -11
  11. data/lib/searchlink/script_plugin.rb +10 -10
  12. data/lib/searchlink/search.rb +6 -6
  13. data/lib/searchlink/searches/amazon.rb +4 -4
  14. data/lib/searchlink/searches/applemusic.rb +28 -28
  15. data/lib/searchlink/searches/bitly.rb +11 -11
  16. data/lib/searchlink/searches/definition.rb +7 -7
  17. data/lib/searchlink/searches/duckduckgo.rb +31 -27
  18. data/lib/searchlink/searches/github.rb +48 -48
  19. data/lib/searchlink/searches/google.rb +16 -16
  20. data/lib/searchlink/searches/helpers/chromium.rb +46 -46
  21. data/lib/searchlink/searches/helpers/firefox.rb +20 -20
  22. data/lib/searchlink/searches/helpers/safari.rb +14 -14
  23. data/lib/searchlink/searches/history.rb +78 -78
  24. data/lib/searchlink/searches/hook.rb +5 -5
  25. data/lib/searchlink/searches/itunes.rb +37 -37
  26. data/lib/searchlink/searches/lastfm.rb +13 -13
  27. data/lib/searchlink/searches/linkding.rb +14 -14
  28. data/lib/searchlink/searches/lyrics.rb +11 -11
  29. data/lib/searchlink/searches/pinboard.rb +35 -35
  30. data/lib/searchlink/searches/social.rb +45 -56
  31. data/lib/searchlink/searches/software.rb +4 -4
  32. data/lib/searchlink/searches/spelling.rb +10 -10
  33. data/lib/searchlink/searches/spotlight.rb +4 -4
  34. data/lib/searchlink/searches/stackoverflow.rb +5 -5
  35. data/lib/searchlink/searches/tmdb.rb +17 -17
  36. data/lib/searchlink/searches/twitter.rb +8 -8
  37. data/lib/searchlink/searches/wikipedia.rb +4 -4
  38. data/lib/searchlink/searches/youtube.rb +7 -7
  39. data/lib/searchlink/searches.rb +16 -16
  40. data/lib/searchlink/semver.rb +4 -4
  41. data/lib/searchlink/string.rb +55 -55
  42. data/lib/searchlink/url.rb +30 -32
  43. data/lib/searchlink/util.rb +3 -3
  44. data/lib/searchlink/version.rb +19 -21
  45. data/lib/searchlink/which.rb +5 -5
  46. data/lib/searchlink.rb +31 -31
  47. metadata +31 -18
  48. data/lib/tokens.rb +0 -3
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SL
4
- VERSION = '2.3.74'
4
+ VERSION = '2.3.77'
5
5
  end
6
6
 
7
7
  # Main module
8
8
  module SL
9
9
  class << self
10
10
  def version_check
11
- cachefile = File.expand_path('~/.config/searchlink/cache/update.txt')
11
+ cachefile = File.expand_path("~/.config/searchlink/cache/update.txt")
12
12
 
13
13
  FileUtils.mkdir_p(File.dirname(cachefile)) unless File.directory?(File.dirname(cachefile))
14
14
 
@@ -29,11 +29,9 @@ module SL
29
29
  latest = SemVer.new(latest_tag)
30
30
  current = SemVer.new(SL::VERSION)
31
31
 
32
- File.open(cachefile, 'w') { |f| f.puts("#{last_time.strftime('%c')}|#{latest}") }
32
+ File.open(cachefile, "w") { |f| f.puts("#{last_time.strftime("%c")}|#{latest}") }
33
33
 
34
- if latest_tag && current.older_than(latest)
35
- return "SearchLink v#{current}, #{latest} available. Run 'update' to download."
36
- end
34
+ return "SearchLink v#{current}, #{latest} available. Run \"update\" to download." if latest_tag && current.older_than(latest)
37
35
 
38
36
  "SearchLink v#{current}"
39
37
  end
@@ -43,17 +41,17 @@ module SL
43
41
  # @return false if no new version, or semantic version of latest release
44
42
  def new_version?
45
43
  headers = {
46
- 'Accept' => 'application/vnd.github+json',
47
- 'X-GitHub-Api-Version' => '2022-11-28'
44
+ "Accept" => "application/vnd.github+json",
45
+ "X-GitHub-Api-Version" => "2022-11-28",
48
46
  }
49
- headers['Authorization'] = "Bearer #{Secrets::GH_AUTH_TOKEN}" if defined? Secrets::GH_AUTH_TOKEN
47
+ headers["Authorization"] = "Bearer #{Secrets::GH_AUTH_TOKEN}" if defined? Secrets::GH_AUTH_TOKEN
50
48
 
51
- url = 'https://api.github.com/repos/ttscoff/searchlink/releases/latest'
49
+ url = "https://api.github.com/repos/ttscoff/searchlink/releases/latest"
52
50
  page = Curl::Json.new(url, headers: headers)
53
51
  result = page.json
54
52
 
55
53
  if result
56
- latest_tag = result['tag_name']
54
+ latest_tag = result["tag_name"]
57
55
 
58
56
  return false unless latest_tag
59
57
 
@@ -64,7 +62,7 @@ module SL
64
62
 
65
63
  return latest_tag if current.older_than(latest)
66
64
  else
67
- warn 'Check for new version failed.'
65
+ warn "Check for new version failed."
68
66
  end
69
67
 
70
68
  false
@@ -72,24 +70,24 @@ module SL
72
70
 
73
71
  def update_searchlink
74
72
  if `uname`.strip !~ /Darwin/
75
- add_output('Auto updating only available on macOS')
73
+ add_output("Auto updating only available on macOS")
76
74
  return
77
75
  end
78
76
 
79
77
  new_version = SL.new_version?
80
78
  if new_version
81
- folder = File.expand_path('~/Downloads')
82
- services = File.expand_path('~/Library/Services')
83
- dl = File.join(folder, 'SearchLink.zip')
84
- curl = TTY::Which.which('curl')
79
+ folder = File.expand_path("~/Downloads")
80
+ services = File.expand_path("~/Library/Services")
81
+ dl = File.join(folder, "SearchLink.zip")
82
+ curl = TTY::Which.which("curl")
85
83
  `#{curl} -SsL -o "#{dl}" https://github.com/ttscoff/searchlink/releases/latest/download/SearchLink.zip`
86
84
  Dir.chdir(folder)
87
85
  `unzip -qo #{dl} -d #{folder}`
88
86
  FileUtils.rm(dl)
89
87
 
90
- ['SearchLink', 'SearchLink File', 'Jump to SearchLink Error'].each do |workflow|
88
+ ["SearchLink", "SearchLink File", "Jump to SearchLink Error"].each do |workflow|
91
89
  wflow = "#{workflow}.workflow"
92
- src = File.join(folder, 'SearchLink Services', wflow)
90
+ src = File.join(folder, "SearchLink Services", wflow)
93
91
  dest = File.join(services, wflow)
94
92
  if File.exist?(src) && File.exist?(dest)
95
93
  FileUtils.rm_rf(dest)
@@ -97,9 +95,9 @@ module SL
97
95
  end
98
96
  end
99
97
  add_output("Installed SearchLink #{new_version}")
100
- FileUtils.rm_rf('SearchLink Services')
98
+ FileUtils.rm_rf("SearchLink Services")
101
99
  else
102
- add_output('Already up to date.')
100
+ add_output("Already up to date.")
103
101
  end
104
102
  end
105
103
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  module TTY
7
7
  module Which
8
- VERSION = '0.5.0'
8
+ VERSION = "0.5.0"
9
9
  end
10
10
  end
11
11
 
@@ -84,7 +84,7 @@ module TTY
84
84
  # the array of paths to search
85
85
  #
86
86
  # @api private
87
- def search_paths(path = ENV['PATH'])
87
+ def search_paths(path = ENV["PATH"])
88
88
  paths = if path && !path.empty?
89
89
  path.split(::File::PATH_SEPARATOR)
90
90
  else
@@ -106,10 +106,10 @@ module TTY
106
106
  # an array with valid file extensions
107
107
  #
108
108
  # @api private
109
- def extensions(path_ext = ENV['PATHEXT'])
110
- return [''] unless path_ext
109
+ def extensions(path_ext = ENV["PATHEXT"])
110
+ return [""] unless path_ext
111
111
 
112
- path_ext.split(::File::PATH_SEPARATOR).select { |part| part.include?('.') }
112
+ path_ext.split(::File::PATH_SEPARATOR).select { |part| part.include?(".") }
113
113
  end
114
114
 
115
115
  # Determines if filename is an executable file
data/lib/searchlink.rb CHANGED
@@ -2,74 +2,74 @@
2
2
 
3
3
  # SearchLink by Brett Terpstra 2015 <http://brettterpstra.com/projects/searchlink/>
4
4
  # MIT License, please maintain attribution
5
- require 'net/https'
6
- require 'uri'
7
- require 'shellwords'
8
- require 'yaml'
9
- require 'cgi'
10
- require 'fileutils'
11
- require 'tempfile'
12
- require 'zlib'
13
- require 'time'
14
- require 'json'
15
- require 'erb'
16
- require 'english'
5
+ require "net/https"
6
+ require "uri"
7
+ require "shellwords"
8
+ require "yaml"
9
+ require "cgi"
10
+ require "fileutils"
11
+ require "tempfile"
12
+ require "zlib"
13
+ require "time"
14
+ require "json"
15
+ require "erb"
16
+ require "English"
17
17
 
18
18
  # import
19
- require 'tokens' if File.exist?('lib/tokens.rb')
19
+ require_relative "tokens" if File.exist?("tokens.rb")
20
20
 
21
21
  # import
22
- require 'searchlink/exceptions'
22
+ require_relative "searchlink/exceptions"
23
23
 
24
24
  # import
25
- require 'searchlink/number'
25
+ require_relative "searchlink/number"
26
26
 
27
27
  # import
28
- require 'searchlink/util'
28
+ require_relative "searchlink/util"
29
29
 
30
30
  # import
31
- require 'searchlink/curl'
31
+ require_relative "searchlink/curl"
32
32
 
33
33
  # import
34
- require 'searchlink/semver'
34
+ require_relative "searchlink/semver"
35
35
 
36
36
  # import
37
- require 'searchlink/version'
37
+ require_relative "searchlink/version"
38
38
 
39
39
  # import
40
- require 'searchlink/array'
40
+ require_relative "searchlink/array"
41
41
 
42
42
  # import
43
- require 'searchlink/string'
43
+ require_relative "searchlink/string"
44
44
 
45
45
  # import
46
- require 'searchlink/plist'
46
+ require_relative "searchlink/plist"
47
47
 
48
48
  # import
49
- require 'searchlink/config'
49
+ require_relative "searchlink/config"
50
50
 
51
51
  # import
52
- require 'searchlink/searches'
52
+ require_relative "searchlink/searches"
53
53
 
54
54
  # import
55
- require 'searchlink/url'
55
+ require_relative "searchlink/url"
56
56
 
57
57
  # import
58
- require 'searchlink/search'
58
+ require_relative "searchlink/search"
59
59
 
60
60
  # import
61
- require 'searchlink/help'
61
+ require_relative "searchlink/help"
62
62
 
63
63
  # import
64
- require 'searchlink/parse'
64
+ require_relative "searchlink/parse"
65
65
 
66
66
  # import
67
- require 'searchlink/output'
67
+ require_relative "searchlink/output"
68
68
 
69
69
  # import
70
- require 'searchlink/which'
70
+ require_relative "searchlink/which"
71
71
 
72
72
  # import
73
- require 'searchlink/script_plugin'
73
+ require_relative "searchlink/script_plugin"
74
74
 
75
75
  module Secrets; end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchlink
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.74
4
+ version: 2.3.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-01 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +136,20 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '2.1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: plist
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 3.7.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 3.7.1
125
153
  - !ruby/object:Gem::Dependency
126
154
  name: rake
127
155
  requirement: !ruby/object:Gem::Requirement
@@ -220,20 +248,6 @@ dependencies:
220
248
  - - "~>"
221
249
  - !ruby/object:Gem::Version
222
250
  version: 0.9.5
223
- - !ruby/object:Gem::Dependency
224
- name: plist
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: 3.7.1
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: 3.7.1
237
251
  description: macOS System Service for inline web searches
238
252
  email:
239
253
  - me@brettterpstra.com
@@ -290,7 +304,6 @@ files:
290
304
  - lib/searchlink/util.rb
291
305
  - lib/searchlink/version.rb
292
306
  - lib/searchlink/which.rb
293
- - lib/tokens.rb
294
307
  homepage: https://github.com/ttscoff/searchlink
295
308
  licenses:
296
309
  - MIT
@@ -310,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
323
  - !ruby/object:Gem::Version
311
324
  version: '0'
312
325
  requirements: []
313
- rubygems_version: 3.2.16
326
+ rubygems_version: 3.5.3
314
327
  signing_key:
315
328
  specification_version: 4
316
329
  summary: Create Markdown links from web searches without leaving your editor.
data/lib/tokens.rb DELETED
@@ -1,3 +0,0 @@
1
- module Secrets
2
- GH_AUTH_TOKEN = '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'
3
- end