fusuma 2.4.1 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -0
  3. data/bin/console +2 -2
  4. data/fusuma.gemspec +17 -18
  5. data/lib/fusuma/config/index.rb +17 -17
  6. data/lib/fusuma/config/searcher.rb +1 -1
  7. data/lib/fusuma/config/yaml_duplication_checker.rb +7 -7
  8. data/lib/fusuma/config.rb +17 -13
  9. data/lib/fusuma/device.rb +12 -12
  10. data/lib/fusuma/environment.rb +10 -10
  11. data/lib/fusuma/hash_support.rb +1 -1
  12. data/lib/fusuma/libinput_command.rb +18 -19
  13. data/lib/fusuma/multi_logger.rb +4 -4
  14. data/lib/fusuma/plugin/base.rb +6 -6
  15. data/lib/fusuma/plugin/buffers/buffer.rb +5 -4
  16. data/lib/fusuma/plugin/buffers/gesture_buffer.rb +6 -6
  17. data/lib/fusuma/plugin/buffers/timer_buffer.rb +2 -2
  18. data/lib/fusuma/plugin/detectors/detector.rb +5 -5
  19. data/lib/fusuma/plugin/detectors/hold_detector.rb +29 -29
  20. data/lib/fusuma/plugin/detectors/pinch_detector.rb +47 -47
  21. data/lib/fusuma/plugin/detectors/rotate_detector.rb +40 -40
  22. data/lib/fusuma/plugin/detectors/swipe_detector.rb +43 -43
  23. data/lib/fusuma/plugin/events/event.rb +11 -11
  24. data/lib/fusuma/plugin/events/records/gesture_record.rb +5 -5
  25. data/lib/fusuma/plugin/events/records/index_record.rb +5 -5
  26. data/lib/fusuma/plugin/events/records/record.rb +2 -2
  27. data/lib/fusuma/plugin/events/records/text_record.rb +1 -1
  28. data/lib/fusuma/plugin/executors/command_executor.rb +4 -4
  29. data/lib/fusuma/plugin/executors/executor.rb +3 -3
  30. data/lib/fusuma/plugin/filters/filter.rb +3 -3
  31. data/lib/fusuma/plugin/filters/libinput_device_filter.rb +12 -12
  32. data/lib/fusuma/plugin/inputs/input.rb +8 -8
  33. data/lib/fusuma/plugin/inputs/libinput_command_input.rb +13 -13
  34. data/lib/fusuma/plugin/inputs/timer_input.rb +3 -3
  35. data/lib/fusuma/plugin/manager.rb +58 -31
  36. data/lib/fusuma/plugin/parsers/libinput_gesture_parser.rb +10 -10
  37. data/lib/fusuma/plugin/parsers/parser.rb +3 -3
  38. data/lib/fusuma/string_support.rb +3 -3
  39. data/lib/fusuma/version.rb +1 -1
  40. data/lib/fusuma.rb +10 -10
  41. metadata +3 -79
  42. data/spec/helpers/config_helper.rb +0 -20
  43. data/spec/lib/config/searcher_spec.rb +0 -179
  44. data/spec/lib/config_spec.rb +0 -104
  45. data/spec/lib/custom_process_spec.rb +0 -29
  46. data/spec/lib/device_spec.rb +0 -96
  47. data/spec/lib/dummy_config.yml +0 -31
  48. data/spec/lib/fusuma_spec.rb +0 -103
  49. data/spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt +0 -181
  50. data/spec/lib/libinput-list-devices_magic_trackpad.txt +0 -51
  51. data/spec/lib/libinput-list-devices_razer_razer_blade.txt +0 -252
  52. data/spec/lib/libinput-list-devices_thejinx0r.txt +0 -361
  53. data/spec/lib/libinput-list-devices_unavailable.txt +0 -36
  54. data/spec/lib/libinput_command_spec.rb +0 -164
  55. data/spec/lib/plugin/base_spec.rb +0 -74
  56. data/spec/lib/plugin/buffers/buffer_spec.rb +0 -80
  57. data/spec/lib/plugin/buffers/dummy_buffer.rb +0 -20
  58. data/spec/lib/plugin/buffers/gesture_buffer_spec.rb +0 -192
  59. data/spec/lib/plugin/detectors/detector_spec.rb +0 -43
  60. data/spec/lib/plugin/detectors/dummy_detector.rb +0 -24
  61. data/spec/lib/plugin/detectors/hold_detector_spec.rb +0 -145
  62. data/spec/lib/plugin/detectors/pinch_detector_spec.rb +0 -119
  63. data/spec/lib/plugin/detectors/rotate_detector_spec.rb +0 -125
  64. data/spec/lib/plugin/detectors/swipe_detector_spec.rb +0 -118
  65. data/spec/lib/plugin/events/event_spec.rb +0 -30
  66. data/spec/lib/plugin/events/records/gesture_record_spec.rb +0 -22
  67. data/spec/lib/plugin/events/records/record_spec.rb +0 -31
  68. data/spec/lib/plugin/events/records/text_record_spec.rb +0 -26
  69. data/spec/lib/plugin/executors/command_executor_spec.rb +0 -57
  70. data/spec/lib/plugin/executors/executor_spec.rb +0 -164
  71. data/spec/lib/plugin/filters/filter_spec.rb +0 -92
  72. data/spec/lib/plugin/filters/libinput_filter_spec.rb +0 -120
  73. data/spec/lib/plugin/inputs/input_spec.rb +0 -70
  74. data/spec/lib/plugin/inputs/libinput_command_input_spec.rb +0 -121
  75. data/spec/lib/plugin/inputs/timer_input_spec.rb +0 -40
  76. data/spec/lib/plugin/manager_spec.rb +0 -27
  77. data/spec/lib/plugin/parsers/libinput_gesture_parser_spec.rb +0 -76
  78. data/spec/lib/plugin/parsers/parser_spec.rb +0 -45
  79. data/spec/spec_helper.rb +0 -23
