fusuma-plugin-sendkey 0.5.0 → 0.6.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: e1f133065105c5e8bcdc9dd04873d6245cb3b6357a1a9f45a437cd0150b5a959
4
- data.tar.gz: c6f759e41f007688902c837f1fedc65e00d70ee3a41bb8bc9baf28de48e3c8ed
3
+ metadata.gz: cdbd450a3576a7faf3c331d4a79aa78e9d3d806ac91e884adf83828d479af826
4
+ data.tar.gz: faf882164080733d4c019590dff0052d4dcbb42780870fb616e3714ef29cfc19
5
5
  SHA512:
6
- metadata.gz: 6390589b886bc137bed6e4bbd4cab68b890d7660fbf09462aa471557c8c7533cff11f73cec2f25ce3875489ef3abd44e82999af2f400dbe619470f29e4d2e17b
7
- data.tar.gz: 4f80040d29ff16b5184e2f2f51485e39e178a029da0aec8e2c647da9428bd08ab54f5814c49194eeccdfac012091e4235392768d02de71191fff8af3b9bf4f4f
6
+ metadata.gz: f78dde78d718f38b385f96301eaa23923d3225581473e4e523f93622142a33a64c24b228549c6b906a12917d7824b5162ed868e681c50e4fd7ca4143d6aea2d3
7
+ data.tar.gz: a3e6dcf360a8303faa9bbf89b7e3122571231fa614ef965189fd0a4b62de05a90fd6d826e74c2acc94aaed3de8d151c578d3eaee31bece54144f131492e7634c
data/README.md CHANGED
@@ -9,20 +9,35 @@
9
9
 
10
10
  Run the following code in your terminal.
11
11
 
12
- ### Install dependencies
12
+ ### 1. Install dependencies
13
+
14
+ #### For Debian Based Distros (Ubuntu, Debian, Mint, Pop!_OS)
13
15
 
14
16
  **NOTE: If you have installed ruby by apt, you must install ruby-dev.**
15
17
  ```sh
16
- $ sudo apt-get install libevdev-dev ruby-dev
18
+ $ sudo apt-get install libevdev-dev ruby-dev build-essential
17
19
  ```
18
20
 
