fusuma 3.2.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30a12dfc770118352a414806a6c37e376eebdf49db24aa347eb904146b855ecf
4
- data.tar.gz: ef9fb2e5bbbdc4a53eafae83334455890ad99b3c91c43ad0e4ed678f38bb1673
3
+ metadata.gz: 629441e7756cdd5df55e497ff6c4758fcbcd1f351132f55caea11a80a06492e8
4
+ data.tar.gz: 6510ed44d991c1ec08938ad33b316ce6693fee571f00743df9dc66a1948c3562
5
5
  SHA512:
6
- metadata.gz: ecb619087432fc99c51265b91ed1fc21da77e34e13d446a92c29127d15e3e7c35124b2a67df7a184891d76f0ad004151eb1e5d92df170334f5a668eebdb93941
7
- data.tar.gz: b8da3242044d824d0f39170cf16a3e173214742e01cfe965257a146dfe5a1993d19232d50d5b26dd264956ace6d488ee09b5d7e873de7f45e442ad75646bc41c
6
+ metadata.gz: 88fe3cc4229f5a6bcd772affcd2292c440ede0a581448f81605b24de1ad90c15a6ad6b3d097da00ea35b6b9131ccd108cfab4c063c07c1aa140e3c83a125fcf2
7
+ data.tar.gz: 0e4fb3ac2fe62fd064a0ad17d46ba21952e78b75cf13c118961854316998cc70f00c8d83a0c386517efb0136f90349024c5ffd5870cc53cfdbc3688a5e0082f7
@@ -100,7 +100,7 @@ module Fusuma
100
100
  # no_context?(&block) ||
101
101
  # complete_match_context(request_context, &block) ||
102
102
  # partial_match_context(request_context, &block)
103
- fallbacks.each do |method|
103
+ fallbacks.find do |method|
104
104
  result = send(method, request_context, &block)
105
105
  return result if result
106
106
  end
@@ -112,7 +112,7 @@ module Fusuma
112
112
  # @return [Hash]
113
113
  # @return [NilClass]
114
114
  def no_context(_request_context, &block)
115
- return {} if with_context({}, &block)
115
+ {} if with_context({}, &block)
116
116
  end
117
117
 
118
118
  # Complete match request context
@@ -165,7 +165,10 @@ module Fusuma
165
165
 
166
166
  return config[:context] if with_context(config[:context], &block)
167
167
  end
168
- complete_match_context
168
+ if complete_match_context
169
+ with_context(complete_match_context, &block)
170
+ complete_match_context
171
+ end
169
172
  end
170
173
  end
171
174
  end
data/lib/fusuma/config.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./multi_logger"
4
- require_relative "./config/index"
5
- require_relative "./config/searcher"
6
- require_relative "./config/yaml_duplication_checker"
7
- require_relative "./plugin/manager"
8
- require_relative "./hash_support"
3
+ require_relative "multi_logger"
4
+ require_relative "config/index"
5
+ require_relative "config/searcher"
6
+ require_relative "config/yaml_duplication_checker"
7
+ require_relative "plugin/manager"
8
+ require_relative "hash_support"
9
9
  require "singleton"
10
10
  require "yaml"
11
11
 
@@ -65,6 +65,7 @@ module Fusuma
65
65
 
66
66
  # reset searcher cache
67
67
  @searcher = Searcher.new
68
+ @cache_execute_keys = nil
68
69
 
69
70
  self
70
71
  rescue InvalidFileError => e
@@ -117,10 +118,17 @@ module Fusuma
117
118
  executor.new.execute_keys
118
119
  end.flatten
119
120
 
120
- execute_params = search(index)
121
- return if execute_params.nil? || !execute_params.is_a?(Hash)
121
+ @cache_execute_keys ||= {}
122
122
 
123
- @execute_keys.find { |k| execute_params.key?(k) }
123
+ cache_key = [index.cache_key, Searcher.context].join
124
+
125
+ return @cache_execute_keys[cache_key] if @cache_execute_keys.has_key?(cache_key)
126
+
127
+ @cache_execute_keys[cache_key] =
128
+ @execute_keys.find do |execute_key|
129
+ new_index = Config::Index.new(index.keys | [execute_key])
130
+ search(new_index)
131
+ end
124
132
  end
125
133
 
126
134
  private
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./string_support"
3
+ require_relative "string_support"
4
4
 
5
5
  module Fusuma
6
6
  # Rename process