@@ -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
@@ -20,8 +20,8 @@ module Fusuma
20
20
 
21
21
  accel = args_accel(event)
22
22
  additional_env = event.record.args
23
- .deep_transform_keys(&:to_s)
24
- .deep_transform_values { |v| (v * accel).to_s }
23
+ .deep_transform_keys(&:to_s)
24
+ .deep_transform_values { |v| (v * accel).to_s }
25
25
 
26
26
  pid = Process.spawn(additional_env, command.to_s)
27
27
  Process.detach(pid)
@@ -30,7 +30,7 @@ module Fusuma
30
30
  end
31
31
 
32
32
  def executable?(event)
33
- event.tag.end_with?('_detector') &&
33
+ event.tag.end_with?("_detector") &&
34
34
  event.record.type == :index &&
35
35
  search_command(event)
36
36
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../base'
3
+ require_relative "../base"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -47,8 +47,8 @@ module Fusuma
47
47
  index = event.record.index
48
48
  @interval_time[index.cache_key] ||= begin
49
49
  config_value =
50
- Config.search(Config::Index.new([*index.keys, 'interval'])) ||
51
- Config.search(Config::Index.new(['interval', Detectors::Detector.type(event.tag)]))
50
+ Config.search(Config::Index.new([*index.keys, "interval"])) ||
51
+ Config.search(Config::Index.new(["interval", Detectors::Detector.type(event.tag)]))
52
52
  if event.record.trigger == :oneshot
53
53
  (config_value || 1) * BASE_ONESHOT_INTERVAL
54
54
  else
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../base'
3
+ require_relative "../base"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -12,7 +12,7 @@ module Fusuma
12
12
  # @return [Event] when keeping event
13
13
  # @return [NilClass] when discarding record
14
14
  def filter(event)
15
- return event if event.tag !~ /#{source}/
15
+ return event if !/#{source}/.match?(event.tag)
16
16
 
17
17
  return event if keep?(event.record)
18
18
 
@@ -30,7 +30,7 @@ module Fusuma
30
30
  # Set source for tag from config.yml.
