dotremap 0.0.2 → 0.0.3

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: 6a0be0149bc8f1e2f22a3530011bb12951a162b7
4
- data.tar.gz: 613a9476f47e93566e72550551c5c380de128450
3
+ metadata.gz: b583b2e6288717148abe4fdaf0a0005ee4e44d7b
4
+ data.tar.gz: 56162121e591fce2c2df10404fa8f058204f261e
5
5
  SHA512:
6
- metadata.gz: 732d4e7c57cb83a53c4af0092d6ed1876b79edb35bbdd723ae21c315a7cd57ab7b6d95feea8ed97966cc2bbfae0feb256eeda686bc9af4589ff0301dbebfeb6e
7
- data.tar.gz: 0e8b8b641b31f4d6b41a0625a90da035acfc2732a5cbf8ce4b00424e6abab4d4d327cbdcc87ba12150d1c12ca3f1d962a068740f3dbcec44d843918378056862
6
+ metadata.gz: 6152e932f2ce3581d3bec446abb8697f9607a381e03c3b321e7ed1ef10091ed191ae693e85411c40c927cad8e34be869dbad70dd28d2c0bacf8218b7fbd0b407
7
+ data.tar.gz: de087ee48dac92eb7f479830e196e3b6fe63dc828d7784f1531fcd6489a086dd423b1907b23f6574b0cc1a77487fa2b38d075a64a96c970446fc17f80870289f
@@ -1,6 +1,7 @@
1
1
  require "dotremap/dsl"
2
2
  require "dotremap/property"
3
3
  require "dotremap/remap"
4
+ require "dotremap/openurl"
4
5
 
5
6
  module Dotremap::DSL::Item
6
7
  AVAILABLE_PROPERTIES = %i(
@@ -19,6 +20,11 @@ module Dotremap::DSL::Item
19
20
  childs << property
20
21
  end
21
22
 
23
+ def invoke(application)
24
+ Dotremap::Openurl.register(application)
25
+ "VK_OPEN_URL_APP_#{application.gsub(/ /, '_')}"
26
+ end
27
+
22
28
  private
23
29
 
24
30
  def method_missing(property, value = '', options = {})
@@ -0,0 +1,23 @@
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
data/lib/dotremap/root.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "dotremap/openurl"
1
2
  require "dotremap/dsl/root"
2
3
 
3
4
  class Dotremap::Root
@@ -13,7 +14,8 @@ class Dotremap::Root
13
14
  "<?xml version=\"1.0\"?>",
14
15
  "<root>",
15
16
  childs.map(&:to_xml).join("\n\n").gsub(/^/, " "),
17
+ Dotremap::Openurl.registered_xml.gsub(/^/, " "),
16
18
  "</root>",
17
- ].join("\n")
19
+ ].compact.join("\n")
18
20
  end
19
21
  end
@@ -1,3 +1,3 @@
1
1
  class Dotremap
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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.2
4
+ version: 0.0.3
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-18 00:00:00.000000000 Z
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - lib/dotremap/dsl/item.rb
75
75
  - lib/dotremap/dsl/root.rb
76
76
  - lib/dotremap/item.rb
77
+ - lib/dotremap/openurl.rb
77
78
  - lib/dotremap/property.rb
78
79
  - lib/dotremap/remap.rb
79
80
  - lib/dotremap/root.rb