prawn-labels 0.11.5.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +45 -1
- data/prawn-labels.gemspec +10 -8
- metadata +17 -32
- data/examples/custom_label.rb +0 -32
- data/examples/custom_label.yml +0 -11
- data/examples/envelope_labels.rb +0 -8
- data/examples/example_helper.rb +0 -5
- data/examples/hello_labels.rb +0 -11
- data/examples/hello_labels_landscape.rb +0 -10
- data/examples/horiz_and_vert_labels.rb +0 -42
- data/examples/image_labels.rb +0 -13
- data/examples/shrink_to_fit.rb +0 -35
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b76f831dbaec489f870cc19b65cc7713356d4c8
|
4
|
+
data.tar.gz: e7e00158a2e0657b2894aa219579bf34c1c070f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0323daaf27a6ba17821e7cd94ca92c1bccbb8a81c8c0b1ea5ba7729ada593997eff0f2ac5e3b6c6161243d9632281c3e380098d69218868026256d2cb990611c
|
7
|
+
data.tar.gz: e2babc29706b43d73236c6dcb0a24c81fe2e9d75cdb43392f3c9e84e70d5fea61a983f9c66999af9f2f9f1fc5c7455655f1b5fc150f2c1d4b29c20101e41a5b4
|
data/README.md
CHANGED
@@ -100,7 +100,51 @@ end
|
|
100
100
|
|
101
101
|
Other document properties that can be set via this hash can be found in the [Prawn Documentation](http://prawn.majesticseacreature.com/docs/0.11.1/Prawn/Document.html#method-c-new)
|
102
102
|
|
103
|
-
##
|
103
|
+
## Contributing
|
104
|
+
|
105
|
+
**Developers, developers, developers!!**
|
106
|
+
|
107
|
+
Contributors retain copyright to their work but must agree to release their
|
108
|
+
contributions under the same terms as this project. For details, please see the
|
109
|
+
LICENSE file.
|
110
|
+
|
111
|
+
If you would like to help with developing Prawn/Labels, please get in touch!
|
112
|
+
Contact Jordan through [GitHub (@jordanbyron)][gh],
|
113
|
+
[Twitter (@jordan_byron)][twitter] or open up a [ticket][gh-issues].
|
114
|
+
|
115
|
+
### Submitting a Pull Request - We :heart: pull requests!
|
116
|
+
|
117
|
+
1. If an issue doesn't exist for your bug or feature create one on
|
118
|
+
[GitHub Issues][gh-issues].
|
119
|
+
- Don't be afraid to get feedback on your idea before you begin
|
120
|
+
development work. In fact it is encouraged. I promise I don't bite
|
121
|
+
:wink:
|
122
|
+
2. Fork the repo and copy it down to your local machine.
|
123
|
+
3. Run `bundle install` in the root directory to install all of the
|
124
|
+
dependencies.
|
125
|
+
4. Create a topic branch (e.g. `prawn-2-support`).
|
126
|
+
5. Implement your feature or bug fix.
|
127
|
+
6. Add documentation for your feature or bug fix.
|
128
|
+
7. Add tests for your feature or bug fix.
|
129
|
+
8. Run `ruby test/suite.rb`. If your changes are not covered, go back to step 6.
|
130
|
+
9. If your change affects something in this `README`, please update it.
|
131
|
+
10. Commit and push your changes.
|
132
|
+
11. Submit a pull request.
|
133
|
+
|
134
|
+
[gh-issues]: https://github.com/jordanbyron/prawn-labels/issues
|
135
|
+
[gh]: https://github.com/jordanbyron
|
136
|
+
[twitter]: http://twitter.com/jordan_byron
|
137
|
+
|
138
|
+
__Note about our test suite__: It kinda stinks :poop: At the moment the tests
|
139
|
+
just do a quick "Does this code run without raising any errors and at the end
|
140
|
+
does it generate the PDF we expect it to generate" check. Eventually I'd like to
|
141
|
+
add more robust tests, but at this point they are better than no tests! So
|
142
|
+
please keep that in mind when you add your tests or run the whole suite.
|
143
|
+
|
144
|
+
To see what the test PDFs look like you can append `DEBUG=true` to your test run
|
145
|
+
and all generated PDFs will be opened for visual debugging :thumbsup:
|
146
|
+
|
147
|
+
### Contributors
|
104
148
|
|
105
149
|
- [Jordan Byron](http://jordanbyron.com)
|
106
150
|
- [David Speake](mailto:david@verycleverstuff.co.uk)
|
data/prawn-labels.gemspec
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
PRAWN_LABELS_VERSION = "0.11.5.0"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version =
|
4
|
+
spec.name = "prawn-labels"
|
5
|
+
spec.version = File.read(File.expand_path('VERSION', File.dirname(__FILE__))).strip
|
6
6
|
spec.platform = Gem::Platform::RUBY
|
7
|
-
spec.summary
|
7
|
+
spec.summary = "Make labels using Prawn"
|
8
|
+
spec.homepage = "http://github.com/jordanbyron/prawn-labels"
|
9
|
+
spec.description = <<END_DESC
|
10
|
+
Prawn/Labels takes the guess work out of generating labels using Prawn
|
11
|
+
END_DESC
|
12
|
+
|
8
13
|
spec.files = Dir.glob("{examples,lib}/**/**/*") +
|
9
14
|
["Rakefile", "prawn-labels.gemspec"]
|
10
15
|
spec.require_path = "lib"
|
@@ -17,9 +22,6 @@ Gem::Specification.new do |spec|
|
|
17
22
|
spec.authors = ["Jordan Byron"]
|
18
23
|
spec.email = ["jordan.byron@gmail.com"]
|
19
24
|
spec.rubyforge_project = "prawn-labels"
|
20
|
-
|
21
|
-
spec.
|
22
|
-
spec.description = <<END_DESC
|
23
|
-
Prawn/Labels takes the guess work out of generating labels using Prawn
|
24
|
-
END_DESC
|
25
|
+
|
26
|
+
spec.add_dependency('prawn', '~> 1.2.0')
|
25
27
|
end
|
metadata
CHANGED
@@ -1,36 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-labels
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jordan Byron
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: prawn
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
description:
|
31
|
-
|
32
|
-
|
33
|
-
'
|
26
|
+
version: 1.2.0
|
27
|
+
description: |2
|
28
|
+
Prawn/Labels takes the guess work out of generating labels using Prawn
|
34
29
|
email:
|
35
30
|
- jordan.byron@gmail.com
|
36
31
|
executables: []
|
@@ -40,24 +35,16 @@ extra_rdoc_files:
|
|
40
35
|
- LICENSE
|
41
36
|
- COPYING
|
42
37
|
files:
|
43
|
-
-
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
- examples/hello_labels.rb
|
48
|
-
- examples/hello_labels_landscape.rb
|
49
|
-
- examples/horiz_and_vert_labels.rb
|
50
|
-
- examples/image_labels.rb
|
51
|
-
- examples/shrink_to_fit.rb
|
38
|
+
- COPYING
|
39
|
+
- LICENSE
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
52
42
|
- lib/prawn/labels.rb
|
53
43
|
- lib/prawn/types.yaml
|
54
|
-
- Rakefile
|
55
44
|
- prawn-labels.gemspec
|
56
|
-
- README.md
|
57
|
-
- LICENSE
|
58
|
-
- COPYING
|
59
45
|
homepage: http://github.com/jordanbyron/prawn-labels
|
60
46
|
licenses: []
|
47
|
+
metadata: {}
|
61
48
|
post_install_message:
|
62
49
|
rdoc_options:
|
63
50
|
- --title
|
@@ -68,21 +55,19 @@ rdoc_options:
|
|
68
55
|
require_paths:
|
69
56
|
- lib
|
70
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '>='
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: 1.8.7
|
76
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
63
|
requirements:
|
79
|
-
- -
|
64
|
+
- - '>='
|
80
65
|
- !ruby/object:Gem::Version
|
81
66
|
version: 1.3.6
|
82
67
|
requirements: []
|
83
68
|
rubyforge_project: prawn-labels
|
84
|
-
rubygems_version:
|
69
|
+
rubygems_version: 2.2.2
|
85
70
|
signing_key:
|
86
|
-
specification_version:
|
71
|
+
specification_version: 4
|
87
72
|
summary: Make labels using Prawn
|
88
73
|
test_files: []
|
data/examples/custom_label.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
fancy_names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
4
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
5
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
6
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
7
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
|
8
|
-
|
9
|
-
#define a custom label type
|
10
|
-
Prawn::Labels.types = {
|
11
|
-
"Agipa119461" => {
|
12
|
-
"paper_size" => "A4",
|
13
|
-
"top_margin" => 36.57,
|
14
|
-
"bottom_margin" => 0,
|
15
|
-
"left_margin" => 20.551,
|
16
|
-
"right_margin" => 20.551,
|
17
|
-
"columns" => 3,
|
18
|
-
"rows" => 8,
|
19
|
-
"column_gutter" => 7.087,
|
20
|
-
"row_gutter" => 0
|
21
|
-
}}
|
22
|
-
|
23
|
-
Prawn::Labels.generate("custom_labels_1.pdf", fancy_names, :type => "Agipa119461") do |pdf, name|
|
24
|
-
pdf.text name
|
25
|
-
end
|
26
|
-
|
27
|
-
#use a configuration file for custom labels
|
28
|
-
Prawn::Labels.types = File.join(File.dirname(__FILE__), "custom_label.yml")
|
29
|
-
|
30
|
-
Prawn::Labels.generate("custom_labels_2.pdf", fancy_names, :type => "quartersheet") do |pdf, name|
|
31
|
-
pdf.text name
|
32
|
-
end
|
data/examples/custom_label.yml
DELETED
data/examples/envelope_labels.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
fancy_names = ["Jordan With a long address\n that goes over multiple lines blah blah blah",
|
4
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
|
5
|
-
|
6
|
-
Prawn::Labels.generate("envelope_labels.pdf", fancy_names, :type => "Envelope10") do |pdf, name|
|
7
|
-
pdf.text name
|
8
|
-
end
|
data/examples/example_helper.rb
DELETED
data/examples/hello_labels.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
fancy_names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
4
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
5
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
6
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
7
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
|
8
|
-
|
9
|
-
Prawn::Labels.generate("hello_labels.pdf", fancy_names, :type => "Avery5160") do |pdf, name|
|
10
|
-
pdf.text name
|
11
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
fancy_names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
4
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
5
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
6
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
7
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
|
8
|
-
Prawn::Labels.generate("hello_labels_landscape.pdf", fancy_names, { :type => "Avery5160", document: { page_layout: :landscape } }) do |pdf, name|
|
9
|
-
pdf.text name
|
10
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
class Label
|
4
|
-
attr_reader :vertical_text
|
5
|
-
|
6
|
-
def initialize(name, vertical_text = false)
|
7
|
-
@name = name
|
8
|
-
@vertical_text = vertical_text
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Horizontal < Label
|
13
|
-
def initialize(name)
|
14
|
-
super(name, false)
|
15
|
-
end
|
16
|
-
|
17
|
-
def render(pdf)
|
18
|
-
pdf.text "Horizontal"
|
19
|
-
pdf.text @name
|
20
|
-
pdf.stroke_bounds
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class Vertical < Label
|
25
|
-
def initialize(name)
|
26
|
-
super(name, true)
|
27
|
-
end
|
28
|
-
|
29
|
-
def render(pdf)
|
30
|
-
pdf.text "Vertical"
|
31
|
-
pdf.text @name
|
32
|
-
pdf.stroke_bounds
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
names = ["Jordan", "Chris", "Jon", "Mike"]
|
37
|
-
|
38
|
-
labels = names.map {|name| [ Horizontal.new(name), Vertical.new(name) ]}.flatten
|
39
|
-
|
40
|
-
Prawn::Labels.generate("horiz_and_vert_labels.pdf", labels, :type => "Avery5160") do |pdf, label|
|
41
|
-
label.render(pdf)
|
42
|
-
end
|
data/examples/image_labels.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require "open-uri"
|
2
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
3
|
-
|
4
|
-
fancy_names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
5
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
6
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
7
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg",
|
8
|
-
"Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]
|
9
|
-
|
10
|
-
Prawn::Labels.generate("image_labels.pdf", fancy_names, :type => "Avery5160") do |pdf, name|
|
11
|
-
pdf.text name
|
12
|
-
pdf.image open("http://jordanbyron.com/me.png")
|
13
|
-
end
|
data/examples/shrink_to_fit.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "example_helper")
|
2
|
-
|
3
|
-
one = "1"
|
4
|
-
two = "2\n2"
|
5
|
-
three = (["3"]*3).join("\n")
|
6
|
-
four = (["4"]*4).join("\n")
|
7
|
-
five = (["5"]*5).join("\n")
|
8
|
-
six = (["6"]*6).join("\n")
|
9
|
-
seven = (["7"]*7).join("\n")
|
10
|
-
eight = (["8"]*8).join("\n")
|
11
|
-
nine = (["9"]*9).join("\n")
|
12
|
-
ten = (["10"]*10).join("\n")
|
13
|
-
long = %{this
|
14
|
-
is
|
15
|
-
thelonglined
|
16
|
-
entrywhereijusttypealottomakeitoverflowthebuffer
|
17
|
-
andthislinetriggersbutitdontkeep }
|
18
|
-
long2 = %{this
|
19
|
-
is just
|
20
|
-
the other long line
|
21
|
-
entry where i just type to make it over flow the buffer
|
22
|
-
lol }
|
23
|
-
fifty = (["50"]*50).join("\n")
|
24
|
-
|
25
|
-
test_names = [one, two, three, four, five, six, seven, eight, nine, ten,
|
26
|
-
"Mike", "Kelly", "Bob", "Greg", "Jordan", "Chris", "Jon", "Mike",
|
27
|
-
"Kelly", long, long2, "Jordan", "Chris", "Jon", fifty, "Kelly",
|
28
|
-
"Bob", "Greg", "Jordan", "Chris",
|
29
|
-
#these next five should be on the next page.
|
30
|
-
"Jon", "Mike", "Kelly", "Bob", "Greg"]
|
31
|
-
|
32
|
-
Prawn::Labels.generate("shrink_to_fit.pdf", test_names, :type => "Avery5160", :shrink_to_fit => true) do |pdf, name|
|
33
|
-
pdf.text name
|
34
|
-
end
|
35
|
-
|