br_danfe 1.2.2 → 2.0.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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/config.yml +2 -2
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +59 -42
  5. data/README.md +10 -4
  6. data/br_danfe.gemspec +2 -13
  7. data/lib/br_danfe/cce_lib/document.rb +2 -2
  8. data/lib/br_danfe/danfe_lib/nfce_lib/document.rb +2 -2
  9. data/lib/br_danfe/danfe_lib/nfce_lib/header.rb +1 -1
  10. data/lib/br_danfe/danfe_lib/nfe_lib/document.rb +4 -4
  11. data/lib/br_danfe/danfe_lib/nfe_lib/infadic.rb +1 -1
  12. data/lib/br_danfe/document_builder.rb +2 -2
  13. data/lib/br_danfe/logo_options.rb +1 -1
  14. data/lib/br_danfe/mdfe_lib/document.rb +2 -2
  15. data/lib/br_danfe/version.rb +1 -1
  16. data/lib/br_danfe.rb +1 -1
  17. data/lib/prawn/font.rb +1 -1
  18. data/spec/br_danfe/cce_lib/barcode_spec.rb +1 -1
  19. data/spec/br_danfe/cce_lib/correction_spec.rb +1 -1
  20. data/spec/br_danfe/cce_lib/document_spec.rb +7 -7
  21. data/spec/br_danfe/cce_lib/footer_spec.rb +1 -1
  22. data/spec/br_danfe/cce_lib/header_spec.rb +1 -1
  23. data/spec/br_danfe/cce_lib/nfe_key_spec.rb +1 -1
  24. data/spec/br_danfe/cce_lib/protocol_spec.rb +1 -1
  25. data/spec/br_danfe/cce_spec.rb +2 -2
  26. data/spec/br_danfe/danfe_lib/nfce_lib/document_spec.rb +1 -1
  27. data/spec/br_danfe/danfe_lib/nfce_lib/footer_spec.rb +1 -1
  28. data/spec/br_danfe/danfe_lib/nfce_lib/header_spec.rb +2 -2
  29. data/spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb +1 -1
  30. data/spec/br_danfe/danfe_lib/nfce_lib/nfce_identification_spec.rb +1 -1
  31. data/spec/br_danfe/danfe_lib/nfce_lib/product_list_spec.rb +1 -1
  32. data/spec/br_danfe/danfe_lib/nfce_lib/recipient_spec.rb +1 -1
  33. data/spec/br_danfe/danfe_lib/nfce_lib/total_list_spec.rb +1 -1
  34. data/spec/br_danfe/danfe_lib/nfce_spec.rb +3 -3
  35. data/spec/br_danfe/danfe_lib/nfe_lib/dest_spec.rb +1 -1
  36. data/spec/br_danfe/danfe_lib/nfe_lib/det_body_spec.rb +8 -8
  37. data/spec/br_danfe/danfe_lib/nfe_lib/document_spec.rb +2 -2
  38. data/spec/br_danfe/danfe_lib/nfe_lib/dup_spec.rb +1 -1
  39. data/spec/br_danfe/danfe_lib/nfe_lib/emit_header_spec.rb +3 -3
  40. data/spec/br_danfe/danfe_lib/nfe_lib/entrega_spec.rb +1 -1
  41. data/spec/br_danfe/danfe_lib/nfe_lib/icmstot_spec.rb +1 -1
  42. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_spec.rb +1 -1
  43. data/spec/br_danfe/danfe_lib/nfe_lib/infadic_vol_spec.rb +1 -1
  44. data/spec/br_danfe/danfe_lib/nfe_lib/issqn_spec.rb +1 -1
  45. data/spec/br_danfe/danfe_lib/nfe_lib/ticket_spec.rb +3 -3
  46. data/spec/br_danfe/danfe_lib/nfe_lib/transp_spec.rb +1 -1
  47. data/spec/br_danfe/danfe_lib/nfe_lib/vol_spec.rb +1 -1
  48. data/spec/br_danfe/danfe_lib/nfe_spec.rb +6 -6
  49. data/spec/br_danfe/mdfe_lib/fisco_control_spec.rb +1 -1
  50. data/spec/br_danfe/mdfe_lib/header_spec.rb +1 -1
  51. data/spec/br_danfe/mdfe_lib/notes_spec.rb +1 -1
  52. data/spec/br_danfe/mdfe_spec.rb +2 -2
  53. data/spec/br_danfe/qr_code_spec.rb +1 -1
  54. data/spec/fixtures/cce/lib/barcode#render.pdf +14 -14
  55. data/spec/fixtures/cce/lib/correction#render.pdf +0 -0
  56. data/spec/fixtures/cce/lib/document#box.pdf +14 -14
  57. data/spec/fixtures/cce/lib/document#box.with.block.pdf +0 -0
  58. data/spec/fixtures/cce/lib/document#text.align.pdf +0 -0
  59. data/spec/fixtures/cce/lib/document#text.pad.pdf +0 -0
  60. data/spec/fixtures/cce/lib/document#text.simple.pdf +0 -0
  61. data/spec/fixtures/cce/lib/document#text.size.pdf +0 -0
  62. data/spec/fixtures/cce/lib/document#text.style.pdf +0 -0
  63. data/spec/fixtures/cce/lib/footer#render.pdf +0 -0
  64. data/spec/fixtures/cce/lib/header#render.pdf +0 -0
  65. data/spec/fixtures/cce/lib/nfe_key#render.pdf +0 -0
  66. data/spec/fixtures/cce/lib/protocol#render.pdf +0 -0
  67. data/spec/fixtures/cce/v1.00/cce.fixture.pdf +265 -149
  68. data/spec/fixtures/mdfe/lib/fisco_control#barcode.pdf +0 -0
  69. data/spec/fixtures/mdfe/lib/fisco_control#without-barcode.pdf +0 -0
  70. data/spec/fixtures/mdfe/lib/header#render-qr-code.pdf +0 -0
  71. data/spec/fixtures/mdfe/lib/header#render-with_logo.pdf +0 -0
  72. data/spec/fixtures/mdfe/lib/header#render-without-qr-code.pdf +0 -0
  73. data/spec/fixtures/mdfe/lib/header#render-without_logo.pdf +0 -0
  74. data/spec/fixtures/mdfe/lib/mdfe-with-multiple-pages.pdf +344 -176
  75. data/spec/fixtures/mdfe/lib/mdfe.fixture.pdf +336 -168
  76. data/spec/fixtures/mdfe/lib/notes#render-big-aditional-information.pdf +219 -151
  77. data/spec/fixtures/nfce/lib/document#render.pdf +20 -20
  78. data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +0 -0
  79. data/spec/fixtures/nfce/lib/footer#render.pdf +0 -0
  80. data/spec/fixtures/nfce/lib/header#render-homologation.pdf +0 -0
  81. data/spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf +0 -0
  82. data/spec/fixtures/nfce/lib/header#render-long_name_without_logo.pdf +0 -0
  83. data/spec/fixtures/nfce/lib/header#render-short_name_with_logo.pdf +0 -0
  84. data/spec/fixtures/nfce/lib/header#render-short_name_without_logo.pdf +0 -0
  85. data/spec/fixtures/nfce/lib/key#render.pdf +0 -0
  86. data/spec/fixtures/nfce/lib/nfce_identification#render.pdf +0 -0
  87. data/spec/fixtures/nfce/lib/product_list#render-with_many_products.pdf +0 -0
  88. data/spec/fixtures/nfce/lib/product_list#render-with_many_products_and_long_names.pdf +0 -0
  89. data/spec/fixtures/nfce/lib/product_list#render-with_single_product.pdf +0 -0
  90. data/spec/fixtures/nfce/lib/product_list#render-with_single_product_and_long_name.pdf +0 -0
  91. data/spec/fixtures/nfce/lib/recipient#render-company.pdf +0 -0
  92. data/spec/fixtures/nfce/lib/recipient#render-consumer_without_document.pdf +0 -0
  93. data/spec/fixtures/nfce/lib/recipient#render-foreign.pdf +0 -0
  94. data/spec/fixtures/nfce/lib/recipient#render-individual.pdf +0 -0
  95. data/spec/fixtures/nfce/lib/recipient#render-unidentified_consumer.pdf +0 -0
  96. data/spec/fixtures/nfce/lib/total_list#does_not_render-payment_methods.pdf +0 -0
  97. data/spec/fixtures/nfce/lib/total_list#render-grouped_payment_methods.pdf +0 -0
  98. data/spec/fixtures/nfce/lib/total_list#render-totals.pdf +0 -0
  99. data/spec/fixtures/nfce/lib/total_list#render-without_payment.pdf +0 -0
  100. data/spec/fixtures/nfce/lib/total_list#render.pdf +0 -0
  101. data/spec/fixtures/nfce/v4.00/multiples_xmls_on_the_same_pdf.pdf +336 -205
  102. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-hom.fixture.pdf +0 -0
  103. data/spec/fixtures/nfce/v4.00/nfce-unauthorized-prod.fixture.pdf +0 -0
  104. data/spec/fixtures/nfce/v4.00/rendered_nfce.fixture.pdf +0 -0
  105. data/spec/fixtures/nfce/v4.00/saved_nfce.fixture.pdf +0 -0
  106. data/spec/fixtures/nfe/lib/dest#render-v2.00.pdf +0 -0
  107. data/spec/fixtures/nfe/lib/dest#render-v3.10.pdf +0 -0
  108. data/spec/fixtures/nfe/lib/dest#render-v4.00.pdf +0 -0
  109. data/spec/fixtures/nfe/lib/dest#render-with-address-bigger.pdf +0 -0
  110. data/spec/fixtures/nfe/lib/dest#render-with_cnpj.pdf +0 -0
  111. data/spec/fixtures/nfe/lib/dest#render-with_cpf.pdf +0 -0
  112. data/spec/fixtures/nfe/lib/dest#render-with_ie.pdf +0 -0
  113. data/spec/fixtures/nfe/lib/dest#render-without-address-complement.pdf +0 -0
  114. data/spec/fixtures/nfe/lib/det_body#render-csosn.pdf +144 -82
  115. data/spec/fixtures/nfe/lib/det_body#render-cst.pdf +129 -81
  116. data/spec/fixtures/nfe/lib/det_body#render-fci.pdf +124 -85
  117. data/spec/fixtures/nfe/lib/det_body#render-icms_st.pdf +133 -89
  118. data/spec/fixtures/nfe/lib/det_body#render-quantity_with_custom_precision.pdf +122 -84
  119. data/spec/fixtures/nfe/lib/det_body#render-three_pages.pdf +140 -85
  120. data/spec/fixtures/nfe/lib/det_body#render-two_pages.pdf +140 -85
  121. data/spec/fixtures/nfe/lib/det_body#render-unit_price_with_custom_precision.pdf +122 -84
  122. data/spec/fixtures/nfe/lib/det_body#render-with_entrega.pdf +118 -64
  123. data/spec/fixtures/nfe/lib/det_body#render-with_infadprod.pdf +131 -76
  124. data/spec/fixtures/nfe/lib/det_body#render-with_issqn.pdf +140 -85
  125. data/spec/fixtures/nfe/lib/det_body#render-without_issqn.pdf +140 -85
  126. data/spec/fixtures/nfe/lib/document#lcnpj-blank.pdf +0 -0
  127. data/spec/fixtures/nfe/lib/document#lcnpj-invalid.pdf +0 -0
  128. data/spec/fixtures/nfe/lib/document#lcnpj-valid.pdf +0 -0
  129. data/spec/fixtures/nfe/lib/document#lie-blank-uf-invalid.pdf +0 -0
  130. data/spec/fixtures/nfe/lib/document#lie-blank.pdf +0 -0
  131. data/spec/fixtures/nfe/lib/document#lie-invalid.pdf +0 -0
  132. data/spec/fixtures/nfe/lib/document#lie-valid.pdf +0 -0
  133. data/spec/fixtures/nfe/lib/dup#render-with_entrega.pdf +0 -0
  134. data/spec/fixtures/nfe/lib/dup#render.pdf +0 -0
  135. data/spec/fixtures/nfe/lib/emit_header#render-nfe_key.pdf +283 -151
  136. data/spec/fixtures/nfe/lib/emit_header#render-second_page.pdf +283 -151
  137. data/spec/fixtures/nfe/lib/emit_header#render-with_logo.pdf +283 -151
  138. data/spec/fixtures/nfe/lib/emit_header#render-without_logo.pdf +264 -132
  139. data/spec/fixtures/nfe/lib/entrega#render-v2.00.pdf +0 -0
  140. data/spec/fixtures/nfe/lib/entrega#render-with-address-bigger.pdf +0 -0
  141. data/spec/fixtures/nfe/lib/entrega#render-with_cpf.pdf +0 -0
  142. data/spec/fixtures/nfe/lib/icmstot#render-with_entrega.pdf +0 -0
  143. data/spec/fixtures/nfe/lib/icmstot#render.pdf +0 -0
  144. data/spec/fixtures/nfe/lib/infadic#render-all_the_informations.pdf +0 -0
  145. data/spec/fixtures/nfe/lib/infadic#render-difal.pdf +0 -0
  146. data/spec/fixtures/nfe/lib/infadic#render-extra_volume.pdf +0 -0
  147. data/spec/fixtures/nfe/lib/infadic#render-with_complementary_information.pdf +0 -0
  148. data/spec/fixtures/nfe/lib/infadic#render-with_dup_additional_information.pdf +0 -0
  149. data/spec/fixtures/nfe/lib/infadic#render-with_fisco_additional_information.pdf +0 -0
  150. data/spec/fixtures/nfe/lib/infadic#render-with_street_data.pdf +0 -0
  151. data/spec/fixtures/nfe/lib/infadic#render-without_dup_additional_information.pdf +0 -0
  152. data/spec/fixtures/nfe/lib/infadic#render.pdf +0 -0
  153. data/spec/fixtures/nfe/lib/infadic_vol#render-extra_volume.pdf +0 -0
  154. data/spec/fixtures/nfe/lib/issqn#render-with_entrega.pdf +0 -0
  155. data/spec/fixtures/nfe/lib/issqn#render-with_issqn.pdf +0 -0
  156. data/spec/fixtures/nfe/lib/issqn#render-with_one_issqn_value.pdf +0 -0
  157. data/spec/fixtures/nfe/lib/issqn#render-without_issqn.pdf +14 -14
  158. data/spec/fixtures/nfe/lib/ticket#render.pdf +0 -0
  159. data/spec/fixtures/nfe/lib/ticket#render_with_dEmit.pdf +0 -0
  160. data/spec/fixtures/nfe/lib/ticket#render_with_dhEmit.pdf +0 -0
  161. data/spec/fixtures/nfe/lib/transp#render-modfrete_0.pdf +0 -0
  162. data/spec/fixtures/nfe/lib/transp#render-modfrete_1.pdf +0 -0
  163. data/spec/fixtures/nfe/lib/transp#render-modfrete_2.pdf +0 -0
  164. data/spec/fixtures/nfe/lib/transp#render-modfrete_3.pdf +0 -0
  165. data/spec/fixtures/nfe/lib/transp#render-modfrete_4.pdf +0 -0
  166. data/spec/fixtures/nfe/lib/transp#render-modfrete_9.pdf +0 -0
  167. data/spec/fixtures/nfe/lib/transp#render-with_entrega.pdf +0 -0
  168. data/spec/fixtures/nfe/lib/transp#render.pdf +0 -0
  169. data/spec/fixtures/nfe/lib/vol#render-blank-boxes.pdf +0 -0
  170. data/spec/fixtures/nfe/lib/vol#render-with_entrega.pdf +0 -0
  171. data/spec/fixtures/nfe/lib/vol#render.pdf +0 -0
  172. data/spec/fixtures/nfe/v2.00/custom_options.fixture.pdf +312 -185
  173. data/spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml.fixture.pdf +293 -166
  174. data/spec/fixtures/nfe/v2.00/nfe_with_entrega.xml.fixture.pdf +296 -166
  175. data/spec/fixtures/nfe/v2.00/nfe_with_extra_volumes.xml.fixture.pdf +419 -221
  176. data/spec/fixtures/nfe/v2.00/nfe_with_fci.xml.fixture.pdf +311 -163
  177. data/spec/fixtures/nfe/v2.00/nfe_with_ns.xml.fixture.pdf +309 -171
  178. data/spec/fixtures/nfe/v2.00/nfe_without_ns.xml.fixture.pdf +303 -152
  179. data/spec/fixtures/nfe/v3.10/multiples.xmls.on.the.same.pdf.pdf +320 -152
  180. data/spec/fixtures/nfe/v3.10/nfe_simples_nacional.xml.fixture.pdf +312 -144
  181. data/spec/fixtures/nfe/v3.10/with_footer.fixture.pdf +323 -169
  182. data/spec/fixtures/nfe/v3.10/with_issqn.fixture.pdf +314 -138
  183. data/spec/fixtures/nfe/v3.10/with_three_pages.fixture.pdf +330 -159
  184. data/spec/fixtures/nfe/v3.10/without_issqn.fixture.pdf +319 -148
  185. data/spec/fixtures/qr_code/qr_code#render.pdf +0 -0
  186. metadata +7 -160
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28c418d7f4785e8fcc28658e76cb02822bfecb86f958a8d1bc167af5852000e1
4
- data.tar.gz: 1e936227f6c1b3393b4e1bfafbda8577c23ab9aabde593694648bf965ea6b609
3
+ metadata.gz: 6957c52fda8133d7dbb9ddf4ae9f29f20bb45bb6ec41127c546ae93bd2221f2c
4
+ data.tar.gz: 2b5031a95eb542e75f457723dee23d193f8f3407d22ba26dd85ded6400f55c35
5
5
  SHA512:
