fusuma-plugin-keypress 0.4.0 → 0.4.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: f33f3196c9ba712276a56e29db656f3724e1ab82db949bd2193d04103731ceab
4
- data.tar.gz: c9808534898abd791e7aa5509c3d76cdd647e5ed0e23fd0afbbd6e3998c2c8a7
3
+ metadata.gz: 0701111fbc7fb83f15edc252e1cfa67ec636520dcd6a90fa68ec8163a48ad6d5
4
+ data.tar.gz: aaac5cd36824ecf8f7012406e7bcfeca569f412b299367f0f602ec48d4885a42
5
5
  SHA512:
6
- metadata.gz: f450629cf53f1ed83abf32777575f56ef6f0856ee03dc0e0716aa27cf4723370524c8819cf2606d75de05188952701c92d604e85e19a8af25e51777edb400d35
7
- data.tar.gz: cdf5aa65fabf23e5428822c4061b936fb718cbfcb77726ad4f4d99784d13ae535ea8cfa292ac54d037dc21e97c0d14488c6554d309fb900ba91909930b27cf9f
6
+ metadata.gz: 6bd4c472b48cfa0bd2b09581a4cf348292b088f9ed66c852ad0d9c6fc4d59f5019bd76be84affd122afda04415b9eaf0800f926e11cf7c3a2e99e113e873edba
7
+ data.tar.gz: 7bd7157b88e160b5dd6ffb4ec73ade7d40894d20a13e65efda0b11940d3e3366f8847fdf549532d41bcdb829d1db07fde23b0eb1f20b55ff9622fec0a3bb9a19
@@ -16,10 +16,8 @@ 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']
@@ -3,7 +3,7 @@
3
3
  module Fusuma
4
4
  module Plugin
5
5
  module Keypress
6
- VERSION = '0.4.0'
6
+ VERSION = '0.4.1'
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ require 'fusuma/plugin/detectors/detector'
6
+ require 'fusuma/plugin/buffers/buffer'
7
+
8
+ require './lib/fusuma/plugin/buffers/keypress_buffer'
9
+ require './lib/fusuma/plugin/detectors/keypress_detector'
10
+
11
+ module Fusuma
12
+ module Plugin
13
+ module Detectors
14
+ RSpec.describe KeypressDetector do
15
+ before do
16
+ @detector = KeypressDetector.new
17
+ @buffer = Buffers::KeypressBuffer.new
18
+ end
19
+
20
+ describe '#detector' do
21
+ context 'with no keypress event in buffer' do
22
+ before do
23
+ @buffer.clear
24
+ end
25
+
26
+ it { expect(@detector.detect([@buffer])).to eq nil }
27
+ end
28
+ end
29
+
30
+ context 'with keypress events in buffer' do
31
+ before do
32
+ record = Events::Records::KeypressRecord.new(status: 'pressed', code: 'LEFTSHIFT')
33
+ event = Events::Event.new(tag: 'keypress_parser', record: record)
34
+
35
+ @buffer.buffer(event)
36
+ end
37
+ it { expect(@detector.detect([@buffer])).to be_a Events::Event }
38
+ it { expect(@detector.detect([@buffer]).record).to be_a Events::Records::IndexRecord }
39
+ it { expect(@detector.detect([@buffer]).record.index).to be_a Config::Index }
40
+
41
+ it 'should detect LEFTSHIFT' do
42
+ expect(@detector.detect([@buffer]).record.index.keys.map(&:symbol))
43
+ .to eq(%i[keypress LEFTSHIFT])
44
+ end
45
+ end
46
+
47
+ context 'with two different keypress events in buffer' do
48
+ before do
49
+ record1 = Events::Records::KeypressRecord.new(status: 'pressed', code: 'LEFTSHIFT')
50
+ record2 = Events::Records::KeypressRecord.new(status: 'pressed', code: 'LEFTCTRL')
51
+ event1 = Events::Event.new(tag: 'keypress_parser', record: record1)
52
+ event2 = Events::Event.new(tag: 'keypress_parser', record: record2)
53
+
54
+ @buffer.buffer(event1)
55
+ @buffer.buffer(event2)
56
+ end
57
+
58
+ it 'should detect LEFTSHIFT+LEFTCTRL' do
59
+ expect(@detector.detect([@buffer]).record.index.keys.map(&:symbol))
60
+ .to eq(%i[keypress LEFTSHIFT+LEFTCTRL])
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Fusuma::Plugin::Keypress do
6
+ it 'has a version number' do
7
+ expect(Fusuma::Plugin::Keypress::VERSION).not_to be nil
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tempfile'
4
+ require '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
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'helpers/config_helper'
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-keypress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iberianpig
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-12 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
@@ -31,19 +31,11 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - ".gitignore"
35
- - ".rubocop.yml"
36
- - ".travis.yml"
37
- - CHANGELOG.md
38
- - CODE_OF_CONDUCT.md
39
- - Gemfile
40
34
  - LICENSE.txt
41
35
  - README.md
42
- - Rakefile
43
36
  - bin/console
44
37
  - bin/setup
45
38
  - fusuma-plugin-keypress.gemspec
46
- - lefthook.yml
47
39
  - lib/fusuma/plugin/buffers/keypress_buffer.rb
