usps_intelligent_barcode 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +6 -0
  3. data/.ruby-version +1 -0
  4. data/{CHANGELOG.markdown → CHANGELOG.md} +27 -12
  5. data/Gemfile +2 -16
  6. data/Gemfile.lock +74 -85
  7. data/LICENSE.md +7 -0
  8. data/{README.markdown → README.md} +56 -36
  9. data/VERSION +1 -1
  10. data/doc/font_installation.md +55 -0
  11. data/doc/migration.md +47 -0
  12. data/doc/publishing.md +75 -0
  13. data/examples/example.rb +4 -4
  14. data/examples/generate_pdf.rb +70 -0
  15. data/fonts/LICENSE +47 -0
  16. data/fonts/USPSIMBCompact.ttf +0 -0
  17. data/fonts/USPSIMBStandard.ttf +0 -0
  18. data/lib/usps_intelligent_barcode/barcode.rb +33 -30
  19. data/lib/usps_intelligent_barcode/barcode_id.rb +5 -0
  20. data/lib/usps_intelligent_barcode/mailer_id.rb +6 -1
  21. data/lib/usps_intelligent_barcode/project_dirs.rb +19 -0
  22. data/lib/usps_intelligent_barcode/routing_code.rb +20 -10
  23. data/lib/usps_intelligent_barcode/serial_number.rb +6 -1
  24. data/lib/usps_intelligent_barcode/service_type.rb +6 -1
  25. data/lib/usps_intelligent_barcode/usps_fonts.rb +48 -0
  26. data/lib/usps_intelligent_barcode.rb +2 -0
  27. data/rake/bundler.rb +1 -0
  28. data/rake/version.rb +33 -0
  29. data/rake/yard.rb +1 -0
  30. data/usps_intelligent_barcode.gemspec +24 -97
  31. metadata +67 -46
  32. data/USPS-intelligent-barcode.gemspec +0 -95
  33. data/rake/jeweler.rb +0 -23
  34. data/spec/bar_map_spec.rb +0 -30
  35. data/spec/bar_position_spec.rb +0 -40
  36. data/spec/bar_symbol_spec.rb +0 -39
  37. data/spec/barcode_id_spec.rb +0 -106
  38. data/spec/barcode_spec.rb +0 -213
  39. data/spec/character_position_spec.rb +0 -25
  40. data/spec/codeword_map_spec.rb +0 -22
  41. data/spec/crc_spec.rb +0 -21
  42. data/spec/mailer_id_spec.rb +0 -124
  43. data/spec/numeric_conversions_spec.rb +0 -23
  44. data/spec/routing_code_spec.rb +0 -180
  45. data/spec/serial_number_spec.rb +0 -117
  46. data/spec/service_type_spec.rb +0 -93
  47. data/spec/spec_helper.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cdeac04e1071c96dc596d2bec3e84ece73cf2291
4
- data.tar.gz: 451155bce2c3da38ce4477268f27edcf74c252d8
2
+ SHA256:
3
+ metadata.gz: '0488d46d6920cd4e667e2afdaf5df62b5be305f7f528136c54378e9be41642c1'
4
+ data.tar.gz: 60c369c9e7a2d28b179c3dc50515eb60d3dc2a835de213b8679c483ec2c91b0c
5
5
  SHA512:
6
- metadata.gz: 330b9a3c194405b63ac36a84cfadff64a3656fe769d0cda0f5edfeaa0478d72611812baae70b1f0e10404f9f421520f0c09f14ae41f0ce172cf1f1e10d538d8d
7
- data.tar.gz: 7d067d53ea00a44f1334f1791c877b4a57f0e36282419b74addb8499c9d77f7548698a3fab0c4d83782decf0a068995de31775f6fdd6532db75251e82ec8433c
6
+ metadata.gz: 5b3dbdcae467309c93c980928ffb87fe733decbc677c1e135edc8b5ac85289f9c16ebce88af9caa476b3c1c39213ddc2310218903c16608a9841bec8a3d02eb0
7
+ data.tar.gz: f468bbb917890d2ce64125ce192f91b78a8756d9958e3870ae8a47a43c78784a09eb92bd6fdf491d58bab88f665ea9ffc15ffac134d8c74319044815daaa1b89
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *~
2
+ .yardoc
3
+ coverage
4
+ rdoc
5
+ pkg
6
+ .claude/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-4.0.0
@@ -1,20 +1,35 @@
1
+ -*- mode: fundamental -*-
2
+
1
3
  # Development