6
- metadata.gz: 6c4a931f688d5e4d65c3491d4ee35cb815589a1f1e9f4a01d946122b3cdfa54dcc8468885e8d70eb23797f7950e0cdce6adff668909252d257847f5b024e507e
7
- data.tar.gz: 56aa6e7aab5fe64836d309ceb6d8748997dbd48cd4e4b3c38197c6da16f446f554c8c4ecb5766c4c4291460d3a24640def739c522ca502a43d9afc3861796741
6
+ metadata.gz: 5ec5cf3a1c2ded1acc9c010c440328052a6a9660f1aaddd0bf1dcd1b1ea7ddd42f356ca433462743bb2f5443d75fd383f91d8aba8437f8fbc183f24c78a4f017
7
+ data.tar.gz: 49b1f817299513b9ba693b2b19bb0d23971578c433193e980824046ae9900a69d63207b422f93046d9c68dba14874a9414c8e8039598baf6c478fce8f384cc9f
@@ -7,7 +7,7 @@ jobs:
7
7
  strategy:
8
8
  fail-fast: false # I understand this is to run on all versions.
9
9
  matrix:
10
- ruby: ['3.0.4']
10
+ ruby: ['3.3.5']
11
11
 
12
12
  runs-on: ubuntu-latest
13
13
 
@@ -25,7 +25,7 @@ jobs:
25
25
  strategy:
26
26
  fail-fast: false # I understand this is to run on all versions.
27
27
  matrix:
28
- ruby: ['3.0.4']
28
+ ruby: ['3.3.5']
29
29
 
30
30
  runs-on: ubuntu-latest
31
31
 
data/Gemfile CHANGED
@@ -1,3 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :development, :test do
6
+ gem 'byebug', '11.1.3'
7
+ gem 'guard', '~> 2.19.0'
8
+ gem 'guard-rspec', '~> 4.7.3'
9
+ gem 'pdf-inspector', '~> 1.3.0'
10
+ gem 'rake', '13.2.1'
11
+ gem 'rspec', '3.13.0'
12
+ gem 'rubocop', '~> 1.75.3'
13
+ gem 'rubocop-performance', '~> 1.19.0'
14
+ gem 'rubocop-rspec', '~> 2.25.0'
15
+ gem 'simplecov', '0.22.0'
16
+ gem 'simplecov-html', '0.13.1'
17
+ end
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (1.2.2)
4
+ br_danfe (2.0.0)
5
5
  barby (= 0.6.9)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
8
8
  nokogiri (>= 1.8)
9
- prawn (~> 2.4.0)
9
+ prawn (~> 2.5.0)
10
10
  prawn-table (= 0.2.2)
