dotremap 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 356d139bf46ab26460bf9409525b4951cd3d0f6c
4
- data.tar.gz: 5fadcbf911f0ac04b47c7f288517dd32d2cb10be
3
+ metadata.gz: 2565edd99e70d87d291922f50fac172786cda851
4
+ data.tar.gz: 14c619762f9d4bb688c9b49339ca7253fd9fd638
5
5
  SHA512:
6
- metadata.gz: bd7128cfb57e602bc52822dd9abaa04cddcf5b973340f35669eda3e6911dd3763d92eb87778cf37a7f7b8b6e7ab8178c47d4fcf0cf2a70bf4efc09cc47717e1c
7
- data.tar.gz: da27b54c31baef8a57bce3536a90d7a1c7e5f958def07dc426c54d755c140142e8f667bb746fc4007d8bb22c440ab6975120028effabc857e13525d5f96c1fcf
6
+ metadata.gz: 29bd9f928e56fa0f9362f8ec135e819f14bd5619a0cd2bd3c0b15a2d6fff3375ee240e1f497d2d83a13ba481543bac5b54981ca5ecc66230c9ea736f84951e25
7
+ data.tar.gz: a5385502fce80e93a251e5ea19f64966f0e2018f8d7b5b8bed2aecd74c5e002f7ca8ce730f83417378a6f1620487ba0fe163fa36be78c11e173a11462c6c9b31
data/README.md CHANGED
@@ -104,9 +104,10 @@ F1 F2 ... F11 F12
104
104
  Up Down Right Left
105
105
  space tab delete forward_delete capslock
106
106
 
