easyzpl 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e158a82fab87a3b0cdd3c20f06d2fffb6d873ab
4
- data.tar.gz: 21dbb62829718334c785bd9b9acc5ba0c08b6fde
3
+ metadata.gz: dbabe402e3cf1d8f39a7fe870988511f6ebddacd
4
+ data.tar.gz: 1bb9367bb7746c7ab9317baf7cc675b91ca3877a
5
5
  SHA512:
6
- metadata.gz: ffccc1e4e0324d14b74b0f1399461288d36b38cf995996123aa54776cd2ed57e90996d89d2362785156c233720da7598fd0af55e33202c1d3deeace0b718b219
7
- data.tar.gz: a640004a428aed0852f1e15443713f8cdbdc3219bd3bda147f60273dca4a26ebd9ea3eb74f485dbaa8869cf6939616ac085949d6c2779b11fd18f348bcab98cb
6
+ metadata.gz: d4c38d67b19d1c4453ea137ca31934b1aeefd8c98a19ea808042cf2152bdfd75aff421547e4cbc2fe9eeaf93166c16d14259412b64cae0fcbc88c16c48d70941
7
+ data.tar.gz: bf8bf8dc14e882279a977b05d7f8581e86fd6cfe5669b089e9d160c586a297cf1e622c1e8569217b4325c2c769ad05b4761c7da1d5e651ba7b5eaaeaa3fe036c
data/easyzpl.gemspec CHANGED
@@ -21,9 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec'
24
- # spec.add_development_dependency 'prawn'
25
- # spec.add_development_dependency 'barby'
26
24
 
27
- spec.add_runtime_dependency 'prawn', '>= 1.0.0', '>= 0'
28
- spec.add_runtime_dependency 'barby', '>= 0.6.1', '>= 0'
25
+ spec.add_runtime_dependency 'prawn', '>= 1.0.0'
26
+ spec.add_runtime_dependency 'barby', '>= 0.6.1'
29
27
  end
data/lib/easyzpl/label.rb CHANGED
@@ -52,19 +52,19 @@ module Easyzpl
52
52
  end
53
53
 
54
54
  # Draws a square border on dot in width
55
- def draw_border(x, y, length, width)
56
- return unless numeric?(length) && numeric?(width)
55
+ def draw_border(x, y, height, width)
56
+ return unless numeric?(height) && numeric?(width)
57
57
  x = 0 unless numeric?(x)
58
58
  y = 0 unless numeric?(y)
59
59
 
60
- label_data.push('^FO' + x.to_s + ',' + y.to_s + '^GB' + length.to_s +
60
+ label_data.push('^FO' + x.to_s + ',' + y.to_s + '^GB' + height.to_s +
61
61
  ',' + width.to_s + ',1^FS')
62
62
 
63
63
  # PDF creation if the label height & width has been set
64
64
  return unless label_height && label_width
65
65
  pdf.stroke_axis
66
66
  pdf.stroke do
67
- pdf.rectangle [x, y], length, width * -1
67
+ pdf.rectangle [x, label_width - y - width], height, width * -1
68
68
  end
69
69
  end
70
70
 
@@ -78,8 +78,7 @@ module Easyzpl
78
78
  '^FD' + text + '^FS')
79
79
 
80
80
  return unless label_height && label_width
81
- pdf.text_box text, at: [x, Integer(label_height) - y -
82
- Integer(options[:height]) - 1]
81
+ pdf.text_box text, at: [x, label_width - y]
83
82
  end
84
83
 
85
84
  # Prints a bar code in barcode39 font
@@ -90,8 +89,7 @@ module Easyzpl
90
89
  bar_code_string + '^FS')
91
90
 
92
91
  return unless label_height && label_width
93
- pdf.bounding_box [x, Integer(label_height) - y -
94
- 50 - 1], width: 100 do
92
+ pdf.bounding_box [x, Integer(label_width) - y - 40], width: 50 do
95
93
  barcode = Barby::Code39.new(bar_code_string)
96
94
  barcode.annotate_pdf(pdf)
97
95
  end
@@ -1,4 +1,4 @@
1
1
  # Section holds the version number of the Gem
2
2
  module Easyzpl
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.3'
4
4
  end
data/spec/easyzpl_spec.rb CHANGED
@@ -1,41 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
- # describe 'Testing easyzpl Gem' do
4
- # context 'When creating an empty label' do
5
- # it 'should output a blank label' do
6
- # label = Easyzpl::Label.new
7
- # expect(label.to_s).to eq('^XA^PQ1^XZ')
8
- # end
9
- # end
3
+ describe 'Testing easyzpl Gem' do
4
+ context 'When creating an empty label' do
5
+ it 'should output a blank label' do
6
+ label = Easyzpl::Label.new
7
+ expect(label.to_s).to eq('^XA^PQ1^XZ')
8
+ end
9
+ end
10
10
 
11
- # context 'When creating a simple lable' do
12
- # it 'should output a label with the text "Zebra" and a barcode representation' do
13
- # label = Easyzpl::Label.new
14
- # label.home_position(30, 30)
15
- # label.draw_border(0, 0, 400, 300)
16
- # label.text_field('ZEBRA', 10, 10)
17
- # label.bar_code_39('ZEBRA', 10, 30)
18
- # expect(label.to_s).to eq('^XA^LH30,30^FO0,0^GB400,300,1^FS^FO10,10^AFN,10,10^FDZEBRA^FS^FO10,30^B3N,Y,20,N,N^FDZEBRA^FS^PQ1^XZ')
19
- # end
20
- # end
11
+ context 'When creating a simple lable' do
12
+ it 'should output a label with the text "Zebra" and a barcode representation' do
13
+ label = Easyzpl::Label.new
14
+ label.home_position(30, 30)
15
+ label.draw_border(0, 0, 400, 300)
16
+ label.text_field('ZEBRA', 10, 10)
17
+ label.bar_code_39('ZEBRA', 10, 30)
18
+ expect(label.to_s).to eq('^XA^LH30,30^FO0,0^GB400,300,1^FS^FO10,10^AFN,10,10^FDZEBRA^FS^FO10,30^B3N,Y,20,N,N^FDZEBRA^FS^PQ1^XZ')
19
+ end
20
+ end
21
21
 
22
- # context 'When creating a stored template' do
23
- # it 'should output a label template with one variable text field and one variable barcode' do
24
- # label = Easyzpl::LabelTemplate.new('Template1')
25
- # label.home_position(30, 30)
26
- # label.draw_border(0, 0, 400, 300)
27
- # label.variable_text_field(10, 10)
28
- # label.variable_bar_code_39(10, 30)
29
- # expect(label.to_s).to eq('^XA^DFTemplate1^FS^LH30,30^FO0,0^GB400,300,1^FS^FO10,10^FN1^FS^FO10,30^B3N,Y,20,N,N^FN2^FS^PQ1^XZ')
30
- # end
31
- # end
22
+ context 'When creating a stored template' do
23
+ it 'should output a label template with one variable text field and one variable barcode' do
24
+ label = Easyzpl::LabelTemplate.new('Template1')
25
+ label.home_position(30, 30)
26
+ label.draw_border(0, 0, 400, 300)
27
+ label.variable_text_field(10, 10)
28
+ label.variable_bar_code_39(10, 30)
29
+ expect(label.to_s).to eq('^XA^DFTemplate1^FS^LH30,30^FO0,0^GB400,300,1^FS^FO10,10^FN1^FS^FO10,30^B3N,Y,20,N,N^FN2^FS^PQ1^XZ')
30
+ end
31
+ end
32
32
 
33
- # context 'When accessing the stored template' do
34
- # it 'should output a label with only two fields of data that are passed into a saved template' do
35
- # label = Easyzpl::StoredLabel.new('Template1')
36
- # label.add_field('ZEBRA')
37
- # label.add_field('ZEBRA')
38
- # expect(label.to_s).to eq('^XA^XFTemplate1^FS^FN1^FDZEBRA^FS^FN2^FDZEBRA^FS^PQ1^XZ')
39
- # end
40
- # end
41
- # end
33
+ context 'When accessing the stored template' do
34
+ it 'should output a label with only two fields of data that are passed into a saved template' do
35
+ label = Easyzpl::StoredLabel.new('Template1')
36
+ label.add_field('ZEBRA')
37
+ label.add_field('ZEBRA')
38
+ expect(label.to_s).to eq('^XA^XFTemplate1^FS^FN1^FDZEBRA^FS^FN2^FDZEBRA^FS^PQ1^XZ')
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyzpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Grigajtis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,9 +59,6 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.0.0
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,9 +66,6 @@ dependencies:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
68
  version: 1.0.0
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: barby
77
71
  requirement: !ruby/object:Gem::Requirement
@@ -79,9 +73,6 @@ dependencies:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
81
75
  version: 0.6.1
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
76
  type: :runtime
86
77
  prerelease: false
87
78
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,9 +80,6 @@ dependencies:
89
80
  - - ">="
90
81
  - !ruby/object:Gem::Version
91
82
  version: 0.6.1
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
83
  description: This Gem is a wrapper for the ZPL and ZPL 2 languages that are used to
96
84
  build labels for Zebra printers.
97
85
  email: