fusuma 3.4.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fusuma/config/searcher.rb +7 -5
- data/lib/fusuma/config/yaml_duplication_checker.rb +1 -8
- data/lib/fusuma/config.rb +3 -1
- data/lib/fusuma/multi_logger.rb +21 -18
- data/lib/fusuma/plugin/buffers/buffer.rb +5 -0
- data/lib/fusuma/plugin/buffers/gesture_buffer.rb +0 -4
- data/lib/fusuma/plugin/buffers/timer_buffer.rb +0 -4
- data/lib/fusuma/plugin/events/event.rb +2 -2
- data/lib/fusuma/plugin/events/records/gesture_record.rb +1 -1
- data/lib/fusuma/version.rb +1 -1
- data/lib/fusuma.rb +7 -6
- 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: 82378c097f2a0af57970c6ac59afbee3ef8e0ce2d0b2957ebc968673490c1623
|
4
|
+
data.tar.gz: 7324182088a879f6ccc057a311945258bf49f3f255cda67c161b5e6d847871d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb0bc67936c61576f2ef0fa69ac0db89233ae2765633fe0da946368c91f0d2930520cea15a451119b79f451c8e103efb74b84a2fda2bbb9982625a29f560e65
|
7
|
+
data.tar.gz: ea89aef6ec99904287cd958c03beaf46f031b71757293bf77b8920d2b2cb5ead60f2cf525800644537d7a8e3f68aee47323f31f81a579f8a8bb8ebcc57eaccd9
|
@@ -81,18 +81,20 @@ module Fusuma
|
|
81
81
|
# Search with context from load_streamed Config
|
82
82
|
# @param context [Hash]
|
83
83
|
# @return [Object]
|
84
|
-
def with_context(context, &block)
|
85
|
-
|
84
|
+
def with_context(context = {}, &block)
|
85
|
+
before = @context
|
86
|
+
@context = context
|
86
87
|
result = block.call
|
87
|
-
|
88
|
+
ensure # NOTE: ensure is called even if return in block
|
89
|
+
@context = before
|
88
90
|
result
|
89
91
|
end
|
90
92
|
|
91
|
-
|
93
|
+
CONTEXT_SEARCH_ORDER = [:no_context, :complete_match_context, :partial_match_context]
|
92
94
|
# Return a matching context from config
|
93
95
|
# @params request_context [Hash]
|
94
96
|
# @return [Hash]
|
95
|
-
def find_context(request_context, fallbacks =
|
97
|
+
def find_context(request_context, fallbacks = CONTEXT_SEARCH_ORDER, &block)
|
96
98
|
# Search in blocks in the following order.
|
97
99
|
# 1. primary context(no context)
|
98
100
|
# 2. complete match config[:context] == request_context
|
@@ -6,14 +6,7 @@ module Fusuma
|
|
6
6
|
# Find duplicated keys from YAML.
|
7
7
|
module YAMLDuplicationChecker
|
8
8
|
def self.check(yaml_string, filename, &on_duplicated)
|
9
|
-
|
10
|
-
tree = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0")
|
11
|
-
# Specify filename to display helpful message when it raises
|
12
|
-
# an error.
|
13
|
-
YAML.parse(yaml_string, filename: filename)
|
14
|
-
else
|
15
|
-
YAML.parse(yaml_string, filename)
|
16
|
-
end
|
9
|
+
tree = YAML.parse(yaml_string, filename: filename)
|
17
10
|
return unless tree
|
18
11
|
|
19
12
|
traverse(tree, &on_duplicated)
|
data/lib/fusuma/config.rb
CHANGED
@@ -100,10 +100,12 @@ module Fusuma
|
|
100
100
|
|
101
101
|
yamls = YAML.load_stream(File.read(path)).compact
|
102
102
|
yamls.map do |yaml|
|
103
|
-
raise InvalidFileError, "
|
103
|
+
raise InvalidFileError, "Invalid config.yml: #{path}" unless yaml.is_a? Hash
|
104
104
|
|
105
105
|
yaml.deep_symbolize_keys
|
106
106
|
end
|
107
|
+
rescue Psych::SyntaxError => e
|
108
|
+
raise InvalidFileError, "Invalid syntax: #{path} #{e.message}"
|
107
109
|
end
|
108
110
|
|
109
111
|
# @param index [Index]
|
data/lib/fusuma/multi_logger.rb
CHANGED
@@ -13,6 +13,22 @@ module Fusuma
|
|
13
13
|
|
14
14
|
class << self
|
15
15
|
attr_writer :filepath
|
16
|
+
|
17
|
+
def info(msg)
|
18
|
+
instance.info(msg)
|
19
|
+
end
|
20
|
+
|
21
|
+
def debug(msg)
|
22
|
+
instance.debug(msg)
|
23
|
+
end
|
24
|
+
|
25
|
+
def warn(msg)
|
26
|
+
instance.warn(msg)
|
27
|
+
end
|
28
|
+
|
29
|
+
def error(msg)
|
30
|
+
instance.error(msg)
|
31
|
+
end
|
16
32
|
end
|
17
33
|
|
18
34
|
def initialize
|
@@ -49,8 +65,11 @@ module Fusuma
|
|
49
65
|
debug_mode
|
50
66
|
end
|
51
67
|
|
68
|
+
private
|
69
|
+
|
52
70
|
def ignore_pattern?(msg)
|
53
71
|
# TODO: configurable from config.yml
|
72
|
+
# pattern = /timer_input|remap_touchpad_input|thumbsense context|libinput_command_input/
|
54
73
|
pattern = /timer_input/
|
55
74
|
case msg
|
56
75
|
when Hash
|
@@ -58,27 +77,11 @@ module Fusuma
|
|
58
77
|
return unless e
|
59
78
|
|
60
79
|
e.tag.match?(pattern)
|
80
|
+
when String
|
81
|
+
msg.match?(pattern)
|
61
82
|
else
|
62
83
|
false
|
63
84
|
end
|
64
85
|
end
|
65
|
-
|
66
|
-
class << self
|
67
|
-
def info(msg)
|
68
|
-
instance.info(msg)
|
69
|
-
end
|
70
|
-
|
71
|
-
def debug(msg)
|
72
|
-
instance.debug(msg)
|
73
|
-
end
|
74
|
-
|
75
|
-
def warn(msg)
|
76
|
-
instance.warn(msg)
|
77
|
-
end
|
78
|
-
|
79
|
-
def error(msg)
|
80
|
-
instance.error(msg)
|
81
|
-
end
|
82
|
-
end
|
83
86
|
end
|
84
87
|
end
|
@@ -26,12 +26,12 @@ module Fusuma
|
|
26
26
|
Records::TextRecord.new(record)
|
27
27
|
else
|
28
28
|
raise ArgumentError,
|
29
|
-
"@record should be String or Record"
|
29
|
+
"@record should be String or Record: #{record.class}, #{record}"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def inspect
|
34
|
-
"
|
34
|
+
"tag: #{tag}, record: #{record}"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/fusuma/version.rb
CHANGED
data/lib/fusuma.rb
CHANGED
@@ -15,14 +15,13 @@ module Fusuma
|
|
15
15
|
def run(option = {})
|
16
16
|
read_options(option)
|
17
17
|
instance = new
|
18
|
+
instance.initialize_plugins
|
18
19
|
instance.set_trap
|
19
20
|
## NOTE: Uncomment following line to measure performance
|
20
21
|
# instance.run_with_lineprof
|
21
22
|
instance.run
|
22
|
-
|
23
|
-
|
24
|
-
MultiLogger.error(e)
|
25
|
-
instance.send(:shutdown)
|
23
|
+
ensure
|
24
|
+
instance&.send(:shutdown)
|
26
25
|
end
|
27
26
|
|
28
27
|
private
|
@@ -59,7 +58,9 @@ module Fusuma
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
62
|
-
def initialize
|
61
|
+
def initialize; end
|
62
|
+
|
63
|
+
def initialize_plugins
|
63
64
|
@inputs = Plugin::Inputs::Input.plugins.map do |cls|
|
64
65
|
cls.ancestors.include?(Singleton) ? cls.instance : cls.new
|
65
66
|
end
|
@@ -206,7 +207,7 @@ module Fusuma
|
|
206
207
|
private
|
207
208
|
|
208
209
|
def shutdown
|
209
|
-
[@inputs, @filters, @parsers, @buffers, @detectors, @executors].flatten.each do |plugin|
|
210
|
+
[@inputs, @filters, @parsers, @buffers, @detectors, @executors].flatten.compact.each do |plugin|
|
210
211
|
plugin.shutdown
|
211
212
|
end
|
212
213
|
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: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iberianpig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-02 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
|