keystroker 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/keystroker.rb +84 -0
- metadata +91 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e79e2708ddc9adbcc189164cb5b02f82c3c1e106f1a95217828e32ca21f703b0
|
4
|
+
data.tar.gz: 149d1cf22ba0cc98a1335317dfd9207be766eff9b552955c55b4d7e0b703ad16
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d2c4ccd0a14562df9bc3c09348759c367810f7d92b4c84febb5b54f0d13068669408a25f5119c901a3338d0ab0834192079394d04da647b4ab989a4c4151514
|
7
|
+
data.tar.gz: d59b1dedf5705625ee16e8ee340248a354cef9247946545ba296b4fead871cde63e30027cd1d02dd998be234a71a5b123d58db95dd062bd48892c33e510d9cf4
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/lib/keystroker.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: keystroker.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'rexle'
|
7
|
+
require 'rexle-builder'
|
8
|
+
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
#
|
13
|
+
# s = '{tab} this is a test {enter} {ctrl+a}'
|
14
|
+
# ks = Keystroker.new
|
15
|
+
# ks.parse_hg0(s)
|
16
|
+
# ks.to_kbml
|
17
|
+
|
18
|
+
|
19
|
+
class Keystroker
|
20
|
+
using ColouredText
|
21
|
+
|
22
|
+
def initialize(debug: false)
|
23
|
+
@debug = debug
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse_hg0(s)
|
27
|
+
|
28
|
+
xml = RexleBuilder.new
|
29
|
+
|
30
|
+
a3 = xml.kbml do
|
31
|
+
|
32
|
+
a = s.gsub(/\s*(?=\{)|(?<=\})\s*/,'').scan(/\{[^\}]+\}|./)\
|
33
|
+
.chunk {|x| x.length == 1}.map {|b, x| b ? x.join : x }.each do |x|
|
34
|
+
|
35
|
+
if x.is_a? Array then
|
36
|
+
|
37
|
+
x.each do |token|
|
38
|
+
|
39
|
+
token[1..-2].split(/\s*[;,]\s*/).each do |instruction|
|
40
|
+
|
41
|
+
puts ('instruction: ' + instruction.inspect).debug if @debug
|
42
|
+
|
43
|
+
if instruction =~ /\*\s*\d+/ then
|
44
|
+
|
45
|
+
key, n = instruction.split('*',2)
|
46
|
+
#n.to_i.times {keypress(key, duration: duration) }
|
47
|
+
xml.send(key.to_sym, {repeat: n})
|
48
|
+
|
49
|
+
else
|
50
|
+
|
51
|
+
keys = instruction.split('+')
|
52
|
+
|
53
|
+
if keys.length > 1 then
|
54
|
+
name = keys[0..-2].join('_').to_sym
|
55
|
+
xml.send(name, {key: keys.last})
|
56
|
+
else
|
57
|
+
xml.send(instruction.to_sym)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
else
|
65
|
+
xml.type x
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
@doc = Rexle.new(a3)
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_hg0()
|
77
|
+
end
|
78
|
+
|
79
|
+
def to_kbml(options={})
|
80
|
+
@doc.xml(options)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: keystroker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+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wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAZc//D43SVZUOQaV4kTD09gruz2+VMqOgAB6ntuRy
|
29
|
+
Qlwq1BqDrifuBhMqcF8xRX2dtlTbwayZ22+5Yc8p+0DPX0bc0//WQdz5ZCjNqihe
|
30
|
+
U4hHFe6SfvSHtSiGOS4YYN4Oh1kCOgbDGB/8m9kLo0WnoDXFUnpkcOBEnAqIYxwv
|
31
|
+
fn3lfyLv3bag+gj7Fx+Ml1qKerM5JEvL/Y8B+0bohod0arxUj/lMOIxatQW1Orv9
|
32
|
+
q+l1iD++mPRPPPY0w/+XoSuekMeJ+Wd1+2enf9URrhocKUQzjZDiD5JBjVgrLD89
|
33
|
+
KxHD5tE9jLRt+79Lau/3NVesOvmhTUVLlA48QeMtVft3hnHjbvcNjtRDOG5hwHWj
|
34
|
+
g2xXCtesJ0gUEJCbfbLHG6vsqocy/mAMDuQXQI2ET3JFtvam0l0TVvVTWpHIBDbx
|
35
|
+
Y75jscjma5VGumEWUU9ZrhHuSQ+SNpMw9dZtARbRcf8TnE4LLF9jWLtekrmnjrXR
|
36
|
+
fbotKKSziDi68epQo5Nn6RKn
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2019-04-20 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: rexle-builder
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.5'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.5.1
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.5'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.5.1
|
60
|
+
description:
|
61
|
+
email: james@jamesrobertson.eu
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- lib/keystroker.rb
|
67
|
+
homepage: https://github.com/jrobertson/keystroker
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.0.1
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Makes it easier to convert keystrokes from 1 format to another. Primary format
|
90
|
+
is KBML.
|
91
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|