19
- ### Install fusuma-plugin-sendkey
21
+ #### For Arch Based Distros (Manjaro, Arch)
22
+
23
+ ```zsh
24
+ $ sudo pacman -S libevdev base-devel
25
+ ```
26
+
27
+ ### 2. Install fusuma-plugin-sendkey
28
+
29
+
30
+ **Note For Arch Based Distros:** By default in Arch Linux, when running ```gem```, gems are installed per-user (into ```~/.gem/ruby/```), instead of system-wide (into ```/usr/lib/ruby/gems/```). This is considered the best way to manage gems on Arch, because otherwise they might interfere with gems installed by Pacman. (From Arch Wiki)
31
+
32
+ To install gems system-wide, see any of the methods listed on [Arch Wiki](https://wiki.archlinux.org/index.php/ruby#Installing_gems_system-wide)
33
+
20
34
 
21
35
  ```sh
36
+ $ sudo gem install revdev
37
+ $ sudo gem install bundler
22
38
  $ sudo gem install fusuma-plugin-sendkey
23
39
  ```
24
40
 
25
-
26
41
  ## List available keys
27
42
 
28
43
  ```sh
data/exe/fusuma-sendkey CHANGED
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'optparse'
5
+ require 'fusuma/plugin/inputs/libinput_command_input.rb'
5
6
  require_relative '../lib/fusuma/plugin/sendkey/keyboard.rb'
6
7
  require_relative '../lib/fusuma/plugin/sendkey/version.rb'
7
8
 
@@ -16,25 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.license = 'MIT'
17
17
 
18
18
  # Specify which files should be added to the gem when it is released.
19
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
- end
19
+ spec.files = Dir['{bin,lib,exe}/**/*', 'LICENSE*', 'README*', '*.gemspec']
20
+ spec.test_files = Dir['{test,spec,features}/**/*']
23
21
  spec.bindir = 'exe'
24
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
23
  spec.require_paths = ['lib']
26
24
 
27
- spec.add_dependency 'fusuma', '~> 1.7'
25
+ spec.add_dependency 'fusuma', '~> 2.0.0'
28
26
  spec.add_dependency 'revdev'
29
-
30
- spec.add_development_dependency 'bundler'
31
- spec.add_development_dependency 'github_changelog_generator', '~> 1.14'
32
- spec.add_development_dependency 'pry-byebug', '~> 3.4'
33
- spec.add_development_dependency 'pry-doc'
34
- spec.add_development_dependency 'pry-inline'
35
- spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'reek'
37
- spec.add_development_dependency 'rspec', '~> 3.0'
38
- spec.add_development_dependency 'rubocop'
39
- spec.add_development_dependency 'yard'
40
27
  end
@@ -1,31 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../sendkey/keyboard.rb'
3
+ require_relative '../sendkey/keyboard'
4
4
 
5
5
  module Fusuma
6
6
  module Plugin
7
7
  module Executors
8
8
  # Control Window or Workspaces by executing wctrl
9
9
  class SendkeyExecutor < Executor
10
+ def execute_keys
11
+ [:sendkey]
12
+ end
13
+
10
14
  def config_param_types
11
15
  {
12
- 'device_name': String
16
+ device_name: String
13
17
  }
14
18
  end
15
19
 
16
- # execute sendkey command
20
+ # fork and execute sendkey command
17
21
  # @param event [Event]
18
22
  # @return [nil]
19
23
  def execute(event)
20
24
  MultiLogger.info(sendkey: search_param(event))
21
25
  pid = fork do
22
26
  Process.daemon(true)
23
- keyboard.type(param: search_param(event))
27
+ _execute(event)
24
28
  end
25
29
 
26
30
  Process.detach(pid)
27
31
  end
28
32
 
33
+ # execute sendkey command
34
+ # @param event [Event]
35
+ # @return [nil]
36
+ def _execute(event)
37
+ keyboard.type(
38
+ param: search_param(event),
39
+ keep: search_keypress(event)
40
+ )
41
+ end
42
+
29
43
  # check executable
30
44
  # @param event [Event]
31
45
  # @return [TrueClass, FalseClass]
@@ -39,15 +53,24 @@ module Fusuma
39
53
 
40
54
  def keyboard
41
55
  @keyboard ||= begin
42
- name_pattren = config_params(:device_name)
43
- Sendkey::Keyboard.new(name_pattern: name_pattren)
44
- end
56
+ name_pattren = config_params(:device_name)
57
+ Sendkey::Keyboard.new(name_pattern: name_pattren)
58
+ end
45
59
  end
46
60
 
47
61
  def search_param(event)
48
62
  index = Config::Index.new([*event.record.index.keys, :sendkey])
49
63
  Config.search(index)
50
64
  end
65
+
66
+ # @param event [Event]
67
+ # @return [String]
68
+ def search_keypress(event)
69
+ keys = event.record.index.keys
70
+ keypress_index = keys.find_index { |k| k.symbol == :keypress }
71
+ code = keypress_index && keys[keypress_index + 1].symbol
72
+ code.to_s
73
+ end
51
74
  end
52
75
  end
53
76
  end
@@ -3,14 +3,15 @@
3
3
  require 'revdev'
4
4
  require 'fusuma/device'
5
5
 
6
- require_relative './device.rb'
6
+ require_relative './device'
7
7
 
8
8
  module Fusuma
9
9
  module Plugin
10
10
  module Sendkey
11
11
  # Emulate Keyboard
12
12
  class Keyboard
13
- def initialize(name_pattern: 'keyboard|Keyboard|KEYBOARD')
13
+ def initialize(name_pattern: nil)
14
+ name_pattern ||= 'keyboard|Keyboard|KEYBOARD'
14
15
  device = find_device(name_pattern: name_pattern)
15
16
 
16
17
  if device.nil?
@@ -24,12 +25,14 @@ module Fusuma
24
25
  attr_reader :device
25
26
 
26
27
  # @param param [String]
27
- def type(param:)
28
+ # @param keep [String]
29
+ def type(param:, keep: '')
28
30
  return unless param.is_a?(String)
29
31
 
30
- keycodes = split_param(param)
32
+ keep_keycodes = split_param(keep)
33
+ keycodes = split_param(param) - keep_keycodes
31
34
 
32
- clear_modifiers
35
+ clear_modifiers(keep_keycodes)
33
36
  keycodes.each { |keycode| key_event(keycode: keycode, press: true) }
34
37
  key_sync(press: true)
35
38
  keycodes.reverse.map { |keycode| key_event(keycode: keycode, press: false) }
@@ -98,10 +101,11 @@ module Fusuma
98
101
  Object.const_get "LinuxInput::#{keycode}"
99
102
  end
100
103
 
101
- def clear_modifiers
104
+ def clear_modifiers(keycodes)
102
105
  modifiers = %w[ CAPSLOCK LEFTALT LEFTCTRL LEFTMETA
103
106
  LEFTSHIFT RIGHTALT RIGHTCTRL RIGHTSHIFT ]
104
- modifiers.each { |code| key_event(keycode: key_prefix(code), press: false) }
107
+ .map { |code| key_prefix(code) }
108
+ (modifiers - keycodes).each { |code| key_event(keycode: code, press: false) }
105
109
  end
106
110
 
107
111
  private
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Sendkey
6
- VERSION = '0.5.0'
6
+ VERSION = '0.6.1'
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ require 'fusuma/plugin/executors/executor'
6
+ require 'fusuma/plugin/events/event'
7
+ require 'fusuma/plugin/events/records/index_record'
8
+
9
+ require './lib/fusuma/plugin/executors/sendkey_executor'
10
+
11
+ module Fusuma
12
+ module Plugin
13
+ module Executors
14
+ RSpec.describe SendkeyExecutor do
15
+ around do |example|
16
+ ConfigHelper.load_config_yml = <<~CONFIG
17
+ dummy:
18
+ 1:
19
+ direction:
20
+ sendkey: KEY_CODE
21
+ keypress:
22
+ LEFTSHIFT:
23
+ sendkey: KEY_CODE_WITH_KEYPRESS
24
+
25
+ plugin:
26
+ executors:
27
+ sendkey_executor:
28
+ device_name: dummy
29
+ CONFIG
30
+
31
+ example.run
32
+
33
+ Config.custom_path = nil
34
+ end
35
+
36
+ before do
37
+ index = Config::Index.new([:dummy, 1, :direction])
38
+ record = Events::Records::IndexRecord.new(index: index)
39
+ @event = Events::Event.new(tag: 'dummy_detector', record: record)
40
+ @executor = SendkeyExecutor.new
41
+
42
+ @keyboard = double(Sendkey::Keyboard)
43
+
44
+ allow(@executor).to receive(:keyboard).and_return @keyboard
45
+ end
46
+
47
+ describe '#execute' do
48
+ before do
49
+ allow(Process).to receive(:daemon).with(true)
50
+ allow(Process).to receive(:detach).with(anything)
51
+ end
52
+ it 'fork' do
53
+ expect(@executor).to receive(:fork).and_yield do |block_context|
54
+ expect(block_context).to receive(:_execute).with(@event)
55
+ end
56
+
57
+ @executor.execute(@event)
58
+ end
59
+ end
60
+
61
+ describe '#_execute' do
62
+ after do
63
+ @executor._execute(@event)
64
+ end
65
+ it 'send KEY_CODE message to keybard' do
66
+ expect(@executor).to receive(:search_param).with(@event).and_return('KEY_CODE')
67
+ expect(@executor).to receive(:search_keypress).with(@event).and_return(nil)
68
+ expect(@keyboard).to receive(:type).with(param: 'KEY_CODE', keep: nil)
69
+ end
70
+
71
+ context 'with keypress' do
72
+ before do
73
+ index_with_keypress = Config::Index.new(
74
+ [:dummy, 1, :direction, :keypress, :LEFTSHIFT]
75
+ )
76
+ record = Events::Records::IndexRecord.new(index: index_with_keypress)
77
+ @event = Events::Event.new(tag: 'dummy_detector', record: record)
78
+ end
79
+ it 'send KEY_CODE_WITH_KEYPRESS message to keybard' do
80
+ expect(@keyboard).to receive(:type)
81
+ .with(param: 'KEY_CODE_WITH_KEYPRESS', keep: 'LEFTSHIFT')
82
+ end
83
+ end
84
+ end
85
+
86
+ describe '#executable?' do
87
+ before do
88
+ allow(@keyboard).to receive(:valid?).with(param: 'MODIFIER_CODE+KEY_CODE')
89
+ .and_return true
90
+ allow(@keyboard).to receive(:valid?).with(param: 'KEY_CODE')
91
+ .and_return true
92
+ allow(@keyboard).to receive(:valid?).with(param: 'INVALID_CODE')
93
+ .and_return false
94
+ end
95
+ context 'when given valid event tagged as xxxx_detector' do
96
+ it { expect(@executor.executable?(@event)).to be_truthy }
97
+ end
98
+
99
+ context 'when given INVALID event tagged as invalid_tag' do
100
+ before do
101
+ @event.tag = 'invalid_tag'
102
+ end
103
+ it { expect(@executor.executable?(@event)).to be_falsey }
104
+ end
105
+
106
+ context "when sendkey: 'MODIFIER_CODE+KEY_CODE'" do
107
+ around do |example|
108
+ ConfigHelper.load_config_yml = <<~CONFIG
109
+ dummy:
110
+ 1:
111
+ direction:
112
+ sendkey: 'MODIFIER_CODE+KEY_CODE'
113
+ plugin:
114
+ executors:
115
+ sendkey_executor:
116
+ device_name: dummy
117
+ CONFIG
118
+
119
+ example.run
120
+
121
+ Config.custom_path = nil
122
+ end
123
+
124
+ it 'should return true' do
125
+ expect(@executor.executable?(@event)).to be_truthy
126
+ end
127
+ end
128
+
129
+ context "when sendkey: 'INVALID_CODE'" do
130
+ around do |example|
131
+ ConfigHelper.load_config_yml = <<~CONFIG
132
+ dummy:
133
+ 1:
134
+ direction:
135
+ sendkey: 'INVALID_CODE'
136
+ plugin:
137
+ executors:
138
+ sendkey_executor:
139
+ device_name: dummy
140
+ CONFIG
141
+
142
+ example.run
143
+
144
+ Config.custom_path = nil
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,204 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ require './lib/fusuma/plugin/sendkey/keyboard'
6
+
7
+ module Fusuma
8
+ module Plugin
9
+ module Sendkey
10
+ RSpec.describe Keyboard do
11
+ describe '#new' do
12
+ context 'keyboard is found' do
13
+ before do
14
+ dummy_keyboard = Fusuma::Device.new(name: 'dummy keyboard')
15
+ allow_any_instance_of(Sendkey::Keyboard)
16
+ .to receive(:find_device)
17
+ .and_return(dummy_keyboard)
18
+ allow(Sendkey::Device).to receive(:new).and_return('dummy')
19
+ end
20
+
21
+ it 'should not raise error' do
22
+ expect { Keyboard.new }.not_to raise_error
23
+ end
24
+ end
25
+
26
+ context 'keyboard is not found' do
27
+ before do
28
+ allow_any_instance_of(Sendkey::Keyboard)
29
+ .to receive(:find_device)
30
+ .and_return(nil)
31
+ end
32
+
33
+ it 'should not raise error' do
34
+ expect { Keyboard.new }.to raise_error SystemExit
35
+ end
36
+ end
37
+
38
+ context 'detected device name is Keyboard (Capitarized)' do
39
+ before do
40
+ other_device = Fusuma::Device.new(name: 'Keyboard', id: 'dummy')
41
+
42
+ allow_any_instance_of(Sendkey::Keyboard)
43
+ .to receive(:find_device)
44
+ .and_return(other_device)
45
+ allow(Sendkey::Device).to receive(:new).and_return('dummy')
46
+ end
47
+
48
+ it 'should not raise error' do
49
+ expect { Keyboard.new }.not_to raise_error
50
+ end
51
+ end
52
+
53
+ context 'detected device name is KEYBOARD (Upper case)' do
54
+ before do
55
+ other_device = Fusuma::Device.new(name: 'KEYBOARD', id: 'dummy')
56
+ allow_any_instance_of(Sendkey::Keyboard)
57
+ .to receive(:find_device)
58
+ .and_return(other_device)
59
+ allow(Sendkey::Device).to receive(:new).and_return('dummy')
60
+ end
61
+
62
+ it 'should not raise error' do
63
+ expect { Keyboard.new }.not_to raise_error
64
+ end
65
+ end
66
+
67
+ context 'given name pattern' do
68
+ before do
69
+ specified_device = Fusuma::Device.new(
70
+ name: 'Awesome KEY/BOARD input device',
71
+ id: 'dummy'
72
+ )
73
+ allow(Fusuma::Device).to receive(:all).and_return([specified_device])
74
+ allow(Sendkey::Device).to receive(:new).and_return('dummy')
75
+ end
76
+
77
+ it 'should not raise error' do
78
+ expect { Keyboard.new(name_pattern: 'Awesome KEY/BOARD') }.not_to raise_error
79
+ end
80
+ end
81
+
82
+ context 'not given name pattern (use default)' do
83
+ subject { -> { Keyboard.new(name_pattern: nil) } }
84
+ before do
85
+ allow(Sendkey::Device).to receive(:new).and_return('dummy')
86
+ end
87
+
88
+ context 'exist device named keyboard' do
89
+ before do
90
+ specified_device = Fusuma::Device.new(
91
+ name: 'keyboard',
92
+ id: 'dummy'
93
+ )
94
+ allow(Fusuma::Device).to receive(:all).and_return([specified_device])
95
+ end
96
+
97
+ it { is_expected.not_to raise_error }
98
+ end
99
+
100
+ context 'exist device named Keyboard' do
101
+ before do
102
+ specified_device = Fusuma::Device.new(
103
+ name: 'Keyboard',
104
+ id: 'dummy'
105
+ )
106
+ allow(Fusuma::Device).to receive(:all).and_return([specified_device])
107
+ end
108
+
109
+ it { is_expected.not_to raise_error }
110
+ end
111
+
112
+ context 'exist device named KEYBOARD' do
113
+ before do
114
+ specified_device = Fusuma::Device.new(
115
+ name: 'KEYBOARD',
116
+ id: 'dummy'
117
+ )
118
+ allow(Fusuma::Device).to receive(:all).and_return([specified_device])
119
+ end
120
+
121
+ it { is_expected.not_to raise_error }
122
+ end
123
+
124
+ context 'exist no device named keyboard|Keyboard|KEYBOARD' do
125
+ before do
126
+ specified_device = Fusuma::Device.new(
127
+ name: 'KEY-BOARD',
128
+ id: 'dummy'
129
+ )
130
+ allow(Fusuma::Device).to receive(:all).and_return([specified_device])
131
+ end
132
+
133
+ it { is_expected.to raise_error(SystemExit) }
134
+ end
135
+ end
136
+ end
137
+
138
+ describe '#type' do
139
+ before do
140
+ allow_any_instance_of(Sendkey::Keyboard)
141
+ .to receive(:find_device)
142
+ .and_return(Fusuma::Device.new(name: 'dummy keyboard'))
143
+
144
+ @device = double(Sendkey::Device)
145
+ allow(@device).to receive(:write_event).with(anything)
146
+ # allow(@device).to receive(:valid?).with(param: 'KEY_A')
147
+
148
+ allow(Sendkey::Device).to receive(:new).and_return(@device)
149
+
150
+ @keyboard = Keyboard.new
151
+ end
152
+
153
+ it 'should press key KEY_A and release KEY_A' do
154
+ expect(@keyboard).to receive(:clear_modifiers).ordered
155
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: true).ordered
156
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: false).ordered
157
+ @keyboard.type(param: 'A')
158
+ end
159
+
160
+ context 'with modifier keys' do
161
+ before do
162
+ @keys = 'LEFTSHIFT+A'
163
+ end
164
+
165
+ it 'should type AB' do
166
+ expect(@keyboard).to receive(:clear_modifiers).ordered
167
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_LEFTSHIFT', press: true).ordered
168
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: true).ordered
169
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: false).ordered
170
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_LEFTSHIFT', press: false).ordered
171
+ @keyboard.type(param: @keys)
172
+ end
173
+ end
174
+ context 'with multiple keys' do
175
+ before do
176
+ @keys = 'A+B'
177
+ end
178
+
179
+ it 'should type AB' do
180
+ expect(@keyboard).to receive(:clear_modifiers).ordered
181
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: true).ordered
182
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_B', press: true).ordered
183
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_B', press: false).ordered
184
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: false).ordered
185
+ @keyboard.type(param: @keys)
186
+ end
187
+ end
188
+ context 'with keypress' do
189
+ before do
190
+ @keys = 'LEFTSHIFT+A'
191
+ @keypress_keys = 'LEFTSHIFT'
192
+ end
193
+ it 'should type A (without LEFTSHIFT key pressing by user)' do
194
+ expect(@keyboard).to receive(:clear_modifiers).ordered
195
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: true).ordered
196
+ expect(@keyboard).to receive(:key_event).with(keycode: 'KEY_A', press: false).ordered
197
+ @keyboard.type(param: @keys, keep: @keypress_keys)
198
+ end
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Fusuma::Plugin::Sendkey do
4
+ it 'has a version number' do
5
+ expect(Fusuma::Plugin::Sendkey::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tempfile'
4
+ require 'fusuma/config.rb'
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
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'helpers/config_helper.rb'
5
+
6
+ RSpec.configure do |config|
7
+ # Enable flags like --only-failures and --next-failure
8
+ config.example_status_persistence_file_path = '.rspec_status'
9
+
10
+ # Disable RSpec exposing methods globally on `Module` and `main`
11
+ config.disable_monkey_patching!
12
+
13
+ config.expect_with :rspec do |c|
14
+ c.syntax = :expect
15
+ end
16
+
17
+ config.include(Fusuma::ConfigHelper)
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusuma-plugin-sendkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusuma
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: revdev
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,146 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: github_changelog_generator
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.14'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.14'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-byebug
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.4'
83
- - !ruby/object:Gem::Dependency
84
- name: pry-doc
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pry-inline
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '13.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '13.0'
125
- - !ruby/object:Gem::Dependency
126
- name: reek
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.0'
153
- - !ruby/object:Gem::Dependency
154
- name: rubocop
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: yard
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
41
  description: Fusuma::Plugin::Sendkey emulate keyboard events with evdev
182
42
  email:
183
43
  - yhkyky@gmail.com
@@ -186,16 +46,8 @@ executables:
186
46
  extensions: []
187
47
  extra_rdoc_files: []
188
48
  files:
189
- - ".gitignore"
190
- - ".rspec"
191
- - ".rubocop.yml"
192
- - ".travis.yml"
193
- - CHANGELOG.md
194
- - CODE_OF_CONDUCT.md
195
- - Gemfile
196
49
  - LICENSE.txt
197
50
  - README.md
198
- - Rakefile
199
51
  - bin/console
200
52
  - bin/setup
201
53
  - exe/fusuma-sendkey
@@ -205,6 +57,11 @@ files:
205
57
  - lib/fusuma/plugin/sendkey/device.rb
206
58
  - lib/fusuma/plugin/sendkey/keyboard.rb
207
59
  - lib/fusuma/plugin/sendkey/version.rb
60
+ - spec/fusuma/plugin/executors/sendkey_executor_spec.rb
61
+ - spec/fusuma/plugin/sendkey/keyboard_spec.rb
62
+ - spec/fusuma/plugin/sendkey_spec.rb
63
+ - spec/helpers/config_helper.rb
64
+ - spec/spec_helper.rb
208
65
  homepage: https://github.com/iberianpig/fusuma-plugin-sendkey
209
66
  licenses:
210
67
  - MIT
@@ -224,8 +81,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
81
  - !ruby/object:Gem::Version
225
82
  version: '0'
226
83
  requirements: []
227
- rubygems_version: 3.0.3
84
+ rubygems_version: 3.1.4
228
85
  signing_key:
229
86
  specification_version: 4
230
87
  summary: Fusuma plugin to send keyboard events
231
- test_files: []
88
+ test_files:
89
+ - spec/fusuma/plugin/sendkey_spec.rb
90
+ - spec/fusuma/plugin/sendkey/keyboard_spec.rb
91
+ - spec/fusuma/plugin/executors/sendkey_executor_spec.rb
92
+ - spec/helpers/config_helper.rb
93
+ - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
13
- .ruby-version
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,20 +0,0 @@
1
- Metrics/ModuleLength:
2
- Exclude:
3
- - "**/*_spec.rb"
4
-
5
- Metrics/BlockLength:
6
- Exclude:
7
- - "**/*_spec.rb"
8
- - "fusuma-plugin-*.gemspec"
9
-
10
- Metrics/LineLength:
11
- Max: 100
12
- Exclude:
13
- - "fusuma-plugin-*.gemspec"
14
-
15
- Style/HashEachMethods:
16
- Enabled: true
17
- Style/HashTransformKeys:
18
- Enabled: true
19
- Style/HashTransformValues:
20
- Enabled: true
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.1
7
- before_install:
8
- - gem install bundler -v 2.0.1
9
- - sudo apt-get -y install libevdev-dev
data/CHANGELOG.md DELETED
@@ -1,21 +0,0 @@
1
- # Changelog
2
-
3
- ## [Unreleased](https://github.com/iberianpig/fusuma-plugin-keypress/tree/HEAD)
4
-
5
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.1...HEAD)
6
-
7
- **Closed issues:**
8
-
9
- - Trigger a command multiple times while keeping the key pressed [\#1](https://github.com/iberianpig/fusuma-plugin-keypress/issues/1)
10
-
11
- ## [v0.1.1](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.1) (2020-02-18)
12
-
13
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.0...v0.1.1)
14
-
15
- ## [v0.1.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.0) (2019-11-12)
16
-
17
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/fb8d8ccfc3828e487607706335f670ae5392f08d...v0.1.0)
18
-
19
-
20
-
21
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at yhkyky@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in fusuma-plugin-sendkey.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
9
-
10
- require 'github_changelog_generator/task'
11
-
12
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
13
- config.user = 'iberianpig'
14
- config.project = 'fusuma-plugin-keypress'
15
- end