11
11
  rqrcode (>= 2.1, < 2.3)
12
12
 
@@ -27,7 +27,7 @@ GEM
27
27
  mutex_m
28
28
  tzinfo (~> 2.0)
29
29
  afm (0.2.2)
30
- ast (2.4.2)
30
+ ast (2.4.3)
31
31
  barby (0.6.9)
32
32
  base64 (0.2.0)
33
33
  bigdecimal (3.1.6)
@@ -43,9 +43,9 @@ GEM
43
43
  docile (1.4.1)
44
44
  drb (2.2.0)
45
45
  ruby2_keywords
46
- ffi (1.16.3)
46
+ ffi (1.17.0)
47
47
  formatador (1.1.0)
48
- guard (2.18.1)
48
+ guard (2.19.0)
49
49
  formatador (>= 0.2.4)
50
50
  listen (>= 2.7, < 4.0)
51
51
  lumberjack (>= 1.0.12, < 2.0)
@@ -62,11 +62,15 @@ GEM
62
62
  hashery (2.1.2)
63
63
  i18n (1.14.5)
64
64
  concurrent-ruby (~> 1.0)
65
- listen (3.8.0)
65
+ json (2.11.3)
66
+ language_server-protocol (3.17.0.4)
67
+ lint_roller (1.1.0)
68
+ listen (3.9.0)
66
69
  rb-fsevent (~> 0.10, >= 0.10.3)
67
70
  rb-inotify (~> 0.9, >= 0.9.10)
68
71
  lumberjack (1.2.10)
69
- method_source (1.0.0)
72
+ matrix (0.4.2)
73
+ method_source (1.1.0)
70
74
  mini_portile2 (2.8.7)