2
4
 
3
- * Fixed leftovers from old name
5
+ * Supports Ruby 4.0, 3.4, 3.3, 3.2
6
+ * Support for Ruby 3.1 and earlier dropped
7
+ * Add #to_s methods to component classes
8
+ (e.g. `barcode.barcode_id.to_s`)
9
+ * Bundle USPS IMBC fonts. Use Imb::UspsFonts to access them
10
+ * Include example that creates a PDF
11
+
12
+ # 1.0.0 - 2016-11-26
4
13
 
5
- # 0.3.0
14
+ * Switch to semantic versioning. Version 1.0.0 has the same API as
15
+ version 0.3.1.
16
+ * Ruby 2.3 supported
17
+ * Improved comments
18
+
19
+ # 0.3.1 - 2015-06-13
20
+ # 0.3.0 - 2015-06-13
6
21
 
7
22
  * Ruby 2.1 and 2.2 supported
8
23
  * Ruby 1.8.7 no longer supported
9
24
  * Renamed gem from USPS-intelligent-barcode to usps_intelligent_barcode
10
-
11
- # 0.2.5
25
+
26
+ # 0.2.5 - 2013-02-28
12
27
 
13
28
  Enhancements
14
29
 
15
30
  * Support MRI 2.0
16
31
 
17
- # 0.2.4
32
+ # 0.2.4 - 2013-01-05
18
33
 
19
34
  Bug fixes
20
35
 
@@ -24,36 +39,36 @@ Enhancements
24
39
 
25
40
  * Refactoring
26
41
 
27
- # 0.2.3
42
+ # 0.2.3 - 2012-12-31
28
43
 
29
44
  Enhancements
30
45
 
31
46
  * Switch docs from rdoc to yard
32
47
 
33
- # 0.2.2
48
+ # 0.2.2 - 2012-12-30
34
49
 
35
50
  Enhancements
36
51
 
37
52
  * Added code coverage to test suite
38
53
 
39
- # 0.2.1
54
+ # 0.2.1 - 2012-12-28
40
55
 
41
56
  * Removed autoload
42
57
 
43
- # 0.2.0
58
+ # 0.2.0 - 2012-12-27
44
59
 
45
60
  Enhancements
46
61
 
47
62
  * Many comments
48
63
  * Refactoring
49
64
 
50
- # 0.1.2
65
+ # 0.1.2 - 2012-12-27
51
66
 
52
67
  Bug fixes
53
68
 
54
69
  * Corrected Ryan Taylor Long's name in README
55
70
 
56
- # 0.1.1
71
+ # 0.1.1 - 2012-12-27
57
72
 
58
73
  Bug fixes
59
74
 
@@ -64,7 +79,7 @@ API Changes
64
79
 
65
80
  * Renamed imb to USPS-intelligent-barcode to be consistent with gem name
66
81
 
67
- # 0.1.0
82
+ # 0.1.0 - 2012-12-26
68
83
 
69
84
  Enhancements
70
85
 