31
31
  # DEFAULT_SOURCE is defined in each Filter plugins.
32
32
  def source
33
- @source ||= config_params(:source) || self.class.const_get('DEFAULT_SOURCE')
33
+ @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)
34
34
  end
35
35
  end
36
36
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './filter'
4
- require_relative '../../device'
3
+ require_relative "./filter"
4
+ require_relative "../../device"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
8
8
  module Filters
9
9
  # Filter device log
10
10
  class LibinputDeviceFilter < Filter
11
- DEFAULT_SOURCE = 'libinput_command_input'
11
+ DEFAULT_SOURCE = "libinput_command_input"
12
12
 
13
13
  def config_param_types
14
14
  {
@@ -64,18 +64,18 @@ module Fusuma
64
64
  # @return [Array]
65
65
  def all
66
66
  @all ||= if @name_patterns.empty?
67
- Device.available
68
- else
69
- Device.all.select do |device|
70
- match_pattern?(device.name)
71
- end
72
- end.tap do |devices|
73
- print_not_found_messages if devices.empty?
74
- end
67
+ Device.available
68
+ else
69
+ Device.all.select do |device|
70
+ match_pattern?(device.name)
71
+ end
72
+ end.tap do |devices|
73
+ print_not_found_messages if devices.empty?
74
+ end
75
75
  end
76
76
 
77
77
  def print_not_found_messages
78
- puts 'Device is not found. Check following section on your config.yml'
78
+ puts "Device is not found. Check following section on your config.yml"
79
79
  puts LibinputDeviceFilter.new.config_param_sample
80
80
  end
81
81
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../base'
4
- require_relative '../events/event'
3
+ require_relative "../base"
4
+ require_relative "../events/event"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
@@ -23,13 +23,13 @@ module Fusuma
23
23
  line = io.readline_nonblock("\n").chomp
24
24
  rescue EOFError => e
25
25
  warn "#{input.class.name}: #{e}"
26
- warn 'Send SIGKILL to fusuma processes'
26
+ warn "Send SIGKILL to fusuma processes"
27
27
  inputs.reject { |i| i == input }.each do |i|
28
28
  warn "stop process: #{i.class.name.underscore}"
29
29
  Process.kill(:SIGKILL, i.pid)
30
30
  end
31
31
  exit 1
32
- rescue StandardError => e
32
+ rescue => e
33
33
  warn "#{input.class.name}: #{e}"
34
34
  exit 1
35
35
  end
@@ -48,14 +48,14 @@ module Fusuma
48
48
  end
49
49
 
50
50
  # @return [Event]
51
- def create_event(record: 'dummy input')
51
+ def create_event(record: "dummy input")
52
52
  e = Events::Event.new(tag: tag, record: record)
53
53
  MultiLogger.debug(input_event: e)
54
54
  e
55
55
  end
56
56
 
57
57
  def tag
58
- self.class.name.split('Inputs::').last.underscore
58
+ self.class.name.split("Inputs::").last.underscore
59
59
  end
60
60
  end
61
61
  end
@@ -65,8 +65,8 @@ end
65
65
  # ref: https://github.com/Homebrew/brew/blob/6b2dbbc96f7d8aa12f9b8c9c60107c9cc58befc4/Library/Homebrew/extend/io.rb
66
66
  class IO
67
67
  def readline_nonblock(sep = $INPUT_RECORD_SEPARATOR)
68
- line = +''
69
- buffer = +''
68
+ line = +""
69
+ buffer = +""
70
70
 
71
71
  loop do
72
72
  break if buffer == sep
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../libinput_command'
4
- require_relative './input'
3
+ require_relative "../../libinput_command"
4
+ require_relative "./input"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
@@ -13,12 +13,12 @@ module Fusuma
13
13
  def config_param_types
14
14
  {
15
15
  device: [String],
16
- 'enable-dwt': [TrueClass, FalseClass],
17
- 'enable-tap': [TrueClass, FalseClass],
18
- 'show-keycodes': [TrueClass, FalseClass],
16
+ "enable-dwt": [TrueClass, FalseClass],
17
+ "enable-tap": [TrueClass, FalseClass],
18
+ "show-keycodes": [TrueClass, FalseClass],
19
19
  verbose: [TrueClass, FalseClass],
20
- 'libinput-debug-events': [String],
21
- 'libinput-list-devices': [String]
20
+ "libinput-debug-events": [String],
21
+ "libinput-list-devices": [String]
22
22
  }
23
23
  end
24
24
 
@@ -45,10 +45,10 @@ module Fusuma
45
45
  # @return [Array]
46
46
  def libinput_options
47
47
  device = ("--device='#{config_params(:device)}'" if config_params(:device))
48
- enable_tap = '--enable-tap' if config_params(:'enable-tap')
49
- enable_dwt = '--enable-dwt' if config_params(:'enable-dwt')
50
- show_keycodes = '--show-keycodes' if config_params(:'show-keycodes')
51
- verbose = '--verbose' if config_params(:verbose)
48
+ enable_tap = "--enable-tap" if config_params(:"enable-tap")
49
+ enable_dwt = "--enable-dwt" if config_params(:"enable-dwt")
50
+ show_keycodes = "--show-keycodes" if config_params(:"show-keycodes")
51
+ verbose = "--verbose" if config_params(:verbose)
52
52
  [
53
53
  device,
54
54
  enable_dwt,
@@ -59,11 +59,11 @@ module Fusuma
59
59
  end
60
60
 
61
61
  def debug_events_command
62
- config_params(:'libinput-debug-events')
62
+ config_params(:"libinput-debug-events")
63
63
  end
64
64
 
65
65
  def list_devices_command
66
- config_params(:'libinput-list-devices')
66
+ config_params(:"libinput-list-devices")
67
67
  end
68
68
 
69
69
  private
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './input'
3
+ require_relative "./input"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -39,11 +39,11 @@ module Fusuma
39
39
  begin
40
40
  loop do
41
41
  sleep interval
42
- writer.puts 'timer'
42
+ writer.puts "timer"
43
43
  end
44
44
  rescue Errno::EPIPE
45
45
  exit 0
46
- rescue StandardError => e
46
+ rescue => e
47
47
  MultiLogger.error e
48
48
  end
49
49
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../multi_logger'
4
- require_relative '../string_support'
3
+ require_relative "../multi_logger"
4
+ require_relative "../string_support"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
@@ -12,34 +12,54 @@ module Fusuma
12
12
  end
13
13
 
14
14
  def require_siblings_from_plugin_dir
15
- search_key = File.join('../../', plugin_dir_name, '*.rb')
16
- Dir.glob(File.expand_path("#{__dir__}/#{search_key}")).sort.each do |siblings_plugin|
17
- require siblings_plugin
18
- end
15
+ fusuma_default_plugin_paths.each { |siblings_plugin| require(siblings_plugin) }
19
16
  end
20
17
 
21
18
  def require_siblings_from_gems
22
- search_key = File.join(plugin_dir_name, '*.rb')
23
- Gem.find_latest_files(search_key).each do |siblings_plugin|
24
- next unless siblings_plugin =~ %r{fusuma-plugin-(.+).*/lib/#{plugin_dir_name}/\1_.+.rb}
25
-
26
- match_data = siblings_plugin.match(%r{(.*)/(.*)/lib/(.*)})
27
- gemspec_path = Dir.glob("#{match_data[1]}/#{match_data[2]}/*.gemspec").first
28
- raise "Not Found: #{match_data[1]}/#{match_data[2]}/*.gemspec" unless gemspec_path
29
-
30
- gemspec = Gem::Specification.load(gemspec_path)
31
- fusuma_gemspec_path = File.expand_path('../../../fusuma.gemspec', __dir__)
32
- fusuma_gemspec = Gem::Specification.load(fusuma_gemspec_path)
33
- if gemspec.dependencies.find { |d| d.name == 'fusuma' }&.match?(fusuma_gemspec)
34
- require siblings_plugin
35
- else
36
- MultiLogger.warn "#{gemspec.name} #{gemspec.version} is incompatible with running #{fusuma_gemspec.name} #{fusuma_gemspec.version}"
37
- end
38
- end
19
+ fusuma_external_plugin_paths.each { |siblings_plugin| require(siblings_plugin) }
20
+ end
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
+
30
+ def fusuma_external_plugin_paths
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")
39
55
  end
40
56
 
41
57
  private
42
58
 
59
+ # @example
60
+ # plugin_dir_name
61
+ # => "fusuma/plugin/detectors"
62
+ # @return [String]
43
63
  def plugin_dir_name
44
64
  @plugin_class.name.match(/(Fusuma::.*)::/)[1].to_s.underscore
45
65
  end
@@ -64,19 +84,26 @@ module Fusuma
64
84
  load_paths << plugin_path
65
85
 
66
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
67
94
  manager.require_siblings_from_plugin_dir
68
95
  manager.require_siblings_from_gems
69
96
  end
70
97
 
71
98
  def require_base_plugins
72
- require_relative './base'
73
- require_relative './events/event'
74
- require_relative './inputs/input'
75
- require_relative './filters/filter'
76
- require_relative './parsers/parser'
77
- require_relative './buffers/buffer'
78
- require_relative './detectors/detector'
79
- require_relative './executors/executor'
99
+ require_relative "./base"
100
+ require_relative "./events/event"
101
+ require_relative "./inputs/input"
102
+ require_relative "./filters/filter"
103
+ require_relative "./parsers/parser"
104
+ require_relative "./buffers/buffer"
105
+ require_relative "./detectors/detector"
106
+ require_relative "./executors/executor"
80
107
  end
81
108
 
82
109
  def plugins
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../events/records/record'
4
- require_relative '../events/records/gesture_record'
3
+ require_relative "../events/records/record"
4
+ require_relative "../events/records/gesture_record"
5
5
 
6
6
  module Fusuma
7
7
  module Plugin
8
8
  module Parsers
9
9
  # parse libinput and generate gesture record
10
10
  class LibinputGestureParser < Parser
11
- DEFAULT_SOURCE = 'libinput_command_input'
11
+ DEFAULT_SOURCE = "libinput_command_input"
12
12
 
13
13
  # @param record [String]
14
14
  # @return [Records::GestureRecord, nil]
@@ -21,9 +21,9 @@ module Fusuma
21
21
  end
22
22
 
23
23
  Events::Records::GestureRecord.new(status: status,
24
- gesture: gesture,
25
- finger: finger,
26
- delta: delta)
24
+ gesture: gesture,
25
+ finger: finger,
26
+ delta: delta)
27
27
  end
28
28
 
29
29
  private
@@ -34,7 +34,7 @@ module Fusuma
34
34
 
35
35
  gesture, status = *detect_gesture(event_name)
36
36
 
37
- status = 'cancelled' if gesture == 'hold' && status == 'end' && other == 'cancelled'
37
+ status = "cancelled" if gesture == "hold" && status == "end" && other == "cancelled"
38
38
  delta = parse_delta(other)
39
39
  [gesture, status, finger, delta]
40
40
  end
@@ -50,10 +50,10 @@ module Fusuma
50
50
  return if line.nil?
51
51
 
52
52
  move_x, move_y, unaccelerated_x, unaccelerated_y, _, zoom, _, rotate =
53
- line.tr('/|(|)', ' ').split
53
+ line.tr("/|(|)", " ").split
54
54
  Events::Records::GestureRecord::Delta.new(move_x.to_f, move_y.to_f,
55
- unaccelerated_x.to_f, unaccelerated_y.to_f,
56
- zoom.to_f, rotate.to_f)
55
+ unaccelerated_x.to_f, unaccelerated_y.to_f,
56
+ zoom.to_f, rotate.to_f)
57
57
  end
58
58
  end
59
59
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../base'
3
+ require_relative "../base"
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
@@ -26,11 +26,11 @@ module Fusuma
26
26
  # Set source for tag from config.yml.
27
27
  # DEFAULT_SOURCE is defined in each Parser plugins.
28
28
  def source
29
- @source ||= config_params(:source) || self.class.const_get('DEFAULT_SOURCE')
29
+ @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)
30
30
  end
