excemel 1.1.0-java → 1.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -1
- data/README.md +5 -1
- data/Rakefile +2 -6
- data/lib/excemel/excemel.rb +8 -14
- data/lib/java/{xom-1.2.9.jar → xom-1.2.10.jar} +0 -0
- data/lib/module/xom.rb +1 -1
- metadata +19 -25
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Excemel: Better XML for JRuby
|
2
2
|
|
3
|
+
[![Build Status](https://secure.travis-ci.org/integrallis/excemel.png?branch=master)](http://travis-ci.org/integrallis/excemel)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/excemel.png)](http://badge.fury.io/rb/excemel)
|
5
|
+
[![Dependency Status](https://gemnasium.com/integrallis/excemel.png)](https://gemnasium.com/integrallis/excemel)
|
3
6
|
[![Code Climate](https://codeclimate.com/github/integrallis/excemel.png)](https://codeclimate.com/github/integrallis/excemel)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/integrallis/excemel/badge.png?branch=master)](https://coveralls.io/r/integrallis/excemel?branch=master)
|
4
8
|
|
5
9
|
Excemel is a Ruby DSL for Elliotte Rusty Harold's XOM XML library. It is based
|
6
10
|
on Jim Weirich's Builder. Excemel brings to JRuby the expressiveness and
|
@@ -17,7 +21,7 @@ See usage examples under /examples directory of this distribution
|
|
17
21
|
|
18
22
|
## Contact
|
19
23
|
|
20
|
-
* Author:: Brian Sam-Bodden
|
24
|
+
* Author:: Brian Sam-Bodden and the Integrallis Crew
|
21
25
|
* Email:: bsbodden@integrallis.com
|
22
26
|
* Home Page:: http://integrallis.com
|
23
27
|
* License:: MIT Licence (http://www.opensource.org/licenses/mit-license.html)
|
data/Rakefile
CHANGED
@@ -15,6 +15,8 @@
|
|
15
15
|
|
16
16
|
require 'rubygems'
|
17
17
|
require 'bundler'
|
18
|
+
require 'coveralls'
|
19
|
+
|
18
20
|
begin
|
19
21
|
Bundler.setup(:default, :development)
|
20
22
|
rescue Bundler::BundlerError => e
|
@@ -35,12 +37,6 @@ end
|
|
35
37
|
|
36
38
|
# --------------------------------------------------------------------
|
37
39
|
|
38
|
-
require 'simplecov'
|
39
|
-
SimpleCov.command_name 'Unit Tests'
|
40
|
-
SimpleCov.start do
|
41
|
-
add_group "source", "lib"
|
42
|
-
end
|
43
|
-
|
44
40
|
task :default => :test
|
45
41
|
|
46
42
|
# --------------------------------------------------------------------
|
data/lib/excemel/excemel.rb
CHANGED
@@ -56,7 +56,7 @@ module Excemel
|
|
56
56
|
# Document instance, blocks passed get processed recursively
|
57
57
|
def method_missing(sym, *args, &block)
|
58
58
|
unless %w(class to_s inspect).include?(sym.to_s)
|
59
|
-
sym = _extract_sym(args, sym)
|
59
|
+
sym = _extract_sym(args, sym)
|
60
60
|
attrs, namespace, prefix, text = _process_args(args, sym)
|
61
61
|
tag = _build_tag(sym, namespace)
|
62
62
|
_add_attributes(tag, attrs)
|
@@ -139,18 +139,11 @@ module Excemel
|
|
139
139
|
# Appends an XML document type declaration at the current position in the
|
140
140
|
# document
|
141
141
|
def doc_type!(root_element_name, public_id='', system_id='')
|
142
|
-
doctype = XOM::DocType(root_element_name, public_id, system_id)
|
142
|
+
doctype = XOM::DocType.new(root_element_name, public_id, system_id)
|
143
143
|
@doc.insert_child(doctype, 0)
|
144
144
|
self
|
145
145
|
end
|
146
146
|
|
147
|
-
# Returns the value of the first child element with the specified name in
|
148
|
-
# no namespace. If there is no such element, it returns nill.
|
149
|
-
def find_first_tag_by_name(tag_name)
|
150
|
-
element = @root.get_first_child_element tag_name
|
151
|
-
element ? element.get_value : nil
|
152
|
-
end
|
153
|
-
|
154
147
|
# Returns the values of the nodes selected by the XPath expression in the
|
155
148
|
# context of this node in document order as defined by XSLT. This XPath
|
156
149
|
# expression must not contain any namespace prefixes.
|
@@ -221,10 +214,10 @@ module Excemel
|
|
221
214
|
end
|
222
215
|
|
223
216
|
def _build_tag(sym, namespace = nil)
|
224
|
-
|
225
|
-
tag = XOM::Element.new sym.to_s
|
226
|
-
else
|
217
|
+
if namespace && !namespace.empty?
|
227
218
|
tag = XOM::Element.new sym.to_s, namespace
|
219
|
+
else
|
220
|
+
tag = XOM::Element.new sym.to_s
|
228
221
|
end
|
229
222
|
tag
|
230
223
|
end
|
@@ -238,7 +231,7 @@ module Excemel
|
|
238
231
|
end
|
239
232
|
|
240
233
|
def _extract_prefix(sym)
|
241
|
-
sym.to_s.include?
|
234
|
+
sym.to_s.include?(':') ? sym.to_s.split(":").first : nil
|
242
235
|
end
|
243
236
|
|
244
237
|
def _process_args(args, sym)
|
@@ -250,6 +243,7 @@ module Excemel
|
|
250
243
|
if arg.has_key? :namespace
|
251
244
|
namespace = arg[:namespace]
|
252
245
|
prefix = sym.to_s.split(":").first
|
246
|
+
(@namespaces ||= {})[prefix] = namespace if prefix
|
253
247
|
else
|
254
248
|
attrs ||= {}
|
255
249
|
attrs.merge!(arg)
|
@@ -278,7 +272,7 @@ module Excemel
|
|
278
272
|
elsif url
|
279
273
|
doc = builder.build url
|
280
274
|
elsif file
|
281
|
-
java_file =
|
275
|
+
java_file = Java::JavaIo::File.new file
|
282
276
|
doc = builder.build java_file
|
283
277
|
end
|
284
278
|
|
Binary file
|
data/lib/module/xom.rb
CHANGED
metadata
CHANGED
@@ -2,26 +2,26 @@
|
|
2
2
|
name: excemel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Brian Sam-Bodden
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blankslate
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 3.1.2
|
21
21
|
none: false
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.1.2
|
27
27
|
none: false
|
@@ -31,17 +31,15 @@ dependencies:
|
|
31
31
|
name: bundler
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - '>='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
37
|
-
MA==
|
36
|
+
version: '0'
|
38
37
|
none: false
|
39
38
|
requirement: !ruby/object:Gem::Requirement
|
40
39
|
requirements:
|
41
|
-
- -
|
40
|
+
- - '>='
|
42
41
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
MA==
|
42
|
+
version: '0'
|
45
43
|
none: false
|
46
44
|
prerelease: false
|
47
45
|
type: :development
|
@@ -49,17 +47,15 @@ dependencies:
|
|
49
47
|
name: simplecov
|
50
48
|
version_requirements: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
|
-
- -
|
50
|
+
- - '>='
|
53
51
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
MA==
|
52
|
+
version: '0'
|
56
53
|
none: false
|
57
54
|
requirement: !ruby/object:Gem::Requirement
|
58
55
|
requirements:
|
59
|
-
- -
|
56
|
+
- - '>='
|
60
57
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
MA==
|
58
|
+
version: '0'
|
63
59
|
none: false
|
64
60
|
prerelease: false
|
65
61
|
type: :development
|
@@ -67,13 +63,13 @@ dependencies:
|
|
67
63
|
name: rdoc
|
68
64
|
version_requirements: !ruby/object:Gem::Requirement
|
69
65
|
requirements:
|
70
|
-
- -
|
66
|
+
- - '>='
|
71
67
|
- !ruby/object:Gem::Version
|
72
68
|
version: '3.7'
|
73
69
|
none: false
|
74
70
|
requirement: !ruby/object:Gem::Requirement
|
75
71
|
requirements:
|
76
|
-
- -
|
72
|
+
- - '>='
|
77
73
|
- !ruby/object:Gem::Version
|
78
74
|
version: '3.7'
|
79
75
|
none: false
|
@@ -94,7 +90,7 @@ files:
|
|
94
90
|
- Rakefile
|
95
91
|
- lib/excemel.rb
|
96
92
|
- lib/excemel/excemel.rb
|
97
|
-
- lib/java/xom-1.2.
|
93
|
+
- lib/java/xom-1.2.10.jar
|
98
94
|
- lib/module/lang.rb
|
99
95
|
- lib/module/xom.rb
|
100
96
|
- README.md
|
@@ -107,17 +103,15 @@ require_paths:
|
|
107
103
|
- lib
|
108
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
105
|
requirements:
|
110
|
-
- -
|
106
|
+
- - '>='
|
111
107
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
113
|
-
MA==
|
108
|
+
version: '0'
|
114
109
|
none: false
|
115
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
111
|
requirements:
|
117
|
-
- -
|
112
|
+
- - '>='
|
118
113
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
120
|
-
MA==
|
114
|
+
version: '0'
|
121
115
|
none: false
|
122
116
|
requirements: []
|
123
117
|
rubyforge_project:
|