data/Gemfile CHANGED
@@ -1,17 +1,3 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'andand', '~> 1.3'
4
- gem 'memoizer', '~> 1.0'
5
-
6
- group :test do
7
- gem 'rake', '~> 11.2'
8
- gem 'rspec', '~> 3.3'
9
- gem 'rspec-its', '~> 1.0'
10
- end
11
-
12
- group :development do
13
- gem 'jeweler', '~> 2.0'
14
- gem 'rake', '~> 11.2'
15
- gem 'simplecov'
16
- gem 'yard', '~> 0.8.5'
17
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,97 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ usps_intelligent_barcode (1.1.0)
5
+ andand (~> 1.3)
6
+ memoizer (~> 1.0)
7
+
1
8
  GEM
2
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
3
10
  specs:
4
- addressable (2.5.0)
5
- public_suffix (~> 2.0, >= 2.0.2)
6
11
  andand (1.3.3)
7
- builder (3.2.2)
8
- descendants_tracker (0.0.4)
9
- thread_safe (~> 0.3, >= 0.3.1)
10
- diff-lcs (1.2.5)
11
- docile (1.1.5)
12
- faraday (0.9.2)
13
- multipart-post (>= 1.2, < 3)
14
- git (1.3.0)
15
- github_api (0.11.3)
16
- addressable (~> 2.3)
17
- descendants_tracker (~> 0.0.1)
18
- faraday (~> 0.8, < 0.10)
19
- hashie (>= 1.2)
20
- multi_json (>= 1.7.5, < 2.0)
21
- nokogiri (~> 1.6.0)
22
- oauth2
23
- hashie (3.4.6)
24
- highline (1.7.8)
25
- jeweler (2.1.2)
26
- builder
27
- bundler (>= 1.0)
28
- git (>= 1.2.5)
29
- github_api (~> 0.11.0)
30
- highline (>= 1.6.15)
31
- nokogiri (>= 1.5.10)
32
- rake
33
- rdoc
34
- semver
35
- json (2.0.2)
36
- json (2.0.2-java)
37
- jwt (1.5.6)
38
- memoizer (1.0.1)
39
- mini_portile2 (2.1.0)
40
- multi_json (1.12.1)
41
- multi_xml (0.5.5)
42
- multipart-post (2.0.0)
43
- nokogiri (1.6.8.1)
44
- mini_portile2 (~> 2.1.0)
45
- nokogiri (1.6.8.1-java)
46
- oauth2 (1.2.0)
47
- faraday (>= 0.8, < 0.10)
48
- jwt (~> 1.0)
49
- multi_json (~> 1.3)
50
- multi_xml (~> 0.5)
51
- rack (>= 1.2, < 3)
52
- public_suffix (2.0.4)
53
- rack (2.0.1)
54
- rake (11.3.0)
55
- rdoc (5.0.0)
56
- rspec (3.5.0)
57
- rspec-core (~> 3.5.0)
58
- rspec-expectations (~> 3.5.0)
59
- rspec-mocks (~> 3.5.0)
60
- rspec-core (3.5.4)
61
- rspec-support (~> 3.5.0)
62
- rspec-expectations (3.5.0)
12
+ bigdecimal (3.3.1)
13
+ diff-lcs (1.6.2)
14
+ docile (1.4.1)
15
+ matrix (0.4.3)
16
+ memoizer (1.0.3)
17
+ pdf-core (0.10.0)
18
+ prawn (2.5.0)
19
+ matrix (~> 0.4)
20
+ pdf-core (~> 0.10.0)
21
+ ttfunk (~> 1.8)
22
+ rake (13.3.1)
23
+ rspec (3.13.2)
24
+ rspec-core (~> 3.13.0)
25
+ rspec-expectations (~> 3.13.0)
26
+ rspec-mocks (~> 3.13.0)
27
+ rspec-core (3.13.6)
28
+ rspec-support (~> 3.13.0)
29
+ rspec-expectations (3.13.5)
63
30
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.5.0)
65
- rspec-its (1.2.0)
66
- rspec-core (>= 3.0.0)
67
- rspec-expectations (>= 3.0.0)
68
- rspec-mocks (3.5.0)
31
+ rspec-support (~> 3.13.0)
32
+ rspec-its (2.0.0)
33
+ rspec-core (>= 3.13.0)
34
+ rspec-expectations (>= 3.13.0)
35
+ rspec-mocks (3.13.7)
69
36
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.5.0)
71
- rspec-support (3.5.0)
72
- semver (1.0.1)
73
- simplecov (0.12.0)
74
- docile (~> 1.1.0)
75
- json (>= 1.8, < 3)
76
- simplecov-html (~> 0.10.0)
77
- simplecov-html (0.10.0)
78
- thread_safe (0.3.5)
79
- thread_safe (0.3.5-java)
80
- yard (0.8.7.6)
37
+ rspec-support (~> 3.13.0)
38
+ rspec-support (3.13.6)
39
+ simplecov (0.22.0)
40
+ docile (~> 1.1)
41
+ simplecov-html (~> 0.11)
42
+ simplecov_json_formatter (~> 0.1)
43
+ simplecov-html (0.13.2)
44
+ simplecov_json_formatter (0.1.4)
45
+ ttfunk (1.8.0)
46
+ bigdecimal (~> 3.1)
47
+ yard (0.9.38)
81
48
 
