dotremap 0.0.7 → 0.0.8
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 +4 -4
- data/dotremap.gemspec +3 -3
- data/lib/dotremap/config.rb +15 -0
- data/lib/dotremap/dsl/root.rb +8 -0
- data/lib/dotremap/property.rb +2 -0
- data/lib/dotremap/root.rb +10 -0
- data/lib/dotremap/version.rb +1 -1
- data/lib/dotremap/xml_tree.rb +14 -0
- data/spec/lib/dotremap_spec.rb +57 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a3201ef04414e04675f8af66cb93f57a9e25e9
|
4
|
+
data.tar.gz: 166885fbc52cbbcceee17877364759007bca8a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d04f733191b79d8e44cfbd7e54c1822a9b53fde2754211500ee7bd31f379f4dc46736a9f3169007995621f193c4183f4b65ec415478a9e43360b3297493c4726
|
7
|
+
data.tar.gz: 984a5717618fdfd4691d2b6a15ea21871c510b2e6d4a156dcb43284bcfe9759545accdb06e206696806ebe3b4a82e97bb285c725d4372db5b66b41c982001f3a
|
data/dotremap.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Dotremap::VERSION
|
9
9
|
spec.authors = ["Takashi Kokubun"]
|
10
10
|
spec.email = ["takashikkbn@gmail.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
13
|
-
spec.homepage = "https://github.com/k0kubun/
|
11
|
+
spec.summary = %q{This gem is moved to karabiner gem. https://github.com/k0kubun/karabiner-dsl}
|
12
|
+
spec.description = %q{This gem is moved to karabiner gem. https://github.com/k0kubun/karabiner-dsl}
|
13
|
+
spec.homepage = "https://github.com/k0kubun/karabiner-dsl"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/dotremap/dsl/root.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "dotremap/namespace"
|
2
2
|
require "dotremap/appdef"
|
3
|
+
require "dotremap/config"
|
3
4
|
require "dotremap/item"
|
4
5
|
require "dotremap/group"
|
5
6
|
require "dotremap/dsl/group"
|
@@ -13,6 +14,13 @@ module Dotremap::DSL::Root
|
|
13
14
|
add_child(group)
|
14
15
|
end
|
15
16
|
|
17
|
+
def config(name, &block)
|
18
|
+
config = Dotremap::Config.new(name)
|
19
|
+
config.parent = self
|
20
|
+
config.instance_exec(&block)
|
21
|
+
add_config(config)
|
22
|
+
end
|
23
|
+
|
16
24
|
def appdef(appname = '', options = {})
|
17
25
|
appdef = Dotremap::Appdef.new(appname, options)
|
18
26
|
add_child(appdef)
|
data/lib/dotremap/property.rb
CHANGED
data/lib/dotremap/root.rb
CHANGED
@@ -6,6 +6,10 @@ class Dotremap::Root
|
|
6
6
|
include Dotremap::XmlTree
|
7
7
|
include Dotremap::DSL::Root
|
8
8
|
|
9
|
+
def initialize
|
10
|
+
@configs = []
|
11
|
+
end
|
12
|
+
|
9
13
|
def to_xml
|
10
14
|
Dotremap::InvokeHistory.registered_applications.each do |application|
|
11
15
|
vkopenurldef = Dotremap::Vkopenurldef.new(application)
|
@@ -17,4 +21,10 @@ class Dotremap::Root
|
|
17
21
|
super(1),
|
18
22
|
].join("\n")
|
19
23
|
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def add_config(config)
|
28
|
+
@configs << config
|
29
|
+
end
|
20
30
|
end
|
data/lib/dotremap/version.rb
CHANGED
data/lib/dotremap/xml_tree.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
module Dotremap::XmlTree
|
2
|
+
attr_reader :parent
|
3
|
+
|
2
4
|
def add_child(*objects)
|
3
5
|
objects.each do |object|
|
4
6
|
childs << object
|
5
7
|
end
|
8
|
+
|
9
|
+
childs.each do |child|
|
10
|
+
child.parent = self
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
def search_childs(klass)
|
@@ -20,9 +26,17 @@ module Dotremap::XmlTree
|
|
20
26
|
].join("\n")
|
21
27
|
end
|
22
28
|
|
29
|
+
protected
|
30
|
+
|
31
|
+
attr_writer :parent
|
32
|
+
|
23
33
|
private
|
24
34
|
|
25
35
|
def childs
|
26
36
|
@childs ||= []
|
27
37
|
end
|
38
|
+
|
39
|
+
def parent
|
40
|
+
@parent
|
41
|
+
end
|
28
42
|
end
|
data/spec/lib/dotremap_spec.rb
CHANGED
@@ -246,7 +246,7 @@ describe Dotremap do
|
|
246
246
|
EOS
|
247
247
|
end
|
248
248
|
|
249
|
-
it "accepts
|
249
|
+
it "accepts group items" do
|
250
250
|
prepare_dotremap(<<-EOS)
|
251
251
|
group "Option" do
|
252
252
|
item "First" do
|
@@ -276,4 +276,60 @@ describe Dotremap do
|
|
276
276
|
</root>
|
277
277
|
EOS
|
278
278
|
end
|
279
|
+
|
280
|
+
context "when items are surrounded by config" do
|
281
|
+
it "accepts cmd combination" do
|
282
|
+
prepare_dotremap(<<-EOS)
|
283
|
+
config "Default" do
|
284
|
+
item "Command+A to Command+B" do
|
285
|
+
remap "Cmd-A", to: "Cmd-B"
|
286
|
+
end
|
287
|
+
end
|
288
|
+
EOS
|
289
|
+
|
290
|
+
expect_result(<<-EOS.unindent)
|
291
|
+
<?xml version="1.0"?>
|
292
|
+
<root>
|
293
|
+
<item>
|
294
|
+
<name>Command+A to Command+B</name>
|
295
|
+
<identifier>remap.command_a_to_command_b</identifier>
|
296
|
+
<autogen>__KeyToKey__ KeyCode::A, VK_COMMAND, KeyCode::B, VK_COMMAND</autogen>
|
297
|
+
</item>
|
298
|
+
</root>
|
299
|
+
EOS
|
300
|
+
end
|
301
|
+
|
302
|
+
it "accepts group items" do
|
303
|
+
prepare_dotremap(<<-EOS)
|
304
|
+
config "Original" do
|
305
|
+
group "Option" do
|
306
|
+
item "First" do
|
307
|
+
identifier "option.option_first"
|
308
|
+
end
|
309
|
+
|
310
|
+
item "Second" do
|
311
|
+
identifier "option.option_second"
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
EOS
|
316
|
+
|
317
|
+
expect_result(<<-EOS.unindent)
|
318
|
+
<?xml version="1.0"?>
|
319
|
+
<root>
|
320
|
+
<item>
|
321
|
+
<name>Option</name>
|
322
|
+
<item>
|
323
|
+
<name>First</name>
|
324
|
+
<identifier>option.option_first</identifier>
|
325
|
+
</item>
|
326
|
+
<item>
|
327
|
+
<name>Second</name>
|
328
|
+
<identifier>option.option_second</identifier>
|
329
|
+
</item>
|
330
|
+
</item>
|
331
|
+
</root>
|
332
|
+
EOS
|
333
|
+
end
|
334
|
+
end
|
279
335
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotremap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.0'
|
83
|
-
description:
|
83
|
+
description: This gem is moved to karabiner gem. https://github.com/k0kubun/karabiner-dsl
|
84
84
|
email:
|
85
85
|
- takashikkbn@gmail.com
|
86
86
|
executables:
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- img/enabled.png
|
102
102
|
- lib/dotremap.rb
|
103
103
|
- lib/dotremap/appdef.rb
|
104
|
+
- lib/dotremap/config.rb
|
104
105
|
- lib/dotremap/dsl/group.rb
|
105
106
|
- lib/dotremap/dsl/item.rb
|
106
107
|
- lib/dotremap/dsl/root.rb
|
@@ -122,7 +123,7 @@ files:
|
|
122
123
|
- spec/lib/dotremap/remap_spec.rb
|
123
124
|
- spec/lib/dotremap_spec.rb
|
124
125
|
- spec/spec_helper.rb
|
125
|
-
homepage: https://github.com/k0kubun/
|
126
|
+
homepage: https://github.com/k0kubun/karabiner-dsl
|
126
127
|
licenses:
|
127
128
|
- MIT
|
128
129
|
metadata: {}
|
@@ -145,7 +146,7 @@ rubyforge_project:
|
|
145
146
|
rubygems_version: 2.2.2
|
146
147
|
signing_key:
|
147
148
|
specification_version: 4
|
148
|
-
summary:
|
149
|
+
summary: This gem is moved to karabiner gem. https://github.com/k0kubun/karabiner-dsl
|
149
150
|
test_files:
|
150
151
|
- spec/lib/dotremap/appdef_spec.rb
|
151
152
|
- spec/lib/dotremap/karabiner_spec.rb
|