31
31
 
32
32
  def tag
33
- @tag ||= self.class.name.split('::').last.underscore
33
+ @tag ||= self.class.name.split("::").last.underscore
34
34
  end
35
35
 
36
36
  # parse Record object
@@ -3,14 +3,14 @@
3
3
  # support camerize and underscore
4
4
  class String
5
5
  def camelize
6
- split('_').map(&:capitalize).join
6
+ split("_").map(&:capitalize).join
7
7
  end
8
8
 
9
9
  def underscore
10
10
  gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
11
11
  .gsub(/([a-z\d])([A-Z])/, '\1_\2')
12
- .gsub('::', '/')
13
- .tr('-', '_')
12
+ .gsub("::", "/")
13
+ .tr("-", "_")
14
14
  .downcase
15
15
  end
16
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fusuma
4
- VERSION = '2.4.1'
4
+ VERSION = "2.5.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
@@ -24,8 +24,8 @@ module Fusuma
24
24
  private
25
25
 
26
26
  def set_trap
27
- Signal.trap('INT') { puts exit } # Trap ^C
28
- Signal.trap('TERM') { puts exit } # Trap `Kill `
27
+ Signal.trap("INT") { puts exit } # Trap ^C
28
+ Signal.trap("TERM") { puts exit } # Trap `Kill `
29
29
  end