107
- Ctrl_R Ctrl_L
108
- Opt_R Opt_L
109
- Cmd_R Cmd_L
107
+ Ctrl_R Ctrl_L
108
+ Opt_R Opt_L
109
+ Cmd_R Cmd_L
110
+ Shift_R Shift_L
110
111
  ```
111
112
 
112
113
  ### Advanced usage
@@ -1,4 +1,8 @@
1
+ require "dotremap/xml_tree"
2
+
1
3
  class Dotremap::Appdef
4
+ include Dotremap::XmlTree
5
+
2
6
  AVAILABLE_OPTIONS = %i(
3
7
  equal
4
8
  prefix
@@ -6,23 +10,14 @@ class Dotremap::Appdef
6
10
  ).freeze
7
11
 
8
12
  def initialize(appname, options)
9
- @childs = []
10
- @appname = appname
13
+ property = Dotremap::Property.new("appname", appname)
14
+ add_child(property)
11
15
 
12
16
  options.each do |option, value|
13
17
  raise "Unavailable option: #{property}" unless AVAILABLE_OPTIONS.include?(option)
14
- @childs << Dotremap::Property.new(option, value)
15
- end
16
- end
17
18
 
18
- def to_xml
19
- [
20
- "<appdef>",
21
- [
22
- "<appname>#{@appname}</appname>",
23
- *@childs.map(&:to_xml),
24
- ].join("\n").gsub(/^/, " "),
25
- "</appdef>",
26
- ].join("\n")
19
+ property = Dotremap::Property.new(option, value)
20
+ add_child(property)
21
+ end
27
22
  end
28
23
  end
@@ -0,0 +1,10 @@
1
+ require "dotremap/namespace"
2
+ require "dotremap/item"
3
+
4
+ module Dotremap::DSL::Group
5
+ def item(name = nil, options = {}, &block)
6
+ item = Dotremap::Item.new(name, options)
7
+ item.instance_exec(&block)
8
+ add_child(item)
9
+ end
10
+ end
@@ -1,7 +1,7 @@
1
- require "dotremap/dsl"
1
+ require "dotremap/namespace"
2
2
  require "dotremap/property"
3
3
  require "dotremap/remap"
4
- require "dotremap/openurl"
4
+ require "dotremap/invoke_history"
5
5
 
6
6
  module Dotremap::DSL::Item
7
7
  AVAILABLE_PROPERTIES = %i(
@@ -12,16 +12,16 @@ module Dotremap::DSL::Item
12
12
 
13
13
  def remap(target, options = {})
14
14
  remap = Dotremap::Remap.new(target, options[:to])
15
- childs << remap
15
+ add_child(remap)
16
16
  end
17
17
 
18
18
  def show_message(message)
19
19
  property = Dotremap::Property.new("autogen", "__ShowStatusMessage__ #{message}")
20
- childs << property
20
+ add_child(property)
21
21
  end
22
22
 
23
23
  def invoke(application)
24
- Dotremap::Openurl.register(application)
24
+ Dotremap::InvokeHistory.register(application)
25
25
  "VK_OPEN_URL_APP_#{application.gsub(/ /, '_')}"
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ module Dotremap::DSL::Item
30
30
  def method_missing(property, value = '', options = {})
31
31
  if AVAILABLE_PROPERTIES.include?(property)
32
32
  property = Dotremap::Property.new(property, value, options)
33
- childs << property
33
+ add_child(property)
34
34
  else
35
35
  super
36
36
  end
@@ -1,16 +1,20 @@
1
+ require "dotremap/namespace"
1
2
  require "dotremap/appdef"
2
- require "dotremap/dsl"
3
3
  require "dotremap/item"
4
+ require "dotremap/group"
5
+ require "dotremap/dsl/group"
4
6
 
5
7
  module Dotremap::DSL::Root
6
- def item(name = nil, options = {}, &block)
7
- item = Dotremap::Item.new(name, options)
8
- item.instance_exec(&block)
9
- childs << item
8
+ include Dotremap::DSL::Group
9
+
10
+ def group(name, &block)
11
+ group = Dotremap::Group.new(name)
12
+ group.instance_exec(&block)
13
+ add_child(group)
10
14
  end
11
15
 
12
16
  def appdef(appname = '', options = {})
13
17
  appdef = Dotremap::Appdef.new(appname, options)
14
- childs << appdef
18
+ add_child(appdef)
15
19
  end
16
20
  end
@@ -0,0 +1,16 @@
1
+ require "forwardable"
2
+ require "dotremap/namespace"
3
+ require "dotremap/dsl/group"
4
+
5
+ class Dotremap::Group
6
+ extend Forwardable
7
+ include Dotremap::XmlTree
8
+ include Dotremap::DSL::Group
9
+
10
+ def_delegator :@item, :to_xml
11
+ def_delegator :@item, :add_child
12
+
13
+ def initialize(name)
14
+ @item = Dotremap::Item.new(name, skip_identifier: true)
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require "set"
2
+ require "dotremap/vkopenurldef"
3
+
4
+ module Dotremap::InvokeHistory
5
+ def self.clear_histroy
6
+ @@registered_applications = Set.new
7
+ end
8
+
9
+ def self.register(application)
10
+ registered_applications.add(application)
11
+ end
12
+
13
+ def self.registered_applications
14
+ @@registered_applications ||= Set.new
15
+ end
16
+ end
data/lib/dotremap/item.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require "dotremap/dsl/item"
2
+ require "dotremap/xml_tree"
2
3
 
3
4
  class Dotremap::Item
5
+ include Dotremap::XmlTree
4
6
  include Dotremap::DSL::Item
5
7
 
6
8
  AVAILABLE_OPTIONS = %i(
@@ -10,40 +12,38 @@ class Dotremap::Item
10
12
  config_only
11
13
  ).freeze
12
14
 
13
- def initialize(name, options)
14
- @childs = []
15
+ def initialize(name, options = {})
16
+ @skip_identifier = options.delete(:skip_identifier)
15
17
 
16
18
  if name
17
- @childs << Dotremap::Property.new("name", name)
19
+ property = Dotremap::Property.new("name", name)
20
+ add_child(property)
18
21
  end
19
22
 
20
23
  options.each do |option, value|
21
24
  raise "Unavailable option: #{option}" unless AVAILABLE_OPTIONS.include?(option)
22
- @childs << Dotremap::Property.new(option, value)
25
+
26
+ property = Dotremap::Property.new(option, value)
27
+ add_child(property)
23
28
  end
24
29
  end
25
- attr_accessor :childs
26
30
 
27
31
  def to_xml
28
32
  validate_name_existence
29
- generate_identifier
33
+ generate_identifier unless @skip_identifier
30
34
 
31
- [
32
- "<item>",
33
- childs.map(&:to_xml).join("\n").gsub(/^/, " "),
34
- "</item>",
35
- ].join("\n")
35
+ super
36
36
  end
37
37
 
38
38
  private
39
39
 
40
40
  def validate_name_existence
41
- properties = childs.select { |c| c.is_a?(Dotremap::Property) }
41
+ properties = search_childs(Dotremap::Property)
42
42
  raise "Name property does not exist" unless properties.map(&:attr).include?("name")
43
43
  end
44
44
 
45
45
  def generate_identifier
46
- properties = childs.select { |c| c.is_a?(Dotremap::Property) }
46
+ properties = search_childs(Dotremap::Property)
47
47
  return if properties.map(&:attr).include?("identifier")
48
48
 
49
49
  name = properties.find { |p| p.attr == "name" }
@@ -1,4 +1,4 @@
1
- require "dotremap/version"
1
+ require "dotremap/namespace"
2
2
 
3
3
  module Dotremap::Karabiner
4
4
  CLI_PATH = "/Applications/Karabiner.app/Contents/Library/bin/karabiner"
@@ -6,4 +6,20 @@ module Dotremap::Karabiner
6
6
  def self.reload_xml
7
7
  system("#{CLI_PATH} reloadxml")
8
8
  end
9
+
10
+ def self.current_config
11
+ changed = `#{CLI_PATH} changed`
12
+ config_by_changed(changed)
13
+ end
14
+
15
+ private
16
+
17
+ def self.config_by_changed(changed)
18
+ config = {}
19
+ changed.each_line do |line|
20
+ property, value = line.strip.split("=")
21
+ config[property] = value
22
+ end
23
+ config
24
+ end
9
25
  end