71
75
  minitest (5.21.2)
72
76
  mutex_m (0.2.0)
@@ -77,10 +81,11 @@ GEM
77
81
  notiffany (0.1.3)
78
82
  nenv (~> 0.1)
79
83
  shellany (~> 0.0)
80
- parallel (1.21.0)
81
- parser (3.0.2.0)
84
+ parallel (1.27.0)
85
+ parser (3.3.8.0)
82
86
  ast (~> 2.4.1)
83
- pdf-core (0.9.0)
87
+ racc
88
+ pdf-core (0.10.0)
84
89
  pdf-inspector (1.3.0)
85
90
  pdf-reader (>= 1.0, < 3.0.a)
86
91
  pdf-reader (2.5.0)
@@ -89,23 +94,23 @@ GEM
89
94
  hashery (~> 2.0)
90
95
  ruby-rc4
91
96
  ttfunk
92
- prawn (2.4.0)
93
- pdf-core (~> 0.9.0)
94
- ttfunk (~> 1.7)
97
+ prawn (2.5.0)
98
+ matrix (~> 0.4)
99
+ pdf-core (~> 0.10.0)
100
+ ttfunk (~> 1.8)
95
101
  prawn-table (0.2.2)
96
102
  prawn (>= 1.3.0, < 3.0.0)
103
+ prism (1.4.0)
97
104
  pry (0.14.2)
98
105
  coderay (~> 1.1)
99
106
  method_source (~> 1.0)
100
107
  racc (1.8.1)
101
- rainbow (3.0.0)
108
+ rainbow (3.1.1)
102
109
  rake (13.2.1)
103
110
  rb-fsevent (0.11.2)
104
- rb-inotify (0.10.1)
111
+ rb-inotify (0.11.1)
105
112
  ffi (~> 1.0)
106
- regexp_parser (2.1.1)
107
- rexml (3.3.3)
108
- strscan
113
+ regexp_parser (2.10.0)
109
114
  rqrcode (2.2.0)
110
115
  chunky_png (~> 1.0)
111
116
  rqrcode_core (~> 1.0)
@@ -123,24 +128,34 @@ GEM
123
128
  diff-lcs (>= 1.2.0, < 2.0)
124
129
  rspec-support (~> 3.13.0)
125
130
  rspec-support (3.13.1)
126
- rubocop (0.93.1)
131
+ rubocop (1.75.3)
132
+ json (~> 2.3)
133
+ language_server-protocol (~> 3.17.0.2)
134
+ lint_roller (~> 1.1.0)
127
135
  parallel (~> 1.10)
128
- parser (>= 2.7.1.5)
136
+ parser (>= 3.3.0.2)
129
137
  rainbow (>= 2.2.2, < 4.0)
130
- regexp_parser (>= 1.8)
131
- rexml
132
- rubocop-ast (>= 0.6.0)
138
+ regexp_parser (>= 2.9.3, < 3.0)
139
+ rubocop-ast (>= 1.44.0, < 2.0)
133
140
  ruby-progressbar (~> 1.7)
134
- unicode-display_width (>= 1.4.0, < 2.0)
135
- rubocop-ast (1.13.0)
136
- parser (>= 3.0.1.1)
137
- rubocop-performance (1.10.2)
138
- rubocop (>= 0.90.0, < 2.0)
141
+ unicode-display_width (>= 2.4.0, < 4.0)
142
+ rubocop-ast (1.44.1)
143
+ parser (>= 3.3.7.2)
144
+ prism (~> 1.4)
145
+ rubocop-capybara (2.22.1)
146
+ lint_roller (~> 1.1)
147
+ rubocop (~> 1.72, >= 1.72.1)
148
+ rubocop-factory_bot (2.27.1)
149
+ lint_roller (~> 1.1)
150
+ rubocop (~> 1.72, >= 1.72.1)
151
+ rubocop-performance (1.19.1)
152
+ rubocop (>= 1.7.0, < 2.0)
139
153
  rubocop-ast (>= 0.4.0)
140
- rubocop-rspec (1.44.1)
141
- rubocop (~> 0.87)
142
- rubocop-ast (>= 0.7.1)
143
- ruby-progressbar (1.11.0)
154
+ rubocop-rspec (2.25.0)
155
+ rubocop (~> 1.40)
156
+ rubocop-capybara (~> 2.17)
157
+ rubocop-factory_bot (~> 2.22)
158
+ ruby-progressbar (1.13.0)
144
159
  ruby-rc4 (0.1.5)
145
160
  ruby2_keywords (0.0.5)
146
161
  shellany (0.0.1)
@@ -148,14 +163,16 @@ GEM
148
163
  docile (~> 1.1)
149
164
  simplecov-html (~> 0.11)
150
165
  simplecov_json_formatter (~> 0.1)
151
- simplecov-html (0.12.3)
166
+ simplecov-html (0.13.1)
152
167
  simplecov_json_formatter (0.1.4)
153
- strscan (3.1.0)
154
- thor (1.3.0)
155
- ttfunk (1.7.0)
168
+ thor (1.3.2)
169
+ ttfunk (1.8.0)
170
+ bigdecimal (~> 3.1)
156
171
  tzinfo (2.0.6)
157
172
  concurrent-ruby (~> 1.0)
158
- unicode-display_width (1.8.0)
173
+ unicode-display_width (3.1.4)
174
+ unicode-emoji (~> 4.0, >= 4.0.4)
175
+ unicode-emoji (4.0.4)
159
176
 
160
177
  PLATFORMS
161
178
  ruby
@@ -163,16 +180,16 @@ PLATFORMS
163
180
  DEPENDENCIES
164
181
  br_danfe!
165
182
  byebug (= 11.1.3)
166
- guard (~> 2.18.1)
183
+ guard (~> 2.19.0)
167
184
  guard-rspec (~> 4.7.3)
168
185
  pdf-inspector (~> 1.3.0)
169
186
  rake (= 13.2.1)
170
187
  rspec (= 3.13.0)
171
- rubocop (~> 0.93.1)
172
- rubocop-performance (~> 1.10.2)
173
- rubocop-rspec (~> 1.44.1)
188
+ rubocop (~> 1.75.3)
189
+ rubocop-performance (~> 1.19.0)
190
+ rubocop-rspec (~> 2.25.0)
174
191
  simplecov (= 0.22.0)
175
- simplecov-html (= 0.12.3)
192
+ simplecov-html (= 0.13.1)
176
193
 
177
194
  BUNDLED WITH
178
195
  2.5.5
data/README.md CHANGED
@@ -229,18 +229,24 @@ You can generate new data using [4devs generators](http://www.4devs.com.br).
229
229
 
230
230
  ## Deploy to Rubygems
231
231
 
232
- 1. Create and send the new version to Rubygems
232
+ 1. To deploy a new version:
233
233
 
234
- $ bundle exec rake release
234
+ * Define the new version at `lib/br_danfe/version.rb`;
235
+ * Execute `$ bundle`;
236
+ * Commit all and push to Github;
235
237
 
236
- 2. Create a [new release on Github](https://github.com/asseinfo/br_danfe/releases/new)
238
+ 2. Send the new version to Rubygems
239
+
240
+ * $ bundle exec rake release
241
+
242
+ 3. Create a [new release on Github](https://github.com/asseinfo/br_danfe/releases/new)
237
243
 
238
244
  * Choose **the new tag** (Ex.: v0.10.1)
239
245
  * Fill the **Release title** (Ex.: 0.10.1)
240
246
  * Click at **Generate release notes**
241
247
  * Click at **Publish release**
242
248
 
243
- 3. Done!
249
+ 4. Done!
244
250
 
245
251
  You can build or install the gem using one of the above tasks
246
252
 
data/br_danfe.gemspec CHANGED
@@ -11,7 +11,6 @@ Gem::Specification.new do |spec|
11
11
  spec.license = 'MIT'
12
12
 
13
13
  spec.files = `git ls-files`.split("\n")
14
- spec.test_files = `git ls-files -- { test,spec,features }/*`.split("\n")
15
14
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
15
  spec.require_paths = ['lib']
17
16
  spec.required_ruby_version = '>= 3.0'
@@ -20,19 +19,9 @@ Gem::Specification.new do |spec|
20
19
  spec.add_dependency 'br_documents', '>= 0.1.3'
21
20
  spec.add_dependency 'i18n', '>= 0.8.6'
22
21
  spec.add_dependency 'nokogiri', '>= 1.8'
23
- spec.add_dependency 'prawn', '~> 2.4.0'
22
+ spec.add_dependency 'prawn', '~> 2.5.0'
24
23
  spec.add_dependency 'prawn-table', '0.2.2'
25
24
  spec.add_dependency 'rqrcode', '>= 2.1', '< 2.3'
26
25
 
27
- spec.add_development_dependency 'byebug', '11.1.3'
28
- spec.add_development_dependency 'guard', '~> 2.18.1'
29
- spec.add_development_dependency 'guard-rspec', '~> 4.7.3'
30
- spec.add_development_dependency 'pdf-inspector', '~> 1.3.0'
31
- spec.add_development_dependency 'rake', '13.2.1'
32
- spec.add_development_dependency 'rspec', '3.13.0'
33
- spec.add_development_dependency 'rubocop', '~> 0.93.1'
34
- spec.add_development_dependency 'rubocop-performance', '~> 1.10.2'
35
- spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
36
- spec.add_development_dependency 'simplecov', '0.22.0'
37
- spec.add_development_dependency 'simplecov-html', '0.12.3'
26
+ spec.metadata['rubygems_mfa_required'] = 'true'
38
27
  end
@@ -15,9 +15,9 @@ module BrDanfe
15
15
  @document.line_width = 0.3
16
16
  end
17
17
 
18
- def method_missing(method_name, *args, &block)
18
+ def method_missing(method_name, ...)
19
19
  if @document.respond_to? method_name
20
- @document.send method_name, *args, &block
20
+ @document.send(method_name, ...)
21
21
  else
22
22
  super
23
23
  end
@@ -20,9 +20,9 @@ module BrDanfe
20
20
  @document.text ' ', size: font_size
21
21
  end
22
22
 
23
- def method_missing(method_name, *args, &block)
23
+ def method_missing(method_name, ...)
24
24
  if @document.respond_to? method_name
25
- @document.send method_name, *args, &block
25
+ @document.send(method_name, ...)
26
26
  else
27
27
  super
28
28
  end
@@ -24,7 +24,7 @@ module BrDanfe
24
24
  def render_company_info
25
25
  one_line = 1
26
26
 
27
- @pdf.text_box (@xml['emit/xNome']).to_s, at: [x_position, @pdf.cursor], height: 36, size: 9, align: :left, style: :bold, overflow: :shrink_to_fit
27
+ @pdf.text_box @xml['emit/xNome'].to_s, at: [x_position, @pdf.cursor], height: 36, size: 9, align: :left, style: :bold, overflow: :shrink_to_fit
28
28
  @pdf.move_down 36
29
29
 
30
30
  @pdf.text_box cnpj(@xml['emit/CNPJ']), at: [x_position, @pdf.cursor], height: 9, size: 9, align: :left, overflow: :shrink_to_fit
@@ -17,9 +17,9 @@ module BrDanfe
17
17
  @document.line_width = 0.3
18
18
  end
19
19
 
20
- def method_missing(method_name, *args, &block)
20
+ def method_missing(method_name, ...)
21
21
  if @document.respond_to? method_name
22
- @document.send method_name, *args, &block
22
+ @document.send(method_name, ...)
23
23
  else
24
24
  super
25
25
  end
@@ -97,12 +97,12 @@ module BrDanfe
97
97
  end
98
98
 
99
99
  def inumeric(h, w, x, y, i18n = '', data = '', options = {})
100
- label = i18n != '' ? I18n.t("danfe.#{i18n}") : ''
100
+ label = i18n == '' ? '' : I18n.t("danfe.#{i18n}")
101
101
  numeric [x.cm, Helper.invert(y.cm)], w.cm, h.cm, label, data, options
102
102
  end
103
103
 
104
104
  def i18n_lbox(h, w, x, y, i18n = '', info = '', options = {})
105
- label = i18n != '' ? I18n.t("danfe.#{i18n}") : ''
105
+ label = i18n == '' ? '' : I18n.t("danfe.#{i18n}")
106
106
  ibox h, w, x, y, label, info, options
107
107
  end
108
108
 
@@ -113,7 +113,7 @@ module BrDanfe
113
113
 
114
114
  def generate_y_position(volumes_number)
115
115
  if volumes_number > 1
116
- return Y_POSITION + 0.30 + volumes_number * 0.15 + 0.2
116
+ return Y_POSITION + 0.30 + (volumes_number * 0.15) + 0.2
117
117
  end
118
118
 
119
119
  Y_POSITION + 0.30
@@ -1,7 +1,7 @@
1
1
  module BrDanfe
2
2
  class DocumentBuilder
3
- def self.build(*args, &block)
4
- document = Prawn::Document.new(*args, &block)
3
+ def self.build(...)
4
+ document = Prawn::Document.new(...)
5
5
 
6
6
  document.font_families['tinos'] = {
7
7
  bold: "#{BrDanfe.root_path}/fonts/tinos_bold.ttf",
@@ -21,7 +21,7 @@ module BrDanfe
21
21
  end
22
22
 
23
23
  def calculate_size(size)
24
- size < @bounding_box_size ? size : @bounding_box_size
24
+ [size, @bounding_box_size].min
25
25
  end
26
26
  end
27
27
  end
@@ -10,9 +10,9 @@ module BrDanfe
10
10
  @document.font 'tinos'
11
11
  end
12
12
 
13
- def method_missing(method_name, *args, &block)
13
+ def method_missing(method_name, ...)
14
14
  if @document.respond_to? method_name
15
- @document.send method_name, *args, &block
15
+ @document.send(method_name, ...)
16
16
  else
17
17
  super
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '1.2.2'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
data/lib/br_danfe.rb CHANGED
@@ -9,7 +9,7 @@ require 'yaml'
9
9
  require 'i18n'
10
10
  require 'br_documents'
11
11
 
12
- Dir["#{File.dirname(__FILE__)}/**/*.rb"].sort.each { |f| require f }
12
+ Dir["#{File.dirname(__FILE__)}/**/*.rb"].sort.each { |f| require f } # rubocop:disable Lint/RedundantDirGlobSort
13
13
 
14
14
  I18n.load_path << File.expand_path('../config/locales/pt-BR.yml', __dir__)
15
15
  I18n.available_locales = ['pt-BR']
data/lib/prawn/font.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Prawn
2
2
  class Font
3
- def hash #:nodoc:
3
+ def hash # :nodoc:
4
4
  [self.class, name, family].hash
5
5
  end
6
6
  end
@@ -12,7 +12,7 @@ describe BrDanfe::CceLib::Barcode do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  it 'renders header to the pdf' do
@@ -12,7 +12,7 @@ describe BrDanfe::CceLib::Correction do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  it 'renders header to the pdf' do
@@ -7,7 +7,7 @@ describe BrDanfe::CceLib::Document do
7
7
  describe '#box' do
8
8
  context "when a block isn't passed" do
9
9
  before do
10
- File.delete(output_pdf) if File.exist?(output_pdf)
10
+ FileUtils.rm_f(output_pdf)
11
11
  subject.box(height: 50)
12
12
  end
13
13
 
@@ -22,7 +22,7 @@ describe BrDanfe::CceLib::Document do
22
22
 
23
23
  context 'when a block is passed' do
24
24
  before do
25
- File.delete(output_pdf) if File.exist?(output_pdf)
25
+ FileUtils.rm_f(output_pdf)
26
26
  subject.box(height: 50) { subject.text 'sample text' }
27
27
  end
28
28
 
@@ -39,7 +39,7 @@ describe BrDanfe::CceLib::Document do
39
39
  describe '#text' do
40
40
  context 'when is a simple text' do
41
41
  before do
42
- File.delete(output_pdf) if File.exist?(output_pdf)
42
+ FileUtils.rm_f(output_pdf)
43
43
  subject.text 'simple text'
44
44
  end
45
45
 
@@ -54,7 +54,7 @@ describe BrDanfe::CceLib::Document do
54
54
 
55
55
  context 'when is a text with style' do
56
56
  before do
57
- File.delete(output_pdf) if File.exist?(output_pdf)
57
+ FileUtils.rm_f(output_pdf)
58
58
  subject.text 'bold text', style: :bold
59
59
  end
60
60
 
@@ -69,7 +69,7 @@ describe BrDanfe::CceLib::Document do
69
69
 
70
70
  context 'when is a text with size' do
71
71
  before do
72
- File.delete(output_pdf) if File.exist?(output_pdf)
72
+ FileUtils.rm_f(output_pdf)
73
73
  subject.text 'big text', size: 25
74
74
  end
75
75
 
@@ -84,7 +84,7 @@ describe BrDanfe::CceLib::Document do
84
84
 
85
85
  context 'when is a text with pad' do
86
86
  before do
87
- File.delete(output_pdf) if File.exist?(output_pdf)
87
+ FileUtils.rm_f(output_pdf)
88
88
  subject.text 'text with pad', pad: 50
89
89
  end
90
90
 
@@ -99,7 +99,7 @@ describe BrDanfe::CceLib::Document do
99
99
 
100
100
  context 'when is a text with align' do
101
101
  before do
102
- File.delete(output_pdf) if File.exist?(output_pdf)
102
+ FileUtils.rm_f(output_pdf)
103
103
  subject.text 'text in center', align: :center
104
104
  end
105
105
 
@@ -11,7 +11,7 @@ describe BrDanfe::CceLib::Footer do
11
11
  describe '#render' do
12
12
  before do
13
13
  subject.render
14
- File.delete(output_pdf) if File.exist?(output_pdf)
14
+ FileUtils.rm_f(output_pdf)
15
15
  end
16
16
 
17
17
  it 'renders header to the pdf' do
@@ -11,7 +11,7 @@ describe BrDanfe::CceLib::Header do
11
11
  describe '#render' do
12
12
  before do
13
13
  subject.render
14
- File.delete(output_pdf) if File.exist?(output_pdf)
14
+ FileUtils.rm_f(output_pdf)
15
15
  end
16
16
 
17
17
  it 'renders header to the pdf' do
@@ -12,7 +12,7 @@ describe BrDanfe::CceLib::NfeKey do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  it 'renders header to the pdf' do
@@ -12,7 +12,7 @@ describe BrDanfe::CceLib::Protocol do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  it 'renders header to the pdf' do
@@ -8,14 +8,14 @@ describe BrDanfe::Cce do
8
8
 
9
9
  describe '#render_pdf' do
10
10
  it 'renders the correction letter' do
11
- expected = IO.binread("#{base_dir}cce.fixture.pdf")
11
+ expected = File.binread("#{base_dir}cce.fixture.pdf")
12
12
 
13
13
  expect(subject.render_pdf).to eq expected
14
14
  end
15
15
  end
16
16
 
17
17
  describe '#save_pdf' do
18
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
18
+ before { FileUtils.rm_f(output_pdf) }
19
19
 
20
20
  it 'saves the pdf' do
21
21
  expect(File.exist?(output_pdf)).to be_falsey
@@ -6,7 +6,7 @@ describe BrDanfe::DanfeLib::NfceLib::ProductList do
6
6
 
7
7
  let(:subject) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 1.8.cm) }
8
8
 
9
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
9
+ before { FileUtils.rm_f(output_pdf) }
10
10
 
11
11
  it 'render the document with blank lines' do
12
12
  expect(File.exist?(output_pdf)).to be_falsey
@@ -27,7 +27,7 @@ describe BrDanfe::DanfeLib::NfceLib::Footer do
27
27
  subject { described_class.new pdf, xml_footer }
28
28
 
29
29
  describe '#render' do
30
- before { File.delete(output_pdf) if File.exist?(output_pdf) }
30
+ before { FileUtils.rm_f(output_pdf) }
31
31
 
32
32
  it 'renders footer to the pdf' do
33
33
  subject.render
@@ -49,10 +49,10 @@ describe BrDanfe::DanfeLib::NfceLib::Header do
49
49
  describe '#render' do
50
50
  before do
51
51
  subject.render
52
- File.delete(output_pdf) if File.exist?(output_pdf)
52
+ FileUtils.rm_f(output_pdf)
53
53
  end
54
54
 
55
- after { File.delete(output_pdf) if File.exist?(output_pdf) }
55
+ after { FileUtils.rm_f(output_pdf) }
56
56
 
57
57
  context 'when has a short name' do
58
58
  let(:company_name) { 'Test company' }
@@ -31,7 +31,7 @@ describe BrDanfe::DanfeLib::NfceLib::Key do
31
31
  describe '#render' do
32
32
  before do
33
33
  subject.render
34
- File.delete(output_pdf) if File.exist?(output_pdf)
34
+ FileUtils.rm_f(output_pdf)
35
35
  end
36
36
 
37
37
  it 'renders key to the pdf' do
@@ -35,7 +35,7 @@ describe BrDanfe::DanfeLib::NfceLib::NfceIdentification do
35
35
  describe '#render' do
36
36
  before do
37
37
  subject.render
38
- File.delete(output_pdf) if File.exist?(output_pdf)
38
+ FileUtils.rm_f(output_pdf)
39
39
  end
40
40
 
41
41
  it 'renders nfce identification to the pdf' do
@@ -12,7 +12,7 @@ describe BrDanfe::DanfeLib::NfceLib::ProductList do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  context 'when does not have a long name' do
@@ -12,7 +12,7 @@ describe BrDanfe::DanfeLib::NfceLib::Recipient do
12
12
  describe '#render' do
13
13
  before do
14
14
  subject.render
15
- File.delete(output_pdf) if File.exist?(output_pdf)
15
+ FileUtils.rm_f(output_pdf)
16
16
  end
17
17
 
18
18
  context 'when has identified recipient' do