fusuma 2.5.0 → 2.5.1

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: 8c6f872a195572cd05d5cbf86ff5a55e3b7419b9ddc3a2e1b1b09bd395adde36
4
- data.tar.gz: 51c32b562df304b04a0b607b9e4404bfb7fb031fee73388a2902b56a6a94c4a5
3
+ metadata.gz: 9368eba481cbc496fb561cb449ec99c6b5f1eff8b4c8c4a9c8d61b4e7d5b4cf8
4
+ data.tar.gz: 3bea9acc54d3e2061f391ec282f9327ca2b3fd70463fa5f2394063a980b20613
5
5
  SHA512:
6
- metadata.gz: 90da79d6210fc47324fda9d3b5e4f9ed1f4e820ccead8c2dc0341d2bb69e3bd691c34db39bdb83cd94529f9e69efe478d02c1cca43f4b953bddd4b0eb46f8888
7
- data.tar.gz: adbd22a0b5a1d8213d96994e33a38c4cf2c6f667d33d16019cf1e4f90dee7d114301fee0c544e18e1e532fa7f10c5aa13c09963d5694072c63721bbc8f5ab065
6
+ metadata.gz: 2af60b07cfa18ca3b3d13eedf9b0271ff5bfdea37776e66a51e59eb33ea2e6bd35fe1fdc4724738ca3ecec37c7a6811c202c4277bf1e4ff341fda81e8fdb9f58
7
+ data.tar.gz: 4583ee8007e36e364658f02a42d5f447adb947408e690cb0f554c004672869f0304e2e674335aebc2d9a267abcb01cbe2f559845e604d4acc945620d7fada1a7
data/bin/console CHANGED
@@ -23,5 +23,5 @@ def reload!(print = true)
23
23
  true
24
24
  end
25
25
 
26
- require 'pry'
27
- Pry.start
26
+ require "irb"
27
+ IRB.start(__FILE__)
@@ -15,37 +15,51 @@ module Fusuma
15
15
  fusuma_default_plugin_paths.each { |siblings_plugin| require(siblings_plugin) }
16
16
  end
17
17
 
18
- def fusuma_default_plugin_paths
19
- search_key = File.join("../../", plugin_dir_name, "*.rb")
20
- Dir.glob(File.expand_path("#{__dir__}/#{search_key}")).sort
21
- end
22
-
23
18
  def require_siblings_from_gems
24
19
  fusuma_external_plugin_paths.each { |siblings_plugin| require(siblings_plugin) }
25
20
  end
26
21
 
22
+ def exclude_path_pattern
23
+ %r{fusuma/plugin/[^/]*.rb}
24
+ end
25
+
26
+ def fusuma_default_plugin_paths
27
+ @_fusuma_default_plugin_paths ||= Dir.glob(File.expand_path("#{__dir__}/../../#{search_key}")).grep_v(exclude_path_pattern).sort
28
+ end
29
+
27
30
  def fusuma_external_plugin_paths
28
- search_key = File.join(plugin_dir_name, "*.rb")
29
- Gem.find_latest_files(search_key).map do |siblings_plugin|
30
- next unless %r{fusuma-plugin-(.+).*/lib/#{plugin_dir_name}/.+\.rb}.match?(siblings_plugin)
31
-
32
- match_data = siblings_plugin.match(%r{(.*)/(.*)/lib/(.*)})
33
- gemspec_path = Dir.glob("#{match_data[1]}/#{match_data[2]}/*.gemspec").first
34
- raise "Not Found: #{match_data[1]}/#{match_data[2]}/*.gemspec" unless gemspec_path
35
-
36
- gemspec = Gem::Specification.load(gemspec_path)
37
- fusuma_gemspec_path = File.expand_path("../../../fusuma.gemspec", __dir__)
38
- fusuma_gemspec = Gem::Specification.load(fusuma_gemspec_path)
39
- if gemspec.dependencies.find { |d| d.name == "fusuma" }&.match?(fusuma_gemspec)
40
- siblings_plugin
41
- else
42
- MultiLogger.warn "#{gemspec.name} #{gemspec.version} is incompatible with running #{fusuma_gemspec.name} #{fusuma_gemspec.version}"
43
- end
44
- end.compact
31
+ @_fusuma_external_plugin_paths ||=
32
+ Gem.find_latest_files(search_key).map do |siblings_plugin|
33
+ next unless %r{fusuma-plugin-(.+).*/lib/#{plugin_dir_name}/.+\.rb}.match?(siblings_plugin)
34
+
35
+ match_data = siblings_plugin.match(%r{(.*)/(.*)/lib/(.*)})
36
+ gemspec_path = Dir.glob("#{match_data[1]}/#{match_data[2]}/*.gemspec").first
37
+ raise "Not Found: #{match_data[1]}/#{match_data[2]}/*.gemspec" unless gemspec_path
38
+
39
+ gemspec = Gem::Specification.load(gemspec_path)
40
+ fusuma_gemspec_path = File.expand_path("../../../fusuma.gemspec", __dir__)
41
+ fusuma_gemspec = Gem::Specification.load(fusuma_gemspec_path)
42
+
43
+ if gemspec.dependencies.find { |d| d.name == "fusuma" }&.match?(fusuma_gemspec)
44
+ siblings_plugin
45
+ else
46
+ MultiLogger.warn "#{gemspec.name} #{gemspec.version} is incompatible with running #{fusuma_gemspec.name} #{fusuma_gemspec.version}"
47
+ MultiLogger.warn "gemspec: #{gemspec_path}"
48
+ next
49
+ end
50
+ end.compact.grep_v(exclude_path_pattern).sort
51
+ end
52
+
53
+ def search_key
54
+ File.join(plugin_dir_name, "*rb")
45
55
  end
46
56
 
47
57
  private
48
58
 
59
+ # @example
60
+ # plugin_dir_name
61
+ # => "fusuma/plugin/detectors"
62
+ # @return [String]
49
63
  def plugin_dir_name
50
64
  @plugin_class.name.match(/(Fusuma::.*)::/)[1].to_s.underscore
51
65
  end
@@ -70,6 +84,13 @@ module Fusuma
70
84
  load_paths << plugin_path
71
85
 
72
86
  manager = Manager.new(plugin_class)
87
+
88
+ @already_required ||= {}
89
+
90
+ key = manager.search_key
91
+ return if @already_required[key]
92
+
93
+ @already_required[key] = true
73
94
  manager.require_siblings_from_plugin_dir
74
95
  manager.require_siblings_from_gems
75
96
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = "2.5.0"
4
+ VERSION = "2.5.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-11-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fusuma is multitouch gesture recognizer. This gem makes your touchpad
14
14
  on Linux able to recognize swipes or pinchs and assign command to them. Read installation