@@ -0,0 +1,5 @@
1
+ # Files which require this file can avoid deep nesting for class declaration
2
+ class Dotremap
3
+ module DSL
4
+ end
5
+ end
@@ -4,10 +4,10 @@ class Dotremap::Property
4
4
  @value = value
5
5
  @options = options
6
6
  end
7
- attr_accessor :attr, :value, :options
7
+ attr_accessor :attr, :value
8
8
 
9
9
  def to_xml
10
- open_tag = options.map { |a, v| "#{a}=\"#{v}\"" }.unshift(attr).join(" ")
10
+ open_tag = @options.map { |a, v| "#{a}=\"#{v}\"" }.unshift(attr).join(" ")
11
11
  "<#{open_tag}>#{value}</#{attr}>"
12
12
  end
13
13
  end
@@ -1,22 +1,16 @@
1
1
  require "dotremap/key"
2
+ require "dotremap/property"
2
3
 
3
- class Dotremap::Remap
4
+ class Dotremap::Remap < Dotremap::Property
4
5
  def initialize(from, to)
5
- @from = from
6
- @to = to
7
- end
8
-
9
- def to_xml
10
- "<autogen>__KeyToKey__ #{from}, #{to}</autogen>"
11
- end
12
-
13
- private
14
-
15
- def from
16
- Dotremap::Key.new(@from)
17
- end
6
+ tos = [to].flatten
18
7
 
19
- def to
20
- [@to].flatten.map { |to| Dotremap::Key.new(to) }.join(", ")
8
+ super(
9
+ "autogen",
10
+ [
11
+ "__KeyToKey__ #{Dotremap::Key.new(from)}",
12
+ *tos.map { |to| Dotremap::Key.new(to) },
13
+ ].join(", "),
14
+ )
21
15
  end
22
16
  end
data/lib/dotremap/root.rb CHANGED
@@ -1,23 +1,20 @@
1
- require "dotremap/openurl"
1
+ require "dotremap/invoke_history"
2
+ require "dotremap/vkopenurldef"
2
3
  require "dotremap/dsl/root"
3
4
 
4
5
  class Dotremap::Root
6
+ include Dotremap::XmlTree
5
7
  include Dotremap::DSL::Root
6
8
 
7
- def initialize
8
- @childs = []
9
- end
10
- attr_accessor :childs
11
-
12
9
  def to_xml
10
+ Dotremap::InvokeHistory.registered_applications.each do |application|
11
+ vkopenurldef = Dotremap::Vkopenurldef.new(application)
12
+ add_child(vkopenurldef)
13
+ end
14
+
13
15
  [
14
16
  "<?xml version=\"1.0\"?>",
15
- "<root>",
16
- [
17
- childs.map(&:to_xml).join("\n\n"),
18
- Dotremap::Openurl.registered_xml,
19
- ].compact.join("\n").gsub(/^/, " "),
20
- "</root>",
17
+ super(1),
21
18
  ].join("\n")
22
19
  end
23
20
  end
@@ -1,3 +1,3 @@
1
1
  class Dotremap
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -0,0 +1,11 @@
1
+ require "dotremap/xml_tree"
2
+
3
+ class Dotremap::Vkopenurldef
4
+ include Dotremap::XmlTree
5
+
6
+ def initialize(application)
7
+ name = Dotremap::Property.new("name", "KeyCode::VK_OPEN_URL_APP_#{application.gsub(/ /, "_")}")
8
+ url = Dotremap::Property.new("url", "/Applications/#{application}.app", type: "file")
9
+ add_child(name, url)
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ module Dotremap::XmlTree
2
+ def add_child(*objects)
3
+ objects.each do |object|
4
+ childs << object
5
+ end
6
+ end
7
+
8
+ def search_childs(klass)
9
+ childs.select { |c| c.is_a?(klass) }
10
+ end
11
+
12
+ def to_xml(distance_between_childs = 0)
13
+ tag_name = self.class.to_s.split("::").last.downcase
14
+ newline_count = distance_between_childs + 1
15
+
16
+ [
17
+ "<#{tag_name}>",
18
+ childs.map(&:to_xml).join("\n" * newline_count).gsub(/^/, " "),
19
+ "</#{tag_name}>",
20
+ ].join("\n")
21
+ end
22
+
23
+ private
24
+
25
+ def childs
26
+ @childs ||= []
27
+ end
28
+ end
data/lib/dotremap.rb CHANGED
@@ -10,6 +10,7 @@ class Dotremap
10
10
 
11
11
  def initialize(config_path)
12
12
  @config_path = config_path
13
+ Dotremap::InvokeHistory.clear_histroy
13
14
  end
14
15
  attr_reader :config_path
15
16
 
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ describe Dotremap::Karabiner do
4
+ describe ".current_config" do
5
+ subject { described_class.current_config }
6
+
7
+ let(:cli_path) { Dotremap::Karabiner::CLI_PATH }
8
+
9
+ before do
10
+ allow_any_instance_of(Kernel).to receive(:'`').with("#{cli_path} changed").and_return(<<-EOS.unindent)
11
+ remap.command_k_to_command_l=1
12
+ repeat.initial_wait=100
13
+ repeat.wait=20
14
+ option.terminal_command_option=1
15
+ notsave.automatically_enable_keyboard_device=1
16
+ EOS
17
+ end
18
+
19
+ it "returns config hash" do
20
+ expect(subject).to eq({
21
+ "option.terminal_command_option" => "1",
22
+ "remap.command_k_to_command_l" => "1",
23
+ "repeat.initial_wait" => "100",
24
+ "repeat.wait" => "20",
25
+ "notsave.automatically_enable_keyboard_device" => "1",
26
+ })
27
+ end
28
+ end
29
+ end
@@ -3,88 +3,90 @@ require "spec_helper"
3
3
  describe Dotremap::Key do
4
4
  describe "#to_s" do
5
5
  EXPECTED_RESULTS = {
6
- "a" => "KeyCode::A",
7
- "b" => "KeyCode::B",
8
- "c" => "KeyCode::C",
9
- "d" => "KeyCode::D",
10
- "e" => "KeyCode::E",
11
- "f" => "KeyCode::F",
12
- "g" => "KeyCode::G",
13
- "h" => "KeyCode::H",
14
- "i" => "KeyCode::I",
15
- "j" => "KeyCode::J",
16
- "k" => "KeyCode::K",
17
- "l" => "KeyCode::L",
18
- "m" => "KeyCode::M",
19
- "n" => "KeyCode::N",
20
- "o" => "KeyCode::O",
21
- "p" => "KeyCode::P",
22
- "q" => "KeyCode::Q",
23
- "r" => "KeyCode::R",
24
- "s" => "KeyCode::S",
25
- "t" => "KeyCode::T",
26
- "u" => "KeyCode::U",
27
- "v" => "KeyCode::V",
28
- "w" => "KeyCode::W",
29
- "x" => "KeyCode::X",
30
- "y" => "KeyCode::Y",
31
- "z" => "KeyCode::Z",
32
- "A" => "KeyCode::A",
33
- "B" => "KeyCode::B",
34
- "C" => "KeyCode::C",
35
- "D" => "KeyCode::D",
36
- "E" => "KeyCode::E",
37
- "F" => "KeyCode::F",
38
- "G" => "KeyCode::G",
39
- "H" => "KeyCode::H",
40
- "I" => "KeyCode::I",
41
- "J" => "KeyCode::J",
42
- "K" => "KeyCode::K",
43
- "L" => "KeyCode::L",
44
- "M" => "KeyCode::M",
45
- "N" => "KeyCode::N",
46
- "O" => "KeyCode::O",
47
- "P" => "KeyCode::P",
48
- "Q" => "KeyCode::Q",
49
- "R" => "KeyCode::R",
50
- "S" => "KeyCode::S",
51
- "T" => "KeyCode::T",
52
- "U" => "KeyCode::U",
53
- "V" => "KeyCode::V",
54
- "W" => "KeyCode::W",
55
- "X" => "KeyCode::X",
56
- "Y" => "KeyCode::Y",
57
- "Z" => "KeyCode::Z",
58
- "0" => "KeyCode::KEY_0",
59
- "1" => "KeyCode::KEY_1",
60
- "2" => "KeyCode::KEY_2",
61
- "3" => "KeyCode::KEY_3",
62
- "4" => "KeyCode::KEY_4",
63
- "5" => "KeyCode::KEY_5",
64
- "6" => "KeyCode::KEY_6",
65
- "7" => "KeyCode::KEY_7",
66
- "8" => "KeyCode::KEY_8",
67
- "9" => "KeyCode::KEY_9",
68
- "Up" => "KeyCode::CURSOR_UP",
69
- "Down" => "KeyCode::CURSOR_DOWN",
70
- "Right" => "KeyCode::CURSOR_RIGHT",
71
- "Left" => "KeyCode::CURSOR_LEFT",
72
- "]" => "KeyCode::BRACKET_RIGHT",
73
- "[" => "KeyCode::BRACKET_LEFT",
74
- ";" => "KeyCode::SEMICOLON",
75
- "-" => "KeyCode::MINUS",
76
- "," => "KeyCode::COMMA",
77
- "." => "KeyCode::DOT",
78
- "\\" => "KeyCode::BACKSLASH",
79
- "/" => "KeyCode::SLASH",
80
- "=" => "KeyCode::EQUAL",
81
- "'" => "KeyCode::QUOTE",
82
- "Ctrl_R" => "KeyCode::CONTROL_R",
83
- "Ctrl_L" => "KeyCode::CONTROL_L",
84
- "Opt_R" => "KeyCode::OPTION_R",
85
- "Opt_L" => "KeyCode::OPTION_L",
86
- "Cmd_R" => "KeyCode::COMMAND_R",
87
- "Cmd_L" => "KeyCode::COMMAND_L",
6
+ "a" => "KeyCode::A",
7
+ "b" => "KeyCode::B",
8
+ "c" => "KeyCode::C",
9
+ "d" => "KeyCode::D",
10
+ "e" => "KeyCode::E",
11
+ "f" => "KeyCode::F",
12
+ "g" => "KeyCode::G",
13
+ "h" => "KeyCode::H",
14
+ "i" => "KeyCode::I",
15
+ "j" => "KeyCode::J",
16
+ "k" => "KeyCode::K",
17
+ "l" => "KeyCode::L",
18
+ "m" => "KeyCode::M",
19
+ "n" => "KeyCode::N",
20
+ "o" => "KeyCode::O",
21
+ "p" => "KeyCode::P",
22
+ "q" => "KeyCode::Q",
23
+ "r" => "KeyCode::R",
24
+ "s" => "KeyCode::S",
25
+ "t" => "KeyCode::T",
26
+ "u" => "KeyCode::U",
27
+ "v" => "KeyCode::V",
28
+ "w" => "KeyCode::W",
29
+ "x" => "KeyCode::X",
30
+ "y" => "KeyCode::Y",
31
+ "z" => "KeyCode::Z",
32
+ "A" => "KeyCode::A",
33
+ "B" => "KeyCode::B",
34
+ "C" => "KeyCode::C",
35
+ "D" => "KeyCode::D",
36
+ "E" => "KeyCode::E",
37
+ "F" => "KeyCode::F",
38
+ "G" => "KeyCode::G",
39
+ "H" => "KeyCode::H",
40
+ "I" => "KeyCode::I",
41
+ "J" => "KeyCode::J",
42
+ "K" => "KeyCode::K",
43
+ "L" => "KeyCode::L",
44
+ "M" => "KeyCode::M",
45
+ "N" => "KeyCode::N",
46
+ "O" => "KeyCode::O",
47
+ "P" => "KeyCode::P",
48
+ "Q" => "KeyCode::Q",
49
+ "R" => "KeyCode::R",
50
+ "S" => "KeyCode::S",
51
+ "T" => "KeyCode::T",
52
+ "U" => "KeyCode::U",
53
+ "V" => "KeyCode::V",
54
+ "W" => "KeyCode::W",
55
+ "X" => "KeyCode::X",
56
+ "Y" => "KeyCode::Y",
57
+ "Z" => "KeyCode::Z",
58
+ "0" => "KeyCode::KEY_0",
59
+ "1" => "KeyCode::KEY_1",
60
+ "2" => "KeyCode::KEY_2",
61
+ "3" => "KeyCode::KEY_3",
62
+ "4" => "KeyCode::KEY_4",
63
+ "5" => "KeyCode::KEY_5",
64
+ "6" => "KeyCode::KEY_6",
65
+ "7" => "KeyCode::KEY_7",
66
+ "8" => "KeyCode::KEY_8",
67
+ "9" => "KeyCode::KEY_9",
68
+ "Up" => "KeyCode::CURSOR_UP",
69
+ "Down" => "KeyCode::CURSOR_DOWN",
70
+ "Right" => "KeyCode::CURSOR_RIGHT",
71
+ "Left" => "KeyCode::CURSOR_LEFT",
72
+ "]" => "KeyCode::BRACKET_RIGHT",
73
+ "[" => "KeyCode::BRACKET_LEFT",
74
+ ";" => "KeyCode::SEMICOLON",
75
+ "-" => "KeyCode::MINUS",
76
+ "," => "KeyCode::COMMA",
77
+ "." => "KeyCode::DOT",
78
+ "\\" => "KeyCode::BACKSLASH",
79
+ "/" => "KeyCode::SLASH",
80
+ "=" => "KeyCode::EQUAL",
81
+ "'" => "KeyCode::QUOTE",
82
+ "Ctrl_R" => "KeyCode::CONTROL_R",
83
+ "Ctrl_L" => "KeyCode::CONTROL_L",
84
+ "Opt_R" => "KeyCode::OPTION_R",
85
+ "Opt_L" => "KeyCode::OPTION_L",
86
+ "Cmd_R" => "KeyCode::COMMAND_R",
87
+ "Cmd_L" => "KeyCode::COMMAND_L",
88
+ "Shift_R" => "KeyCode::SHIFT_R",
89
+ "Shift_L" => "KeyCode::SHIFT_L",
88
90
  }.freeze
89
91
 
90
92
  it "converts single key expression as expected" do
@@ -245,4 +245,35 @@ describe Dotremap do
245
245
  </root>
246
246
  EOS
247
247
  end
248
+
249
+ it "accepts nested items" do
250
+ prepare_dotremap(<<-EOS)
251
+ group "Option" do
252
+ item "First" do
253
+ identifier "option.option_first"
254
+ end
255
+
256
+ item "Second" do
257
+ identifier "option.option_second"
258
+ end
259
+ end
260
+ EOS
261
+
262
+ expect_result(<<-EOS.unindent)
263
+ <?xml version="1.0"?>
264
+ <root>
265
+ <item>
266
+ <name>Option</name>
267
+ <item>
268
+ <name>First</name>
269
+ <identifier>option.option_first</identifier>
270
+ </item>
271
+ <item>
272
+ <name>Second</name>
273
+ <identifier>option.option_second</identifier>
274
+ </item>
275
+ </item>
276
+ </root>
277
+ EOS
278
+ end
248
279
  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.6
4
+ version: 0.0.7
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-07-26 00:00:00.000000000 Z
11
+ date: 2014-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,18 +101,23 @@ files:
101
101
  - img/enabled.png
102
102
  - lib/dotremap.rb
103
103
  - lib/dotremap/appdef.rb
104
- - lib/dotremap/dsl.rb
104
+ - lib/dotremap/dsl/group.rb
105
105
  - lib/dotremap/dsl/item.rb
106
106
  - lib/dotremap/dsl/root.rb
107
+ - lib/dotremap/group.rb
108
+ - lib/dotremap/invoke_history.rb
107
109
  - lib/dotremap/item.rb
108
110
  - lib/dotremap/karabiner.rb
109
111
  - lib/dotremap/key.rb
110
- - lib/dotremap/openurl.rb
112
+ - lib/dotremap/namespace.rb
111
113
  - lib/dotremap/property.rb
112
114
  - lib/dotremap/remap.rb
113
115
  - lib/dotremap/root.rb
114
116
  - lib/dotremap/version.rb
117
+ - lib/dotremap/vkopenurldef.rb
118
+ - lib/dotremap/xml_tree.rb
115
119
  - spec/lib/dotremap/appdef_spec.rb
120
+ - spec/lib/dotremap/karabiner_spec.rb
116
121
  - spec/lib/dotremap/key_spec.rb
117
122
  - spec/lib/dotremap/remap_spec.rb
118
123
  - spec/lib/dotremap_spec.rb
@@ -143,6 +148,7 @@ specification_version: 4
143
148
  summary: Lightweight keyremap configuration DSL
144
149
  test_files:
145
150
  - spec/lib/dotremap/appdef_spec.rb
151
+ - spec/lib/dotremap/karabiner_spec.rb
146
152
  - spec/lib/dotremap/key_spec.rb
147
153
  - spec/lib/dotremap/remap_spec.rb
148
154
  - spec/lib/dotremap_spec.rb
data/lib/dotremap/dsl.rb DELETED
@@ -1,4 +0,0 @@
1
- class Dotremap
2
- module DSL
3
- end
4
- end
@@ -1,23 +0,0 @@
1
- require "set"
2
-
3
- module Dotremap::Openurl
4
- def self.register(application)
5
- @@registered_applications ||= Set.new
6
- @@registered_applications.add(application)
7
- end
8
-
9
- def self.registered_xml
10
- return nil unless defined?(@@registered_applications)
11
-
12
- @@registered_applications.map { |a| vkopenurl(a) }.join("\n\n").prepend("\n")
13
- end
14
-
15
- def self.vkopenurl(application)
16
- <<-EOS.unindent.gsub(/\n\Z/, "")
17
- <vkopenurldef>
18
- <name>KeyCode::VK_OPEN_URL_APP_#{application.gsub(/ /, "_")}</name>
19
- <url type="file">/Applications/#{application}.app</url>
20
- </vkopenurldef>
21
- EOS
22
- end
23
- end