82
49
  PLATFORMS
83
- java
84
50
  ruby
51
+ x86_64-linux
85
52
 
86
53
  DEPENDENCIES
87
- andand (~> 1.3)
88
- jeweler (~> 2.0)
89
- memoizer (~> 1.0)
90
- rake (~> 11.2)
91
- rspec (~> 3.3)
92
- rspec-its (~> 1.0)
93
- simplecov
94
- yard (~> 0.8.5)
54
+ prawn (~> 2.5)
55
+ rake (~> 13.0)
56
+ rspec (~> 3.12)
57
+ rspec-its (~> 2.0)
58
+ simplecov (~> 0.22)
59
+ usps_intelligent_barcode!
60
+ yard (~> 0.9)
61
+
62
+ CHECKSUMS
63
+ andand (1.3.3) sha256=483d8a01e0d02dfc55de7759527d20c167edf0607983fc4e50a7c3583709346c
64
+ bigdecimal (3.3.1) sha256=eaa01e228be54c4f9f53bf3cc34fe3d5e845c31963e7fcc5bedb05a4e7d52218
65
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
66
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
67
+ matrix (0.4.3) sha256=a0d5ab7ddcc1973ff690ab361b67f359acbb16958d1dc072b8b956a286564c5b
68
+ memoizer (1.0.3) sha256=790d924ec13ea376aced58a88c0216e075762166e92080ac8b658859ae4e2945
69
+ pdf-core (0.10.0) sha256=0a5d101e2063c01e3f941e1ee47cbb97f1adfc1395b58372f4f65f1300f3ce91
70
+ prawn (2.5.0) sha256=f4e20e3b4f30bf5b9ae37dad15eb421831594553aa930b2391b0fa0a99c43cb6
71
+ rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
72
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
73
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
74
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
75
+ rspec-its (2.0.0) sha256=a88e8bc38149f2835e93533591ec4f5c829aacbfd41269a2e6f9f5b82f5260df
76
+ rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
77
+ rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
78
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
79
+ simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
80
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
81
+ ttfunk (1.8.0) sha256=a7cbc7e489cc46e979dde04d34b5b9e4f5c8f1ee5fc6b1a7be39b829919d20ca
82
+ usps_intelligent_barcode (1.1.0)
83
+ yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f
95
84
 
96
85
  BUNDLED WITH
97
- 1.13.6
86
+ 4.0.3
data/LICENSE.md CHANGED
@@ -9,3 +9,10 @@ The above copyright notice and this permission notice shall be included in all c
9
9
 
10
10
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
11
 