48
40
  - lib/fusuma/plugin/detectors/keypress_detector.rb
49
41
  - lib/fusuma/plugin/events/records/keypress_record.rb
@@ -51,11 +43,15 @@ files:
51
43
  - lib/fusuma/plugin/keypress.rb
52
44
  - lib/fusuma/plugin/keypress/version.rb
53
45
  - lib/fusuma/plugin/parsers/keypress_parser.rb
46
+ - spec/fusuma/plugin/detectors/keypress_detector_spec.rb
47
+ - spec/fusuma/plugin/keypress_spec.rb
48
+ - spec/helpers/config_helper.rb
49
+ - spec/spec_helper.rb
54
50
  homepage: https://github.com/iberianpig/fusuma-plugin-keypress
55
51
  licenses:
56
52
  - MIT
57
53
  metadata: {}
58
- post_install_message:
54
+ post_install_message:
59
55
  rdoc_options: []
60
56
  require_paths:
61
57
  - lib
@@ -71,7 +67,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
67
  version: '0'
72
68
  requirements: []
73
69
  rubygems_version: 3.1.4
74
- signing_key:
70
+ signing_key:
75
71
  specification_version: 4
76
72
  summary: Keypress plugin for Fusuma
77
- test_files: []
73
+ test_files:
74
+ - spec/fusuma/plugin/detectors/keypress_detector_spec.rb
75
+ - spec/fusuma/plugin/keypress_spec.rb
76
+ - spec/helpers/config_helper.rb
77
+ - 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/.rubocop.yml DELETED
@@ -1,17 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.4
3
- NewCops: enable
4
-
5
- Metrics/ModuleLength:
6
- Exclude:
7
- - "**/*_spec.rb"
8
-
9
- Metrics/BlockLength:
10
- Exclude:
11
- - "**/*_spec.rb"
12
- - "fusuma-plugin-*.gemspec"
13
-
14
- Metrics/LineLength:
15
- Max: 100
16
- Exclude:
17
- - "fusuma-plugin-*.gemspec"
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.3.1
7
- - 2.4
8
- - 2.5
9
- - 2.6
10
- before_install: gem install bundler --no-document -v 2.0.1
data/CHANGELOG.md DELETED
@@ -1,37 +0,0 @@
1
- # Changelog
2
-
3
- ## [v0.4.0.pre](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.4.0.pre) (2020-11-09)
4
-
5
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.3.0...v0.4.0.pre)
6
-
7
- ## [v0.3.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.3.0) (2020-11-09)
8
-
9
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.2.1...v0.3.0)
10
-
11
- ## [v0.2.1](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.2.1) (2020-04-15)
12
-
13
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.2.0...v0.2.1)
14
-
15
- **Closed issues:**
16
-
17
- - Only 'LEFTMETA' keycode works on KDE Plasma [\#2](https://github.com/iberianpig/fusuma-plugin-keypress/issues/2)
18
-
19
- ## [v0.2.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.2.0) (2020-03-18)
20
-
21
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.1...v0.2.0)
22
-
23
- **Closed issues:**
24
-
25
- - Trigger a command multiple times while keeping the key pressed [\#1](https://github.com/iberianpig/fusuma-plugin-keypress/issues/1)
26
-
27
- ## [v0.1.1](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.1) (2020-02-18)
28
-
29
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/v0.1.0...v0.1.1)
30
-
31
- ## [v0.1.0](https://github.com/iberianpig/fusuma-plugin-keypress/tree/v0.1.0) (2019-11-12)
32
-
33
- [Full Changelog](https://github.com/iberianpig/fusuma-plugin-keypress/compare/fb8d8ccfc3828e487607706335f670ae5392f08d...v0.1.0)
34
-
35
-
36
-
37
- \* *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,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in fusuma-plugin-keypress.gemspec
6
- gemspec
7
-
8
- gem 'bundler'
9
- gem 'github_changelog_generator'
10
- gem 'lefthook'
11
- gem 'pry-byebug', '~> 3.4'
12
- gem 'pry-doc'
13
- gem 'pry-inline'
14
- gem 'rake', '~> 13.0'
15
- gem 'reek'
16
- gem 'rspec', '~> 3.0'
17
- gem 'rubocop'
18
- gem 'yard'
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
data/lefthook.yml DELETED
@@ -1,29 +0,0 @@
1
- # EXAMPLE USAGE
2
- # Refer for explanation to following link:
3
- # https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
4
-
5
- # pre-push:
6
- # commands:
7
- # packages-audit:
8
- # tags: frontend security
9
- # run: yarn audit
10
- # gems-audit:
11
- # tags: backend security
12
- # run: bundle audit
13
-
14
- pre-commit:
15
- parallel: true
16
- commands:
17
- # eslint:
18
- # glob: "*.{js,ts}"
19
- # run: yarn eslint {staged_files}
20
- rubocop:
21
- tags: backend style
22
- glob: "*.rb"
23
- # exclude: "application.rb|routes.rb"
24
- run: bundle exec rubocop --force-exclusion {staged_files}
25
- # scripts:
26
- # "hello.js":
27
- # runner: node
28
- # "any.go":
29
- # runner: go run