labels 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/Gemfile +10 -0
- data/README.md +100 -0
- data/Rakefile +17 -0
- data/bin/labels +6 -0
- data/dtd/label.dtd +74 -0
- data/example/label.xml +168 -0
- data/labels.gemspec +36 -0
- data/lib/core_ext/string.rb +15 -0
- data/lib/labels/barcode.rb +39 -0
- data/lib/labels/date.rb +19 -0
- data/lib/labels/document.rb +64 -0
- data/lib/labels/element.rb +29 -0
- data/lib/labels/exec.rb +92 -0
- data/lib/labels/image.rb +24 -0
- data/lib/labels/layer.rb +58 -0
- data/lib/labels/paper.rb +29 -0
- data/lib/labels/pdf/builder.rb +332 -0
- data/lib/labels/shape.rb +35 -0
- data/lib/labels/template.rb +68 -0
- data/lib/labels/text.rb +32 -0
- data/lib/labels/version.rb +10 -0
- data/lib/labels/xml/builder.rb +144 -0
- data/lib/labels/xml/parser.rb +163 -0
- data/lib/labels.rb +27 -0
- data/spec/labels/barcode_spec.rb +17 -0
- data/spec/labels/date_spec.rb +17 -0
- data/spec/labels/document_spec.rb +17 -0
- data/spec/labels/element_spec.rb +17 -0
- data/spec/labels/exec_spec.rb +17 -0
- data/spec/labels/image_spec.rb +17 -0
- data/spec/labels/layer_spec.rb +17 -0
- data/spec/labels/paper_spec.rb +17 -0
- data/spec/labels/pdf/builder_spec.rb +17 -0
- data/spec/labels/shape_spec.rb +17 -0
- data/spec/labels/template_spec.rb +17 -0
- data/spec/labels/text_spec.rb +17 -0
- data/spec/labels/xml/builder_spec.rb +17 -0
- data/spec/labels/xml/parser_spec.rb +17 -0
- data/spec/labels_spec.rb +14 -0
- data/spec/spec_helper.rb +23 -0
- metadata +207 -0
@@ -0,0 +1,144 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
|
9
|
+
module Labels
|
10
|
+
module XML
|
11
|
+
|
12
|
+
# This class builds an XML representation of the given Labels::Document
|
13
|
+
class Builder
|
14
|
+
|
15
|
+
# The document instance
|
16
|
+
attr_accessor :document
|
17
|
+
|
18
|
+
# Creates a new Labels::XML::Builder instance
|
19
|
+
def initialize(document=nil)
|
20
|
+
@document = document
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the XML document
|
24
|
+
def xml
|
25
|
+
unless @document.nil?
|
26
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
27
|
+
xml.doc.create_internal_subset(
|
28
|
+
'label',
|
29
|
+
nil,
|
30
|
+
'label.dtd'
|
31
|
+
)
|
32
|
+
xml.label {
|
33
|
+
xml.paper(
|
34
|
+
:title => @document.paper.title) {
|
35
|
+
xml.width @document.paper.width
|
36
|
+
xml.height @document.paper.height
|
37
|
+
}
|
38
|
+
xml.template(
|
39
|
+
:title => @document.template.title,
|
40
|
+
:description => @document.template.description,
|
41
|
+
:manufacturer => @document.template.manufacturer,
|
42
|
+
:category => @document.template.category,
|
43
|
+
:visible => @document.template.visible) {
|
44
|
+
xml.width @document.template.width
|
45
|
+
xml.height @document.template.height
|
46
|
+
xml.columns @document.template.columns
|
47
|
+
xml.rows @document.template.rows
|
48
|
+
xml.send(:'left-margin', @document.template.left_margin)
|
49
|
+
xml.send(:'right-margin', @document.template.right_margin)
|
50
|
+
xml.send(:'top-margin', @document.template.top_margin)
|
51
|
+
xml.send(:'bottom-margin', @document.template.bottom_margin)
|
52
|
+
xml.send(:'horizontal-gutter', @document.template.horizontal_gutter)
|
53
|
+
xml.send(:'vertical-gutter', @document.template.vertical_gutter)
|
54
|
+
xml.elliptical @document.template.elliptical ? 'true' : 'false'
|
55
|
+
xml.send(:'corner-radius', @document.template.corner_radius)
|
56
|
+
}
|
57
|
+
xml.layers {
|
58
|
+
@document.layers.each do |layer|
|
59
|
+
xml.layer(
|
60
|
+
:title => layer.title,
|
61
|
+
:type => layer.type,
|
62
|
+
:locked => layer.locked,
|
63
|
+
:visible => layer.visible,
|
64
|
+
:resizable => layer.resizable) {
|
65
|
+
xml.x layer.x
|
66
|
+
xml.y layer.y
|
67
|
+
xml.z layer.z
|
68
|
+
xml.width layer.width
|
69
|
+
xml.height layer.height
|
70
|
+
xml.alpha layer.alpha
|
71
|
+
xml.rotation layer.rotation
|
72
|
+
xml.content layer.content
|
73
|
+
|
74
|
+
case layer.type
|
75
|
+
when 'shape'
|
76
|
+
xml.elliptical layer.elliptical ? 'true' : 'false'
|
77
|
+
xml.send(:'corner-radius', layer.corner_radius)
|
78
|
+
xml.fill layer.fill ? 'true' : 'false'
|
79
|
+
xml.stroke layer.stroke ? 'true' : 'false'
|
80
|
+
xml.send(:'fill-color', layer.fill_color)
|
81
|
+
xml.send(:'stroke-color', layer.stroke_color)
|
82
|
+
xml.send(:'stroke-weight', layer.stroke_color)
|
83
|
+
when 'text'
|
84
|
+
xml.send(:'font-family', layer.font_family)
|
85
|
+
xml.send(:'font-size', layer.font_size)
|
86
|
+
xml.send(:'font-color', layer.font_color)
|
87
|
+
xml.bold layer.bold ? 'true' : 'false'
|
88
|
+
xml.italic layer.italic ? 'true' : 'false'
|
89
|
+
xml.underline layer.underline ? 'true' : 'false'
|
90
|
+
xml.justification layer.justification
|
91
|
+
when 'image'
|
92
|
+
xml.fit layer.fit ? 'true' : 'false'
|
93
|
+
xml.stretch layer.stretch ? 'true' : 'false'
|
94
|
+
when 'barcode'
|
95
|
+
xml.symbology layer.symbology
|
96
|
+
xml.send(:'bar-width', layer.bar_width)
|
97
|
+
xml.send(:'bar-height', layer.bar_height)
|
98
|
+
xml.send(:'color', layer.color)
|
99
|
+
xml.send(:'caption-height', layer.caption_height)
|
100
|
+
xml.send(:'caption-size', layer.caption_size)
|
101
|
+
xml.captioned layer.captioned ? 'true' : 'false'
|
102
|
+
when 'date'
|
103
|
+
xml.send(:'font-family', layer.font_family)
|
104
|
+
xml.send(:'font-size', layer.font_size)
|
105
|
+
xml.send(:'font-color', layer.font_color)
|
106
|
+
xml.bold layer.bold ? 'true' : 'false'
|
107
|
+
xml.italic layer.italic ? 'true' : 'false'
|
108
|
+
xml.underline layer.underline ? 'true' : 'false'
|
109
|
+
xml.justification layer.justification
|
110
|
+
xml.format layer.format
|
111
|
+
end
|
112
|
+
}
|
113
|
+
end
|
114
|
+
}
|
115
|
+
xml.data {
|
116
|
+
@document.data.each do |item|
|
117
|
+
xml.item {
|
118
|
+
item.each do |key, value|
|
119
|
+
case value
|
120
|
+
when Fixnum
|
121
|
+
xml.key value, :name => key, :type => 'integer'
|
122
|
+
when Float
|
123
|
+
xml.key value, :name => key, :type => 'float'
|
124
|
+
when Time
|
125
|
+
xml.key value.iso8601, :name => key, :type => 'date'
|
126
|
+
when TrueClass
|
127
|
+
xml.key 'true', :name => key, :type => 'boolean'
|
128
|
+
when FalseClass
|
129
|
+
xml.key 'false', :name => key, :type => 'boolean'
|
130
|
+
else
|
131
|
+
xml.key value, :name => key, :type => 'string'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
}
|
135
|
+
end
|
136
|
+
}
|
137
|
+
}
|
138
|
+
end
|
139
|
+
builder.to_xml
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'time'
|
8
|
+
require 'nokogiri'
|
9
|
+
|
10
|
+
require 'core_ext/string'
|
11
|
+
|
12
|
+
require 'labels/document'
|
13
|
+
require 'labels/paper'
|
14
|
+
require 'labels/template'
|
15
|
+
require 'labels/shape'
|
16
|
+
require 'labels/text'
|
17
|
+
require 'labels/image'
|
18
|
+
require 'labels/barcode'
|
19
|
+
require 'labels/date'
|
20
|
+
|
21
|
+
module Labels
|
22
|
+
module XML
|
23
|
+
|
24
|
+
# This class parses a Labels XML document and creates a returns an
|
25
|
+
# instantiated Labels::Document instance from the XML
|
26
|
+
class Parser
|
27
|
+
class << self
|
28
|
+
|
29
|
+
# Parses the provided XML into a Labels::Document instance
|
30
|
+
def parse(xml)
|
31
|
+
doc = Nokogiri::XML(xml)
|
32
|
+
|
33
|
+
if doc.nil? || doc.root.nil?
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
37
|
+
root_node = doc.root
|
38
|
+
paper_node = root_node.at_xpath('paper')
|
39
|
+
template_node = root_node.at_xpath('template')
|
40
|
+
layer_nodes = root_node.xpath('layers/layer')
|
41
|
+
item_nodes = root_node.xpath('data/item')
|
42
|
+
|
43
|
+
unless paper_node.nil?
|
44
|
+
paper = Labels::Paper.new({
|
45
|
+
:title => paper_node['title'],
|
46
|
+
:width => (paper_node.at_xpath('width').text.to_f unless paper_node.at_xpath('width').nil?),
|
47
|
+
:height => (paper_node.at_xpath('height').text.to_f unless paper_node.at_xpath('height').nil?)
|
48
|
+
})
|
49
|
+
end
|
50
|
+
|
51
|
+
unless template_node.nil?
|
52
|
+
template = Labels::Template.new({
|
53
|
+
:title => template_node['title'],
|
54
|
+
:description => template_node['description'],
|
55
|
+
:manufacturer => template_node['manufacturer'],
|
56
|
+
:category => template_node['category'],
|
57
|
+
:visible => template_node['visible'].to_bool,
|
58
|
+
:width => (template_node.at_xpath('width').text.to_f unless template_node.at_xpath('width').nil?),
|
59
|
+
:height => (template_node.at_xpath('height').text.to_f unless template_node.at_xpath('height').nil?),
|
60
|
+
:columns => (template_node.at_xpath('columns').text.to_i unless template_node.at_xpath('columns').nil?),
|
61
|
+
:rows => (template_node.at_xpath('rows').text.to_i unless template_node.at_xpath('rows').nil?),
|
62
|
+
:left_margin => (template_node.at_xpath('left-margin').text.to_f unless template_node.at_xpath('left-margin').nil?),
|
63
|
+
:right_margin => (template_node.at_xpath('right-margin').text.to_f unless template_node.at_xpath('right-margin').nil?),
|
64
|
+
:top_margin => (template_node.at_xpath('top-margin').text.to_f unless template_node.at_xpath('top-margin').nil?),
|
65
|
+
:bottom_margin => (template_node.at_xpath('bottom-margin').text.to_f unless template_node.at_xpath('bottom-margin').nil?),
|
66
|
+
:horizontal_gutter => (template_node.at_xpath('horizontal-gutter').text.to_f unless template_node.at_xpath('horizontal-gutter').nil?),
|
67
|
+
:vertical_gutter => (template_node.at_xpath('vertical-gutter').text.to_f unless template_node.at_xpath('vertical-gutter').nil?),
|
68
|
+
:elliptical => (template_node.at_xpath('elliptical').text.to_bool unless template_node.at_xpath('elliptical').nil?),
|
69
|
+
:corner_radius => (template_node.at_xpath('corner-radius').text.to_f unless template_node.at_xpath('corner-radius').nil?)
|
70
|
+
})
|
71
|
+
end
|
72
|
+
|
73
|
+
unless layer_nodes.nil?
|
74
|
+
layers = []
|
75
|
+
layer_nodes.each do |layer_node|
|
76
|
+
layer_type = layer_node['type']
|
77
|
+
|
78
|
+
case layer_type
|
79
|
+
when 'shape'
|
80
|
+
layer = Labels::Shape.new({
|
81
|
+
:corner_radius => (layer_node.at_xpath('corner-radius').text.to_f unless layer_node.at_xpath('corner-radius').nil?),
|
82
|
+
:elliptical => (layer_node.at_xpath('elliptical').text.to_bool unless layer_node.at_xpath('elliptical').nil?),
|
83
|
+
:fill => (layer_node.at_xpath('fill').text.to_bool unless layer_node.at_xpath('fill').nil?),
|
84
|
+
:stroke => (layer_node.at_xpath('stroke').text.to_bool unless layer_node.at_xpath('stroke').nil?),
|
85
|
+
:fill_color => (layer_node.at_xpath('fill-color').text unless layer_node.at_xpath('fill-color').nil?),
|
86
|
+
:stroke_color => (layer_node.at_xpath('stroke-color').text unless layer_node.at_xpath('stroke-color').nil?),
|
87
|
+
:stroke_weight => (layer_node.at_xpath('stroke-weight').text.to_f unless layer_node.at_xpath('stroke-weight').nil?)
|
88
|
+
})
|
89
|
+
when 'text'
|
90
|
+
layer = Labels::Text.new({
|
91
|
+
:font_family => (layer_node.at_xpath('font-family').text unless layer_node.at_xpath('font-family').nil?),
|
92
|
+
:font_size => (layer_node.at_xpath('font-size').text.to_f unless layer_node.at_xpath('font-size').nil?),
|
93
|
+
:font_color => (layer_node.at_xpath('font-color').text unless layer_node.at_xpath('font-color').nil?),
|
94
|
+
:bold => (layer_node.at_xpath('bold').text.to_bool unless layer_node.at_xpath('bold').nil?),
|
95
|
+
:italic => (layer_node.at_xpath('italic').text.to_bool unless layer_node.at_xpath('italic').nil?),
|
96
|
+
:underline => (layer_node.at_xpath('underline').text.to_bool unless layer_node.at_xpath('underline').nil?),
|
97
|
+
:justification => (layer_node.at_xpath('justification').text unless layer_node.at_xpath('justification').nil?)
|
98
|
+
})
|
99
|
+
when 'image'
|
100
|
+
layer = Labels::Image.new({
|
101
|
+
:fit => (layer_node.at_xpath('fit').text.to_bool unless layer_node.at_xpath('fit').nil?),
|
102
|
+
:stretch => (layer_node.at_xpath('stretch').text.to_bool unless layer_node.at_xpath('stretch').nil?),
|
103
|
+
})
|
104
|
+
when 'barcode'
|
105
|
+
layer = Labels::Barcode.new({
|
106
|
+
:symbology => (layer_node.at_xpath('symbology').text unless layer_node.at_xpath('symbology').nil?),
|
107
|
+
:bar_width => (layer_node.at_xpath('bar-width').text.to_i unless layer_node.at_xpath('bar-width').nil?),
|
108
|
+
:bar_height => (layer_node.at_xpath('bar-height').text.to_i unless layer_node.at_xpath('bar-height').nil?),
|
109
|
+
:color => (layer_node.at_xpath('color').text unless layer_node.at_xpath('color').nil?),
|
110
|
+
:caption_height => (layer_node.at_xpath('caption-height').text.to_i unless layer_node.at_xpath('caption-height').nil?),
|
111
|
+
:caption_size => (layer_node.at_xpath('caption-size').text.to_i unless layer_node.at_xpath('caption-size').nil?),
|
112
|
+
:captioned => (layer_node.at_xpath('captioned').text.to_bool unless layer_node.at_xpath('captioned').nil?),
|
113
|
+
})
|
114
|
+
when 'date'
|
115
|
+
layer = Labels::Date.new({
|
116
|
+
:font_family => (layer_node.at_xpath('font-family').text unless layer_node.at_xpath('font-family').nil?),
|
117
|
+
:font_size => (layer_node.at_xpath('font-size').text.to_f unless layer_node.at_xpath('font-size').nil?),
|
118
|
+
:font_color => (layer_node.at_xpath('font-color').text unless layer_node.at_xpath('font-color').nil?),
|
119
|
+
:bold => (layer_node.at_xpath('bold').text.to_bool unless layer_node.at_xpath('bold').nil?),
|
120
|
+
:italic => (layer_node.at_xpath('italic').text.to_bool unless layer_node.at_xpath('italic').nil?),
|
121
|
+
:underline => (layer_node.at_xpath('underline').text.to_bool unless layer_node.at_xpath('underline').nil?),
|
122
|
+
:justification => (layer_node.at_xpath('justification').text unless layer_node.at_xpath('justification').nil?),
|
123
|
+
:format => (layer_node.at_xpath('format').text unless layer_node.at_xpath('format').nil?)
|
124
|
+
})
|
125
|
+
end
|
126
|
+
|
127
|
+
layer.title = layer_node['title']
|
128
|
+
layer.type = layer_node['type']
|
129
|
+
layer.column = layer_node['column']
|
130
|
+
layer.locked = layer_node['locked'].to_bool
|
131
|
+
layer.visible = layer_node['visible'].to_bool
|
132
|
+
layer.resizable = layer_node['resizable'].to_bool
|
133
|
+
layer.x = layer_node.at_xpath('x').text.to_f unless layer_node.at_xpath('x').nil?
|
134
|
+
layer.y = layer_node.at_xpath('y').text.to_f unless layer_node.at_xpath('y').nil?
|
135
|
+
layer.z = layer_node.at_xpath('z').text.to_f unless layer_node.at_xpath('z').nil?
|
136
|
+
layer.width = layer_node.at_xpath('width').text.to_f unless layer_node.at_xpath('width').nil?
|
137
|
+
layer.height = layer_node.at_xpath('height').text.to_f unless layer_node.at_xpath('height').nil?
|
138
|
+
layer.alpha = layer_node.at_xpath('alpha').text.to_f unless layer_node.at_xpath('alpha').nil?
|
139
|
+
layer.rotation = layer_node.at_xpath('rotation').text.to_f unless layer_node.at_xpath('rotation').nil?
|
140
|
+
layer.content = layer_node.at_xpath('content').text unless layer_node.at_xpath('content').nil?
|
141
|
+
|
142
|
+
layers.push(layer)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
unless item_nodes.nil?
|
147
|
+
data = []
|
148
|
+
item_nodes.each do |item_node|
|
149
|
+
item = {}
|
150
|
+
keys_node = item_node.xpath('key')
|
151
|
+
keys_node.each do |key_node|
|
152
|
+
item[key_node['name']] = key_node.text
|
153
|
+
end
|
154
|
+
data.push(item)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
Labels::Document.new(paper, template, layers, data)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
data/lib/labels.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'labels/version'
|
8
|
+
require 'labels/xml/parser'
|
9
|
+
|
10
|
+
module Labels
|
11
|
+
|
12
|
+
# This is a helper class for Labels library.
|
13
|
+
class << self
|
14
|
+
|
15
|
+
# Opens a new XML file at given path and parses and returns a Labels::Document instance
|
16
|
+
def open(path)
|
17
|
+
unless path.nil?
|
18
|
+
Labels::XML::Parser.parse(IO.read(path)) if File.exist? path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Parses the given XML string and returns a Labels::Document instance
|
23
|
+
def parse(xml)
|
24
|
+
Labels::XML::Parser.parse(xml)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/barcode'
|
9
|
+
|
10
|
+
describe Labels::Barcode do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/date'
|
9
|
+
|
10
|
+
describe Labels::Date do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/document'
|
9
|
+
|
10
|
+
describe Labels::Document do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/element'
|
9
|
+
|
10
|
+
describe Labels::Element do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/exec'
|
9
|
+
|
10
|
+
describe Labels::Exec do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/image'
|
9
|
+
|
10
|
+
describe Labels::Image do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/layer'
|
9
|
+
|
10
|
+
describe Labels::Layer do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/paper'
|
9
|
+
|
10
|
+
describe Labels::Paper do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/pdf/builder'
|
9
|
+
|
10
|
+
describe Labels::PDF::Builder do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/shape'
|
9
|
+
|
10
|
+
describe Labels::Shape do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/template'
|
9
|
+
|
10
|
+
describe Labels::Template do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/text'
|
9
|
+
|
10
|
+
describe Labels::Text do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/xml/builder'
|
9
|
+
|
10
|
+
describe Labels::XML::Builder do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels/xml/parser'
|
9
|
+
|
10
|
+
describe Labels::XML::Parser do
|
11
|
+
describe "#new" do
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#run" do
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/spec/labels_spec.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'labels'
|
9
|
+
|
10
|
+
describe Labels do
|
11
|
+
it 'should return correct version' do
|
12
|
+
Labels::VERSION == Labels::VERSION
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# A RubyGem for creating mailing, shipping, address, barcode and other labels and rendering as PDF's.
|
2
|
+
#
|
3
|
+
# Author:: Aaron Wright (mailto:acwrightdesign@gmail.com)
|
4
|
+
# Copyright:: Copyright (c) 2012 Infinite Token LLC
|
5
|
+
# License:: MIT License
|
6
|
+
|
7
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
9
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
10
|
+
# loaded once.
|
11
|
+
#
|
12
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
15
|
+
config.run_all_when_everything_filtered = true
|
16
|
+
config.filter_run :focus
|
17
|
+
|
18
|
+
# Run specs in random order to surface order dependencies. If you find an
|
19
|
+
# order dependency and want to debug it, you can fix the order by providing
|
20
|
+
# the seed, which is printed after each run.
|
21
|
+
# --seed 1234
|
22
|
+
config.order = 'random'
|
23
|
+
end
|