12
+ ## Bundled Fonts
13
+
14
+ The USPS Intelligent Mail Barcode fonts included in the `fonts/` directory are:
15
+
16
+ Copyright © US Postal Service 2009
17
+
18
+ These fonts are licensed separately under the USPS license (see `fonts/LICENSE`). The USPS grants a world-wide, royalty-free license to use, reproduce, display, distribute, and sublicense these fonts.
@@ -9,64 +9,84 @@ string of characters you should print using one of the [USPS
9
9
  Intelligent Barcode
10
10
  fonts](https://ribbs.usps.gov/onecodesolution/download.cfm).
11
11
 
12
- # ORIGIN
12
+ # Origin
13
13
 
14
14
  This project was forked from Ryan Taylor's
15
15
  https://github.com/rtlong/USPS-intelligent-barcode Long, in order to
16
16
  add tests and refactor. It is _not_ a drop-in replacement: I renamed
17
17
  most methods and classes, and eliminated the #draw method.
18
18
 
19
- # INSTALL
19
+ # Install
20
20
 
21
- $ gem install USPS-intelligent-barcode
21
+ gem install usps_intelligent_barcode
22
22
 
23
- # EXAMPLE
23
+ Note: This gem was previously named `USPS-intelligent-barcode`. If
24
+ you're migrating from the old gem name, see
25
+ [MIGRATION.md](MIGRATION.md).
24
26
 
25
- #!/usr/bin/env ruby
26
-
27
- require 'rubygems'
28
- require 'usps_intelligent_barcode'
29
-
30
- barcode_id = '01'
31
- service_type = '234'
32
- mailer_id = '567094'
33
- serial_number = '987654321'
34
- routing_code = '01234567891'
35
- barcode = Imb::Barcode.new(barcode_id,
36
- service_type,
37
- mailer_id,
38
- serial_number,
39
- routing_code)
40
- p barcode.barcode_letters
41
- # => "AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA"
27
+ # Example
42
28
 
43
- # STANDARD
29
+ ```ruby
30
+ #!/usr/bin/env ruby
31
+ lib_dir = File.expand_path('../lib', __dir__)
32
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
33
+ require 'usps_intelligent_barcode'
34
+
35
+ barcode_id = '01'
36
+ service_type = '234'
37
+ mailer_id = '567094'
38
+ serial_number = '987654321'
39
+ routing_code = '01234567891'
40
+ barcode = Imb::Barcode.new(barcode_id,
41
+ service_type,
42
+ mailer_id,
43
+ serial_number,
44
+ routing_code)
45
+ p barcode.barcode_letters
46
+ # => "AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA"
47
+ ```
48
+
49
+ # Generating Barcode PDFs
50
+
51
+ The gem includes bundled USPS Intelligent Mail Barcode fonts. To generate a
52
+ PDF with a barcode:
53
+
54
+ ```ruby
55
+ gem install prawn
56
+ ruby examples/generate_pdf.rb
57
+ ```
58
+
59
+ This creates `/tmp/barcode_to_pdf.pdf` with the barcode and its component
60
+ fields. The USPS fonts (USPSIMBStandard and USPSIMBCompact) are included
61
+ in the `fonts/` directory - no installation required.
62
+
63
+ # Standard
44
64
 
45
65
  This gem is based upon standard
46
66
  [USPS-B-3200H](https://ribbs.usps.gov/intelligentmail_mailpieces/documents/tech_guides/USPSB3200IntelligentMailBarcode4State.pdf),
47
67
  which is linked to from [Intelligent Mail Barcode for
48
68
  Mailpieces](https://ribbs.usps.gov/index.cfm?page=intellmailmailpieces)
49
69
 
50
- # RUBY VERSIONS
51
-
52
- These Ruby versions are supported (these are the rvm platform names):
70
+ # Supported Ruby Versions
53
71
 
54
- * jruby-1.7
55
- * ruby-1.9.3
56
- * ruby-2.0
57
- * ruby-2.1
58
- * ruby-2.2
59
- * ruby-2.3
72
+ This gem is tested and supported on:
60
73
 
61
- For ruby-1.8.7 please see the deprecated
62
- [USPS-intelligent-barcode](https://rubygems.org/gems/USPS-intelligent-barcode)
63
- gem.
74
+ * ruby-3.2
75
+ * ruby-3.3
76
+ * ruby-3.4
77
+ * ruby-4.0
64
78
 
65
- # WHOAMI
79
+ # whoami
66
80
 
67
81
  Wayne Conrad <kf7qga@gmail.com>
68
82
 
69
- # CREDITS
83
+ # Gem versioning
84
+
85
+ This library uses [Semantic Versioning](http://semver.org/). It
86
+ promises not to make breaking changes to its API without bumping the
87
+ major version.
88
+
89
+ # Credits
70
90
 
71
91
  Thanks to Ryan Taylor Long for his original work, without which I
72
92
  would have been lost in the USPS specification.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 1.1.0
@@ -0,0 +1,55 @@
1
+ # Installing USPS Intelligent Mail Barcode Fonts
2
+
3
+ ## Bundled Fonts (Recommended)
4
+
5
+ The USPS fonts are bundled with this gem - no installation required!
6
+
7
+ The PDF generation example automatically uses the bundled fonts:
8
+
9
+ ```bash
10
+ gem install prawn
11
+ ruby examples/generate_pdf.rb
12
+ ```
13
+
14
+ The bundled fonts are located in the gem's `fonts/` directory and are
15
+ licensed by USPS for royalty-free use (see `fonts/LICENSE`).
16
+
17
+ The example embeds the bundled font into the generated PDF, so the PDF will
18
+ display correctly on any system without requiring font installation. If you
19
+ create your own PDF that does not embed the font, you will need to install
20
+ the font system-wide to view the generated PDF.
21
+
22
+ ## System Installation (Optional)
23
+
24
+ If you prefer to install the fonts system-wide for use in other applications,
25
+ follow these instructions.
26
+
27
+ ### Download the Font
28
+
29
+ Official USPS Source (Free):
30
+
31
+ 1. Visit https://postalpro.usps.com/onecodesolution
32
+ 2. Download `uspsFontsNonAFP-1.4.0.zip` (TrueType format)
33
+ 3. Extract and navigate to `fonts/scalable/trueType/` folder
34
+
35
+ ## Installation on Linux
36
+
37
+ ```
38
+ cd ~/Downloads
39
+ mkdir uspsFontsNonAFP-1.4.0.zip.d
40
+ cd uspsFontsNonAFP-1.4.0.zip.d
41
+ unzip ../uspsFontsNonAFP-1.4.0.zip
42
+ cd fonts/scalable/trueType/
43
+ sudo mkdir -p /usr/share/fonts/truetype/usps
44
+ sudo cp *.ttf /usr/share/fonts/truetype/usps/
45
+ sudo fc-cache -f
46
+ fc-list | grep -i usps
47
+ ```
48
+
49
+ ## Available Fonts
50
+
51
+ The package includes several fonts:
52
+
53
+ - USPSIMBStandard.ttf (recommended, used in examples)
54
+ - USPSIMBCompact.ttf (alternative)
55
+ - USPSIMB.ttf (same as Standard)
data/doc/migration.md ADDED
@@ -0,0 +1,47 @@
1
+ # Migration Guide
2
+
3
+ ## Gem Rename: USPS-intelligent-barcode → usps_intelligent_barcode
4
+
5
+ ### Background
6
+
7
+ In June 2015 (version 0.3.0), this gem was renamed from `USPS-intelligent-barcode` to `usps_intelligent_barcode` to follow Ruby gem naming conventions.
8
+
9
+ ### What Changed
10
+
11
+ **Old name (deprecated):**
12
+ ```ruby
13
+ gem 'USPS-intelligent-barcode'
14
+ ```
15
+
16
+ **New name (current):**
17
+ ```ruby
18
+ gem 'usps_intelligent_barcode'
19
+ ```
20
+
21
+ ### Migration Steps
22
+
23
+ 1. Update your `Gemfile`:
24
+ ```ruby
25
+ # Replace this:
26
+ gem 'USPS-intelligent-barcode'
27
+
28
+ # With this:
29
+ gem 'usps_intelligent_barcode'
30
+ ```
31
+
32
+ 2. Run `bundle update`
33
+
34
+ 3. No code changes required - the API remains identical
35
+
36
+ ### Compatibility Period
37
+
38
+ For backward compatibility, both gem names were published simultaneously:
39
+
40
+ - `USPS-intelligent-barcode` (v0.2.7) - Deprecated, with post-install warning
41
+ - `usps_intelligent_barcode` (v0.3.0+) - Current version
42
+
43
+ The deprecated `USPS-intelligent-barcode` gem was maintained through 2015-2016 to allow users time to migrate.
44
+
45
+ ### Current Status
46
+
47
+ As of 2025, only `usps_intelligent_barcode` is actively maintained. The old `USPS-intelligent-barcode` gem name should not be used for new projects.
data/doc/publishing.md ADDED
@@ -0,0 +1,75 @@
1
+ # Publishing a New Release
2
+
3
+ ## Checklist
4
+
5
+ * Bump the version in VERSION file:
6
+ ```
7
+ rake version:bump_patch # For bug fixes (1.1.0 -> 1.1.1)
8
+ rake version:bump_minor # For new features (1.1.0 -> 1.2.0)
9
+ rake version:bump_major # For breaking changes (1.1.0 -> 2.0.0)
10
+ ```
11
+
12
+ * Update CHANGELOG.md with version and date
13
+
14
+ * Update Gemfile.lock for the new version
15
+ ```
16
+ bundle install
17
+ ```
18
+
19
+ * Run tests:
20
+ ```
21
+ rake
22
+ ```
23
+
24
+ * Check code coverage (optional):
25
+ ```
26
+ open coverage/index.html
27
+ ```
28
+
29
+ * Commit the version bump:
30
+ ```
31
+ git commit -am "Bump version to X.X.X"
32
+ ```
33
+
34
+ * Release:
35
+ ```
36
+ rake release
37
+ ```
38
+
39
+ * Verify at https://rubygems.org/gems/usps_intelligent_barcode
40
+
41
+ ## Notes
42
+
43
+ Semantic Versioning: MAJOR.MINOR.PATCH (breaking.feature.bugfix)
44
+
45
+ What `rake release` does:
46
+ - Builds the gem
47
+ - Creates git tag vX.X.X
48
+ - Pushes tag to GitHub
49
+ - Publishes gem to rubygems.org
50
+
51
+ Dry run: `gem_push=no rake release` (tags but doesn't publish)
52
+
53
+ Test locally before releasing:
54
+ ```
55
+ rake install
56
+ gem list usps_intelligent_barcode
57
+ ```
58
+
59
+ ## Troubleshooting
60
+
61
+ No RubyGems credentials: `gem signin`
62
+
63
+ Release failed mid-way:
64
+ ```
65
+ git tag -d vX.X.X # Delete local tag
66
+ git push origin :vX.X.X # Delete remote tag
67
+ # Fix VERSION file if needed
68
+ rake release # Try again
69
+ ```
70
+
71
+ Manual publish (if rake release fails):
72
+ ```
73
+ gem build usps_intelligent_barcode.gemspec
74
+ gem push usps_intelligent_barcode-X.X.X.gem
75
+ ```
data/examples/example.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
2
+ lib_dir = File.expand_path('../lib', __dir__)
3
+ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
4
4
  require 'usps_intelligent_barcode'
5
5
 
6
6
  barcode_id = '01'
@@ -13,5 +13,5 @@ barcode = Imb::Barcode.new(barcode_id,
13
13
  mailer_id,
14
14
  serial_number,
15
15
  routing_code)
16
- p barcode.barcode_letters
17
- # => "AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA"
16
+ puts barcode.barcode_letters
17
+ # => AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA