genx4r-fotopedia 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +43 -0
- data/LICENSE +22 -0
- data/README +31 -0
- data/TODO +6 -0
- data/ext/genx4r/MANIFEST +5 -0
- data/ext/genx4r/charProps.c +378 -0
- data/ext/genx4r/extconf.rb +5 -0
- data/ext/genx4r/genx.c +1940 -0
- data/ext/genx4r/genx.h +287 -0
- data/ext/genx4r/genx4r.c +570 -0
- data/genx4r-0.0.6.gem +0 -0
- data/genx4r-0.05.gem +0 -0
- data/genx4r.gemspec +33 -0
- data/lib/genx4r/builder.rb +123 -0
- data/setup.rb +1346 -0
- data/test/basics.rb +93 -0
- data/test/builder.rb +49 -0
- data/test/declare.rb +63 -0
- data/test/non-io.rb +41 -0
- metadata +89 -0
data/test/basics.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift('ext/genx4r')
|
5
|
+
|
6
|
+
require 'genx4r'
|
7
|
+
|
8
|
+
# $Id: basics.rb 268 2004-07-10 00:33:11Z rooneg $
|
9
|
+
|
10
|
+
class BasicsTest < Test::Unit::TestCase
|
11
|
+
def init_writer
|
12
|
+
return GenX::Writer.new, StringIO.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_element
|
16
|
+
w, io = init_writer
|
17
|
+
|
18
|
+
w.document(io) do
|
19
|
+
w.element("http://bar", "foo") do
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
assert io.string == "<g1:foo xmlns:g1=\"http://bar\"></g1:foo>"
|
24
|
+
|
25
|
+
w, io = init_writer
|
26
|
+
|
27
|
+
w.document(io) do
|
28
|
+
w.element("foo") do
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
assert io.string == "<foo></foo>"
|
33
|
+
|
34
|
+
w, io = init_writer
|
35
|
+
|
36
|
+
w.begin_document(io)
|
37
|
+
w.begin_element("foo")
|
38
|
+
w.text("bar")
|
39
|
+
w.end_element
|
40
|
+
w.end_document
|
41
|
+
|
42
|
+
assert io.string == "<foo>bar</foo>"
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_nested_elements
|
46
|
+
w, io = init_writer
|
47
|
+
|
48
|
+
w.document(io) do
|
49
|
+
w.element("foo") do
|
50
|
+
w.element("bar") do
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
assert io.string == "<foo><bar></bar></foo>"
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_text
|
59
|
+
w, io = init_writer
|
60
|
+
|
61
|
+
w.document(io) do
|
62
|
+
w.element("foo") do
|
63
|
+
w.text("bar")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
assert io.string == "<foo>bar</foo>"
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_comment
|
71
|
+
w, io = init_writer
|
72
|
+
|
73
|
+
w.document(io) do
|
74
|
+
w.element("foo") do
|
75
|
+
w.comment("blah")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
assert io.string == "<foo><!--blah--></foo>"
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_pi
|
83
|
+
w, io = init_writer
|
84
|
+
|
85
|
+
w.document(io) do
|
86
|
+
w.element("base") do
|
87
|
+
w.pi("foo", "bar")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
assert io.string == "<base><?foo bar?></base>"
|
92
|
+
end
|
93
|
+
end
|
data/test/builder.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift('ext/genx4r')
|
4
|
+
$LOAD_PATH.unshift('lib')
|
5
|
+
|
6
|
+
require 'genx4r/builder'
|
7
|
+
|
8
|
+
# $Id: builder.rb 493 2004-11-25 15:17:36Z rooneg $
|
9
|
+
|
10
|
+
class BuilderTest < Test::Unit::TestCase
|
11
|
+
def test_basics
|
12
|
+
w = GenX::Writer.new()
|
13
|
+
|
14
|
+
s = ''
|
15
|
+
|
16
|
+
w.builder(s) do |b|
|
17
|
+
b.foo
|
18
|
+
end
|
19
|
+
|
20
|
+
assert s == '<foo></foo>'
|
21
|
+
|
22
|
+
s = ''
|
23
|
+
|
24
|
+
w.builder(s) do |b|
|
25
|
+
b.foo('bar')
|
26
|
+
end
|
27
|
+
|
28
|
+
assert s == '<foo>bar</foo>'
|
29
|
+
|
30
|
+
s = ''
|
31
|
+
|
32
|
+
w.builder(s) do |b|
|
33
|
+
b.foo do
|
34
|
+
b.bar('baz')
|
35
|
+
b.baz('zot', 'foo' => 'bar')
|
36
|
+
b.zim
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# the \n is just so this works with the here doc...
|
41
|
+
assert (s + "\n") == <<EOF
|
42
|
+
<foo>
|
43
|
+
<bar>baz</bar>
|
44
|
+
<baz foo="bar">zot</baz>
|
45
|
+
<zim></zim>
|
46
|
+
</foo>
|
47
|
+
EOF
|
48
|
+
end
|
49
|
+
end
|
data/test/declare.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift('ext/genx4r')
|
5
|
+
|
6
|
+
require 'genx4r'
|
7
|
+
|
8
|
+
# $Id: declare.rb 491 2004-11-25 03:26:54Z rooneg $
|
9
|
+
|
10
|
+
class DeclareTest < Test::Unit::TestCase
|
11
|
+
def init_writer
|
12
|
+
return GenX::Writer.new, StringIO.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_element
|
16
|
+
w, io = init_writer
|
17
|
+
|
18
|
+
e = w.declare_element("bar")
|
19
|
+
|
20
|
+
w.document(io) do
|
21
|
+
w.element(e) do
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
assert io.string == "<bar></bar>"
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_attribute
|
29
|
+
w, io = init_writer
|
30
|
+
|
31
|
+
a = w.declare_attribute("blah")
|
32
|
+
|
33
|
+
w.document(io) do
|
34
|
+
w.element("foo") do
|
35
|
+
w.attribute(a, "baz")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
assert io.string == "<foo blah=\"baz\"></foo>"
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_namespace
|
43
|
+
w, io = init_writer
|
44
|
+
|
45
|
+
n = w.declare_namespace("http://foo.com/bar", "bar")
|
46
|
+
|
47
|
+
e = w.declare_element(n, "blah")
|
48
|
+
a = w.declare_attribute(n, "zot")
|
49
|
+
|
50
|
+
w.document(io) do
|
51
|
+
w.element(e) do
|
52
|
+
w.attribute(a, "zang")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
assert io.string == "<bar:blah xmlns:bar=\"http://foo.com/bar\"" +
|
57
|
+
" bar:zot=\"zang\"></bar:blah>"
|
58
|
+
|
59
|
+
assert_raise(ArgumentError) do
|
60
|
+
w.declare_namespace
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/test/non-io.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift('ext/genx4r')
|
5
|
+
|
6
|
+
require 'genx4r'
|
7
|
+
|
8
|
+
# $Id: basics.rb 202 2004-06-13 21:41:59Z rooneg $
|
9
|
+
|
10
|
+
# some class that doesn't respond to <<
|
11
|
+
class SomethingElse
|
12
|
+
end
|
13
|
+
|
14
|
+
# tests that we can use anything that replies to <<, not just an IO object
|
15
|
+
class NonIoTest < Test::Unit::TestCase
|
16
|
+
def test_non_io
|
17
|
+
w = GenX::Writer.new
|
18
|
+
s = String.new
|
19
|
+
|
20
|
+
w.document(s) do
|
21
|
+
w.element("http://bar", "foo") do
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
assert s == "<g1:foo xmlns:g1=\"http://bar\"></g1:foo>"
|
26
|
+
|
27
|
+
s = SomethingElse.new
|
28
|
+
|
29
|
+
begin
|
30
|
+
w.document(s) do
|
31
|
+
w.element("foo") do
|
32
|
+
end
|
33
|
+
end
|
34
|
+
rescue RuntimeError => re
|
35
|
+
assert re.to_s == "target must respond to '<<'"
|
36
|
+
return
|
37
|
+
end
|
38
|
+
|
39
|
+
fail "should have raised exception..."
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: genx4r-fotopedia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Garrett Rooney
|
14
|
+
- Pierre Baillet
|
15
|
+
autorequire: genx4r
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-07-19 00:00:00 +02:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: " GenX4r is a Ruby wrapper around the GenX library, which allows you to\n programatically generate correct, cannonical XML output.\n"
|
24
|
+
email: rooneg@electricjellyfish.net
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions:
|
28
|
+
- ext/genx4r/extconf.rb
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- CHANGES
|
33
|
+
- ext/genx4r/charProps.c
|
34
|
+
- ext/genx4r/extconf.rb
|
35
|
+
- ext/genx4r/genx.c
|
36
|
+
- ext/genx4r/genx.h
|
37
|
+
- ext/genx4r/genx4r.c
|
38
|
+
- ext/genx4r/MANIFEST
|
39
|
+
- genx4r-0.0.6.gem
|
40
|
+
- genx4r-0.05.gem
|
41
|
+
- genx4r.gemspec
|
42
|
+
- lib/genx4r/builder.rb
|
43
|
+
- LICENSE
|
44
|
+
- README
|
45
|
+
- setup.rb
|
46
|
+
- test/basics.rb
|
47
|
+
- test/builder.rb
|
48
|
+
- test/declare.rb
|
49
|
+
- test/non-io.rb
|
50
|
+
- TODO
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://genx4r.rubyforge.org
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: genx4r
|
81
|
+
rubygems_version: 1.3.7
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: GenX4r is a Ruby wrapper around the GenX library, which allows you to programatically generate correct, cannonical XML output.
|
85
|
+
test_files:
|
86
|
+
- test/basics.rb
|
87
|
+
- test/builder.rb
|
88
|
+
- test/declare.rb
|
89
|
+
- test/non-io.rb
|