pdf-labels 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +41 -64
- data/README.txt +4 -3
- data/lib/pdf_labels.rb +1 -4
- data/test/test_pdf_label_page.rb +6 -6
- data/vendor/transaction/simple.rb +390 -597
- data/vendor/transaction/simple/group.rb +13 -0
- data/vendor/transaction/simple/threadsafe.rb +18 -2
- data/vendor/transaction/simple/threadsafe/group.rb +13 -0
- data/vendor/{xml-mapping → xml}/LICENSE +0 -0
- data/vendor/{xml-mapping → xml}/README +0 -0
- data/vendor/{xml-mapping/lib/xml → xml}/mapping.rb +0 -0
- data/vendor/{xml-mapping/lib/xml → xml}/mapping/base.rb +0 -0
- data/vendor/{xml-mapping/lib/xml → xml}/mapping/standard_nodes.rb +0 -0
- data/vendor/{xml-mapping/lib/xml → xml}/mapping/version.rb +0 -0
- data/vendor/{xml-mapping/lib/xml → xml}/xxpath.rb +0 -0
- metadata +46 -71
- data/vendor/xml-mapping/ChangeLog +0 -128
- data/vendor/xml-mapping/README_XPATH +0 -175
- data/vendor/xml-mapping/Rakefile +0 -214
- data/vendor/xml-mapping/TODO.txt +0 -32
- data/vendor/xml-mapping/doc/xpath_impl_notes.txt +0 -119
- data/vendor/xml-mapping/examples/company.rb +0 -34
- data/vendor/xml-mapping/examples/company.xml +0 -26
- data/vendor/xml-mapping/examples/company_usage.intin.rb +0 -19
- data/vendor/xml-mapping/examples/company_usage.intout +0 -39
- data/vendor/xml-mapping/examples/order.rb +0 -61
- data/vendor/xml-mapping/examples/order.xml +0 -54
- data/vendor/xml-mapping/examples/order_signature_enhanced.rb +0 -7
- data/vendor/xml-mapping/examples/order_signature_enhanced.xml +0 -9
- data/vendor/xml-mapping/examples/order_signature_enhanced_usage.intin.rb +0 -12
- data/vendor/xml-mapping/examples/order_signature_enhanced_usage.intout +0 -16
- data/vendor/xml-mapping/examples/order_usage.intin.rb +0 -73
- data/vendor/xml-mapping/examples/order_usage.intout +0 -147
- data/vendor/xml-mapping/examples/time_augm.intin.rb +0 -19
- data/vendor/xml-mapping/examples/time_augm.intout +0 -23
- data/vendor/xml-mapping/examples/time_node.rb +0 -27
- data/vendor/xml-mapping/examples/xpath_create_new.intin.rb +0 -85
- data/vendor/xml-mapping/examples/xpath_create_new.intout +0 -181
- data/vendor/xml-mapping/examples/xpath_docvsroot.intin.rb +0 -30
- data/vendor/xml-mapping/examples/xpath_docvsroot.intout +0 -34
- data/vendor/xml-mapping/examples/xpath_ensure_created.intin.rb +0 -62
- data/vendor/xml-mapping/examples/xpath_ensure_created.intout +0 -114
- data/vendor/xml-mapping/examples/xpath_pathological.intin.rb +0 -42
- data/vendor/xml-mapping/examples/xpath_pathological.intout +0 -56
- data/vendor/xml-mapping/examples/xpath_usage.intin.rb +0 -51
- data/vendor/xml-mapping/examples/xpath_usage.intout +0 -57
- data/vendor/xml-mapping/install.rb +0 -40
- data/vendor/xml-mapping/test/all_tests.rb +0 -6
- data/vendor/xml-mapping/test/company.rb +0 -56
- data/vendor/xml-mapping/test/documents_folders.rb +0 -33
- data/vendor/xml-mapping/test/fixtures/bookmarks1.xml +0 -24
- data/vendor/xml-mapping/test/fixtures/company1.xml +0 -85
- data/vendor/xml-mapping/test/fixtures/documents_folders.xml +0 -71
- data/vendor/xml-mapping/test/fixtures/documents_folders2.xml +0 -30
- data/vendor/xml-mapping/test/multiple_mappings.rb +0 -80
- data/vendor/xml-mapping/test/tests_init.rb +0 -2
- data/vendor/xml-mapping/test/xml_mapping_adv_test.rb +0 -84
- data/vendor/xml-mapping/test/xml_mapping_test.rb +0 -201
- data/vendor/xml-mapping/test/xpath_test.rb +0 -273
@@ -1,114 +0,0 @@
|
|
1
|
-
require 'xml/xxpath'
|
2
|
-
|
3
|
-
d=REXML::Document.new <<EOS
|
4
|
-
<foo>
|
5
|
-
<bar>
|
6
|
-
<baz key="work">Java</baz>
|
7
|
-
<baz key="play">Ruby</baz>
|
8
|
-
</bar>
|
9
|
-
</foo>
|
10
|
-
EOS
|
11
|
-
|
12
|
-
|
13
|
-
rootelt=d.root
|
14
|
-
|
15
|
-
#### ensuring that a specific path exists inside the document
|
16
|
-
|
17
|
-
XML::XXPath.new("/bar/baz[@key='work']").first(rootelt,:ensure_created=>true)
|
18
|
-
=> <baz key='work'> ... </>
|
19
|
-
d.write($stdout,2)
|
20
|
-
<foo>
|
21
|
-
<bar>
|
22
|
-
<baz key='work'>Java</baz>
|
23
|
-
<baz key='play'>Ruby</baz>
|
24
|
-
</bar>
|
25
|
-
</foo>
|
26
|
-
|
27
|
-
### no change (path existed before)
|
28
|
-
|
29
|
-
|
30
|
-
XML::XXPath.new("/bar/baz[@key='42']").first(rootelt,:ensure_created=>true)
|
31
|
-
=> <baz key='42'/>
|
32
|
-
d.write($stdout,2)
|
33
|
-
<foo>
|
34
|
-
<bar>
|
35
|
-
<baz key='work'>Java</baz>
|
36
|
-
<baz key='play'>Ruby</baz>
|
37
|
-
<baz key='42'/>
|
38
|
-
</bar>
|
39
|
-
</foo>
|
40
|
-
|
41
|
-
### path was added
|
42
|
-
|
43
|
-
XML::XXPath.new("/bar/baz[@key='42']").first(rootelt,:ensure_created=>true)
|
44
|
-
=> <baz key='42'/>
|
45
|
-
d.write($stdout,2)
|
46
|
-
<foo>
|
47
|
-
<bar>
|
48
|
-
<baz key='work'>Java</baz>
|
49
|
-
<baz key='play'>Ruby</baz>
|
50
|
-
<baz key='42'/>
|
51
|
-
</bar>
|
52
|
-
</foo>
|
53
|
-
|
54
|
-
### no change this time
|
55
|
-
|
56
|
-
XML::XXPath.new("/bar/baz[@key2='hello']").first(rootelt,:ensure_created=>true)
|
57
|
-
=> <baz key2='hello' key='work'> ... </>
|
58
|
-
d.write($stdout,2)
|
59
|
-
<foo>
|
60
|
-
<bar>
|
61
|
-
<baz key2='hello' key='work'>Java</baz>
|
62
|
-
<baz key='play'>Ruby</baz>
|
63
|
-
<baz key='42'/>
|
64
|
-
</bar>
|
65
|
-
</foo>
|
66
|
-
|
67
|
-
### this fit in the 1st "baz" element since
|
68
|
-
### there was no "key2" attribute there before.
|
69
|
-
|
70
|
-
XML::XXPath.new("/bar/baz[2]").first(rootelt,:ensure_created=>true)
|
71
|
-
=> <baz key='play'> ... </>
|
72
|
-
d.write($stdout,2)
|
73
|
-
<foo>
|
74
|
-
<bar>
|
75
|
-
<baz key2='hello' key='work'>Java</baz>
|
76
|
-
<baz key='play'>Ruby</baz>
|
77
|
-
<baz key='42'/>
|
78
|
-
</bar>
|
79
|
-
</foo>
|
80
|
-
|
81
|
-
### no change
|
82
|
-
|
83
|
-
XML::XXPath.new("/bar/baz[6]/@haha").first(rootelt,:ensure_created=>true)
|
84
|
-
=> #<XML::XXPath::Accessors::Attribute:0x3223b0 @parent=<baz haha='[unset]'/>, @name="haha">
|
85
|
-
d.write($stdout,2)
|
86
|
-
<foo>
|
87
|
-
<bar>
|
88
|
-
<baz key2='hello' key='work'>Java</baz>
|
89
|
-
<baz key='play'>Ruby</baz>
|
90
|
-
<baz key='42'/>
|
91
|
-
<baz/>
|
92
|
-
<baz/>
|
93
|
-
<baz haha='[unset]'/>
|
94
|
-
</bar>
|
95
|
-
</foo>
|
96
|
-
|
97
|
-
### for there to be a 6th "baz" element, there must be 1st..5th "baz" elements
|
98
|
-
|
99
|
-
XML::XXPath.new("/bar/baz[6]/@haha").first(rootelt,:ensure_created=>true)
|
100
|
-
=> #<XML::XXPath::Accessors::Attribute:0x31f830 @parent=<baz haha='[unset]'/>, @name="haha">
|
101
|
-
d.write($stdout,2)
|
102
|
-
<foo>
|
103
|
-
<bar>
|
104
|
-
<baz key2='hello' key='work'>Java</baz>
|
105
|
-
<baz key='play'>Ruby</baz>
|
106
|
-
<baz key='42'/>
|
107
|
-
<baz/>
|
108
|
-
<baz/>
|
109
|
-
<baz haha='[unset]'/>
|
110
|
-
</bar>
|
111
|
-
</foo>
|
112
|
-
|
113
|
-
### no change this time
|
114
|
-
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#:invisible:
|
2
|
-
$:.unshift "../lib" #<=
|
3
|
-
#:visible:
|
4
|
-
require 'xml/xxpath'
|
5
|
-
|
6
|
-
d=REXML::Document.new <<EOS
|
7
|
-
<foo>
|
8
|
-
<bar/>
|
9
|
-
<bar/>
|
10
|
-
</foo>
|
11
|
-
EOS
|
12
|
-
|
13
|
-
|
14
|
-
rootelt=d.root
|
15
|
-
|
16
|
-
|
17
|
-
XML::XXPath.new("*").all(rootelt)#<=
|
18
|
-
### ok
|
19
|
-
|
20
|
-
XML::XXPath.new("bar/*").first(rootelt, :allow_nil=>true)#<=
|
21
|
-
### ok, nothing there
|
22
|
-
|
23
|
-
### the same call with :ensure_created=>true
|
24
|
-
newelt = XML::XXPath.new("bar/*").first(rootelt, :ensure_created=>true)#<=
|
25
|
-
|
26
|
-
#:invisible_retval:
|
27
|
-
d.write($stdout,2)#<=
|
28
|
-
|
29
|
-
#:visible_retval:
|
30
|
-
### a new "unspecified" element was created
|
31
|
-
newelt.unspecified?#<=
|
32
|
-
|
33
|
-
### we must modify it to "specify" it
|
34
|
-
newelt.name="new-one"
|
35
|
-
newelt.text="hello!"
|
36
|
-
newelt.unspecified?#<=
|
37
|
-
|
38
|
-
#:invisible_retval:
|
39
|
-
d.write($stdout,2)#<=
|
40
|
-
|
41
|
-
### you could also set unspecified to false explicitly, as in:
|
42
|
-
newelt.unspecified=true
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'xml/xxpath'
|
2
|
-
|
3
|
-
d=REXML::Document.new <<EOS
|
4
|
-
<foo>
|
5
|
-
<bar/>
|
6
|
-
<bar/>
|
7
|
-
</foo>
|
8
|
-
EOS
|
9
|
-
|
10
|
-
|
11
|
-
rootelt=d.root
|
12
|
-
|
13
|
-
|
14
|
-
XML::XXPath.new("*").all(rootelt)
|
15
|
-
=> [<bar/>, <bar/>]
|
16
|
-
### ok
|
17
|
-
|
18
|
-
XML::XXPath.new("bar/*").first(rootelt, :allow_nil=>true)
|
19
|
-
=> nil
|
20
|
-
### ok, nothing there
|
21
|
-
|
22
|
-
### the same call with :ensure_created=>true
|
23
|
-
newelt = XML::XXPath.new("bar/*").first(rootelt, :ensure_created=>true)
|
24
|
-
=> </>
|
25
|
-
|
26
|
-
d.write($stdout,2)
|
27
|
-
<foo>
|
28
|
-
<bar>
|
29
|
-
</>
|
30
|
-
</bar>
|
31
|
-
<bar/>
|
32
|
-
</foo>
|
33
|
-
|
34
|
-
|
35
|
-
### a new "unspecified" element was created
|
36
|
-
newelt.unspecified?
|
37
|
-
=> true
|
38
|
-
|
39
|
-
### we must modify it to "specify" it
|
40
|
-
newelt.name="new-one"
|
41
|
-
newelt.text="hello!"
|
42
|
-
newelt.unspecified?
|
43
|
-
=> false
|
44
|
-
|
45
|
-
d.write($stdout,2)
|
46
|
-
<foo>
|
47
|
-
<bar>
|
48
|
-
<new-one>hello!</new-one>
|
49
|
-
</bar>
|
50
|
-
<bar/>
|
51
|
-
</foo>
|
52
|
-
|
53
|
-
|
54
|
-
### you could also set unspecified to false explicitly, as in:
|
55
|
-
newelt.unspecified=true
|
56
|
-
|
@@ -1,51 +0,0 @@
|
|
1
|
-
#:invisible:
|
2
|
-
$:.unshift "../lib" #<=
|
3
|
-
#:visible:
|
4
|
-
require 'xml/xxpath'
|
5
|
-
|
6
|
-
d=REXML::Document.new <<EOS
|
7
|
-
<foo>
|
8
|
-
<bar>
|
9
|
-
<baz key="work">Java</baz>
|
10
|
-
<baz key="play">Ruby</baz>
|
11
|
-
</bar>
|
12
|
-
<bar>
|
13
|
-
<baz key="ab">hello</baz>
|
14
|
-
<baz key="play">scrabble</baz>
|
15
|
-
<baz key="xy">goodbye</baz>
|
16
|
-
</bar>
|
17
|
-
<more>
|
18
|
-
<baz key="play">poker</baz>
|
19
|
-
</more>
|
20
|
-
</foo>
|
21
|
-
EOS
|
22
|
-
|
23
|
-
|
24
|
-
####read access
|
25
|
-
path=XML::XXPath.new("/foo/bar[2]/baz")
|
26
|
-
|
27
|
-
## path.all(document) gives all elements matching path in document
|
28
|
-
path.all(d)#<=
|
29
|
-
|
30
|
-
## loop over them
|
31
|
-
path.each(d){|elt| puts elt.text}#<=
|
32
|
-
|
33
|
-
## the first of those
|
34
|
-
path.first(d)#<=
|
35
|
-
|
36
|
-
## no match here (only three "baz" elements)
|
37
|
-
path2=XML::XXPath.new("/foo/bar[2]/baz[4]")
|
38
|
-
path2.all(d)#<=
|
39
|
-
|
40
|
-
#:handle_exceptions:
|
41
|
-
## "first" raises XML::XXPathError in such cases...
|
42
|
-
path2.first(d)#<=
|
43
|
-
#:no_exceptions:
|
44
|
-
|
45
|
-
##...unless we allow nil returns
|
46
|
-
path2.first(d,:allow_nil=>true)#<=
|
47
|
-
|
48
|
-
##attribute nodes can also be returned
|
49
|
-
keysPath=XML::XXPath.new("/foo/*/*/@key")
|
50
|
-
|
51
|
-
keysPath.all(d).map{|attr|attr.text}#<=
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'xml/xxpath'
|
2
|
-
|
3
|
-
d=REXML::Document.new <<EOS
|
4
|
-
<foo>
|
5
|
-
<bar>
|
6
|
-
<baz key="work">Java</baz>
|
7
|
-
<baz key="play">Ruby</baz>
|
8
|
-
</bar>
|
9
|
-
<bar>
|
10
|
-
<baz key="ab">hello</baz>
|
11
|
-
<baz key="play">scrabble</baz>
|
12
|
-
<baz key="xy">goodbye</baz>
|
13
|
-
</bar>
|
14
|
-
<more>
|
15
|
-
<baz key="play">poker</baz>
|
16
|
-
</more>
|
17
|
-
</foo>
|
18
|
-
EOS
|
19
|
-
|
20
|
-
|
21
|
-
####read access
|
22
|
-
path=XML::XXPath.new("/foo/bar[2]/baz")
|
23
|
-
|
24
|
-
## path.all(document) gives all elements matching path in document
|
25
|
-
path.all(d)
|
26
|
-
=> [<baz key='ab'> ... </>, <baz key='play'> ... </>, <baz key='xy'> ... </>]
|
27
|
-
|
28
|
-
## loop over them
|
29
|
-
path.each(d){|elt| puts elt.text}
|
30
|
-
hello
|
31
|
-
scrabble
|
32
|
-
goodbye
|
33
|
-
=> [<baz key='ab'> ... </>, <baz key='play'> ... </>, <baz key='xy'> ... </>]
|
34
|
-
|
35
|
-
## the first of those
|
36
|
-
path.first(d)
|
37
|
-
=> <baz key='ab'> ... </>
|
38
|
-
|
39
|
-
## no match here (only three "baz" elements)
|
40
|
-
path2=XML::XXPath.new("/foo/bar[2]/baz[4]")
|
41
|
-
path2.all(d)
|
42
|
-
=> []
|
43
|
-
|
44
|
-
## "first" raises XML::XXPathError in such cases...
|
45
|
-
path2.first(d)
|
46
|
-
XML::XXPathError: path not found: /foo/bar[2]/baz[4]
|
47
|
-
from ../lib/xml/../xml/xxpath.rb:130:in `first'
|
48
|
-
|
49
|
-
##...unless we allow nil returns
|
50
|
-
path2.first(d,:allow_nil=>true)
|
51
|
-
=> nil
|
52
|
-
|
53
|
-
##attribute nodes can also be returned
|
54
|
-
keysPath=XML::XXPath.new("/foo/*/*/@key")
|
55
|
-
|
56
|
-
keysPath.all(d).map{|attr|attr.text}
|
57
|
-
=> ["work", "play", "ab", "play", "xy", "play"]
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'find'
|
3
|
-
require 'ftools'
|
4
|
-
|
5
|
-
include Config
|
6
|
-
|
7
|
-
# this was adapted from active_record's install.rb
|
8
|
-
|
9
|
-
$sitedir = CONFIG["sitelibdir"]
|
10
|
-
unless $sitedir
|
11
|
-
version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
|
12
|
-
$libdir = File.join(CONFIG["libdir"], "ruby", version)
|
13
|
-
$sitedir = $:.find {|x| x =~ /site_ruby/ }
|
14
|
-
if !$sitedir
|
15
|
-
$sitedir = File.join($libdir, "site_ruby")
|
16
|
-
elsif $sitedir !~ Regexp.quote(version)
|
17
|
-
$sitedir = File.join($sitedir, version)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
# deprecated files that should be removed
|
23
|
-
# deprecated = %w{ }
|
24
|
-
|
25
|
-
# files to install in library path
|
26
|
-
files = %w-
|
27
|
-
xml/mapping.rb
|
28
|
-
xml/xxpath.rb
|
29
|
-
xml/mapping/base.rb
|
30
|
-
xml/mapping/standard_nodes.rb
|
31
|
-
xml/mapping/version.rb
|
32
|
-
-
|
33
|
-
|
34
|
-
# the acual gruntwork
|
35
|
-
Dir.chdir("lib")
|
36
|
-
# File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
|
37
|
-
files.each {|f|
|
38
|
-
File::makedirs(File.join($sitedir, *f.split(/\//)[0..-2]))
|
39
|
-
File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
|
40
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'xml/mapping'
|
2
|
-
|
3
|
-
# forward declarations
|
4
|
-
class Address; end
|
5
|
-
class Office; end
|
6
|
-
class Customer; end
|
7
|
-
|
8
|
-
|
9
|
-
class Company
|
10
|
-
include XML::Mapping
|
11
|
-
|
12
|
-
text_node :name, "@name"
|
13
|
-
|
14
|
-
object_node :address, "address", :class=>Address
|
15
|
-
|
16
|
-
array_node :offices, "offices", "office", :class=>Office
|
17
|
-
hash_node :customers, "customers", "customer", "@uid", :class=>Customer
|
18
|
-
|
19
|
-
text_node :ent1, "arrtest/entry[1]"
|
20
|
-
text_node :ent2, "arrtest/entry[2]"
|
21
|
-
text_node :ent3, "arrtest/entry[3]"
|
22
|
-
|
23
|
-
array_node :stuff, "stuff", "*"
|
24
|
-
|
25
|
-
object_node :test_default_value_identity, "dummy", :default_value => ["default"]
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
class Address
|
30
|
-
include XML::Mapping
|
31
|
-
|
32
|
-
text_node :city, "city"
|
33
|
-
numeric_node :zip, "zip", :default_value=>12576
|
34
|
-
text_node :street, "street", :optional=>true
|
35
|
-
numeric_node :number, "number"
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
class Office
|
40
|
-
include XML::Mapping
|
41
|
-
|
42
|
-
text_node :speciality, "@speciality"
|
43
|
-
boolean_node :classified, "classified", "yes", "no"
|
44
|
-
# object_node :address, "address", :class=>Address
|
45
|
-
object_node :address, "address",
|
46
|
-
:marshaller=>proc {|xml,value| value.fill_into_xml(xml)},
|
47
|
-
:unmarshaller=>proc {|xml| Address.load_from_xml(xml)}
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
class Customer
|
52
|
-
include XML::Mapping
|
53
|
-
|
54
|
-
text_node :uid, "@uid"
|
55
|
-
text_node :name, "name"
|
56
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'xml/mapping'
|
2
|
-
|
3
|
-
class Entry
|
4
|
-
include XML::Mapping
|
5
|
-
|
6
|
-
text_node :name, "name"
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
class Document <Entry
|
11
|
-
include XML::Mapping
|
12
|
-
|
13
|
-
text_node :contents, "contents"
|
14
|
-
|
15
|
-
def ==(other)
|
16
|
-
Document===other and
|
17
|
-
other.name==self.name and
|
18
|
-
other.contents==self.contents
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
class Folder <Entry
|
24
|
-
include XML::Mapping
|
25
|
-
|
26
|
-
array_node :entries, "entries", "*"
|
27
|
-
|
28
|
-
def ==(other)
|
29
|
-
Folder===other and
|
30
|
-
other.name==self.name and
|
31
|
-
other.entries==self.entries
|
32
|
-
end
|
33
|
-
end
|