data/lib/fusuma/device.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./multi_logger"
4
- require_relative "./libinput_command"
3
+ require_relative "multi_logger"
4
+ require_relative "libinput_command"
5
5
 
6
6
  module Fusuma
7
7
  # detect input device
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./version"
4
- require_relative "./libinput_command"
5
- require_relative "./multi_logger"
3
+ require_relative "version"
4
+ require_relative "libinput_command"
5
+ require_relative "multi_logger"
6
6
 
7
7
  module Fusuma
8
8
  # Output Environment information
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./manager"
3
+ require_relative "manager"
4
4
  require_relative "../config"
5
5
  require_relative "../custom_process"
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./buffer"
3
+ require_relative "buffer"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./buffer"
3
+ require_relative "buffer"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./detector"
3
+ require_relative "detector"
4
4
  require_relative "../inputs/timer_input"
5
5
 
6
6
  module Fusuma
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./detector"
3
+ require_relative "detector"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./detector"
3
+ require_relative "detector"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./detector"
3
+ require_relative "detector"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../base"
4
- require_relative "./records/record"
5
- require_relative "./records/text_record"
4
+ require_relative "records/record"
5
+ require_relative "records/text_record"
6
6
 
7
7
  module Fusuma
8
8
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./text_record"
3
+ require_relative "text_record"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./record"
3
+ require_relative "record"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./executor"
3
+ require_relative "executor"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./filter"
3
+ require_relative "filter"
4
4
  require_relative "../../device"
5
5
 
6
6
  module Fusuma
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../libinput_command"
4
- require_relative "./input"
4
+ require_relative "input"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
@@ -57,7 +57,7 @@ module Fusuma
57
57
  enable_dwt,
58
58
  disable_dwt,
59
59
  show_keycodes,
60
- verbose,
60
+ verbose
61
61
  ].compact
62
62
  end
63
63
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./input"
3
+ require_relative "input"
4
4
  require "timeout"
5
5
 
6
6
  module Fusuma
@@ -101,14 +101,14 @@ module Fusuma
101
101
  end
102
102
 
103
103
  def require_base_plugins
104
- require_relative "./base"
105
- require_relative "./events/event"
106
- require_relative "./inputs/input"
107
- require_relative "./filters/filter"
108
- require_relative "./parsers/parser"
109
- require_relative "./buffers/buffer"
110
- require_relative "./detectors/detector"
111
- require_relative "./executors/executor"
104
+ require_relative "base"
105
+ require_relative "events/event"
106
+ require_relative "inputs/input"
107
+ require_relative "filters/filter"
108
+ require_relative "parsers/parser"
109
+ require_relative "buffers/buffer"
110
+ require_relative "detectors/detector"
111
+ require_relative "executors/executor"
112
112
  end
113
113
 
114
114
  def plugins
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = "3.2.0"
4
+ VERSION = "3.3.1"
5
5
  end
data/lib/fusuma.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./fusuma/version"
4
- require_relative "./fusuma/multi_logger"
5
- require_relative "./fusuma/config"
6
- require_relative "./fusuma/environment"
7
- require_relative "./fusuma/device"
8
- require_relative "./fusuma/plugin/manager"
3
+ require_relative "fusuma/version"
4
+ require_relative "fusuma/multi_logger"
5
+ require_relative "fusuma/config"
6
+ require_relative "fusuma/environment"
7
+ require_relative "fusuma/device"
8
+ require_relative "fusuma/plugin/manager"
9
9
 
10
10
  # this is top level module
11
11
  module Fusuma
@@ -19,6 +19,10 @@ module Fusuma
19
19
  ## NOTE: Uncomment following line to measure performance
20
20
  # instance.run_with_lineprof
21
21
  instance.run
22
+ rescue => e
23
+ MultiLogger.error("Shutdown by error")
24
+ MultiLogger.error(e)
25
+ instance.send(:shutdown)
22
26
  end
23
27
 
24
28
  private
@@ -191,11 +195,11 @@ module Fusuma
191
195
  def set_trap
192
196
  Signal.trap("INT") {
193
197
  shutdown
194
- puts exit
198
+ exit
195
199
  } # Trap ^C
196
200
  Signal.trap("TERM") {
197
201
  shutdown
198
- puts exit
202
+ exit
199
203
  } # Trap `Kill `
200
204
  end
201
205
 
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: 3.2.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-24 00:00:00.000000000 Z
11
+ date: 2023-11-04 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