30
30
 
31
31
  def read_options(option)
@@ -81,8 +81,8 @@ module Fusuma
81
81
 
82
82
  # For performance monitoring
83
83
  def run_with_lineprof(count: 1000)
84
- require 'rblineprof'
85
- require 'rblineprof-report'
84
+ require "rblineprof"
85
+ require "rblineprof-report"
86
86
 
87
87
  profile = lineprof(%r{#{Pathname.new(__FILE__).parent}/.}) do
88
88
  count.times { pipeline }
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.4.1
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-04-17 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
@@ -65,44 +65,6 @@ files:
65
65
  - lib/fusuma/plugin/parsers/parser.rb
66
66
  - lib/fusuma/string_support.rb
67
67
  - lib/fusuma/version.rb
68
- - spec/helpers/config_helper.rb
69
- - spec/lib/config/searcher_spec.rb
70
- - spec/lib/config_spec.rb
71
- - spec/lib/custom_process_spec.rb
72
- - spec/lib/device_spec.rb
73
- - spec/lib/dummy_config.yml
74
- - spec/lib/fusuma_spec.rb
75
- - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
76
- - spec/lib/libinput-list-devices_magic_trackpad.txt
77
- - spec/lib/libinput-list-devices_razer_razer_blade.txt
78
- - spec/lib/libinput-list-devices_thejinx0r.txt
79
- - spec/lib/libinput-list-devices_unavailable.txt
80
- - spec/lib/libinput_command_spec.rb
81
- - spec/lib/plugin/base_spec.rb
82
- - spec/lib/plugin/buffers/buffer_spec.rb
83
- - spec/lib/plugin/buffers/dummy_buffer.rb
84
- - spec/lib/plugin/buffers/gesture_buffer_spec.rb
85
- - spec/lib/plugin/detectors/detector_spec.rb
86
- - spec/lib/plugin/detectors/dummy_detector.rb
87
- - spec/lib/plugin/detectors/hold_detector_spec.rb
88
- - spec/lib/plugin/detectors/pinch_detector_spec.rb
89
- - spec/lib/plugin/detectors/rotate_detector_spec.rb
90
- - spec/lib/plugin/detectors/swipe_detector_spec.rb
91
- - spec/lib/plugin/events/event_spec.rb
92
- - spec/lib/plugin/events/records/gesture_record_spec.rb
93
- - spec/lib/plugin/events/records/record_spec.rb
94
- - spec/lib/plugin/events/records/text_record_spec.rb
95
- - spec/lib/plugin/executors/command_executor_spec.rb
96
- - spec/lib/plugin/executors/executor_spec.rb
97
- - spec/lib/plugin/filters/filter_spec.rb
98
- - spec/lib/plugin/filters/libinput_filter_spec.rb
99
- - spec/lib/plugin/inputs/input_spec.rb
100
- - spec/lib/plugin/inputs/libinput_command_input_spec.rb
101
- - spec/lib/plugin/inputs/timer_input_spec.rb
102
- - spec/lib/plugin/manager_spec.rb
103
- - spec/lib/plugin/parsers/libinput_gesture_parser_spec.rb
104
- - spec/lib/plugin/parsers/parser_spec.rb
105
- - spec/spec_helper.rb
106
68
  homepage: https://github.com/iberianpig/fusuma
107
69
  licenses:
108
70
  - MIT
@@ -128,42 +90,4 @@ rubygems_version: 3.0.3.1
128
90
  signing_key:
129
91
  specification_version: 4
130
92
  summary: Multitouch gestures with libinput driver, Linux
131
- test_files:
132
- - spec/spec_helper.rb
133
- - spec/lib/libinput_command_spec.rb
134
- - spec/lib/dummy_config.yml
135
- - spec/lib/libinput-list-devices_razer_razer_blade.txt
136
- - spec/lib/fusuma_spec.rb
137
- - spec/lib/libinput-list-devices_thejinx0r.txt
138
- - spec/lib/config/searcher_spec.rb
139
- - spec/lib/libinput-list-devices_unavailable.txt
140
- - spec/lib/config_spec.rb
141
- - spec/lib/libinput-list-devices_iberianpig-XPS-9360.txt
142
- - spec/lib/plugin/executors/command_executor_spec.rb
143
- - spec/lib/plugin/executors/executor_spec.rb
144
- - spec/lib/plugin/detectors/detector_spec.rb
145
- - spec/lib/plugin/detectors/rotate_detector_spec.rb
146
- - spec/lib/plugin/detectors/dummy_detector.rb
147
- - spec/lib/plugin/detectors/pinch_detector_spec.rb
148
- - spec/lib/plugin/detectors/swipe_detector_spec.rb
149
- - spec/lib/plugin/detectors/hold_detector_spec.rb
150
- - spec/lib/plugin/inputs/input_spec.rb
151
- - spec/lib/plugin/inputs/timer_input_spec.rb
152
- - spec/lib/plugin/inputs/libinput_command_input_spec.rb
153
- - spec/lib/plugin/filters/filter_spec.rb
154
- - spec/lib/plugin/filters/libinput_filter_spec.rb
155
- - spec/lib/plugin/base_spec.rb
156
- - spec/lib/plugin/events/event_spec.rb
157
- - spec/lib/plugin/events/records/text_record_spec.rb
158
- - spec/lib/plugin/events/records/record_spec.rb
159
- - spec/lib/plugin/events/records/gesture_record_spec.rb
160
- - spec/lib/plugin/buffers/gesture_buffer_spec.rb
161
- - spec/lib/plugin/buffers/dummy_buffer.rb
162
- - spec/lib/plugin/buffers/buffer_spec.rb
163
- - spec/lib/plugin/manager_spec.rb
164
- - spec/lib/plugin/parsers/parser_spec.rb
165
- - spec/lib/plugin/parsers/libinput_gesture_parser_spec.rb
166
- - spec/lib/libinput-list-devices_magic_trackpad.txt
167
- - spec/lib/custom_process_spec.rb
168
- - spec/lib/device_spec.rb
169
- - spec/helpers/config_helper.rb
93
+ test_files: []
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'tempfile'
4
- require './lib/fusuma/config'
5
-
6
- module Fusuma
7
- module ConfigHelper
8
- module_function
9
-
10
- def load_config_yml=(string)
11
- Config.custom_path = Tempfile.open do |temp_file|
12
- temp_file.tap { |f| f.write(string) }
13
- end
14
- end
15
-
16
- def clear_config_yml
17
- Config.custom_path = nil
18
- end
19
- end
20
- end