br_danfe 0.17.5 → 0.17.6

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
  SHA256:
3
- metadata.gz: 0b9e0ba277a891478c67be044153b9decfeb80a667a836aa911b84767d825f32
4
- data.tar.gz: cc15a65e63b4b701bd8fd06874adeed84d3db5a606e1b969c5d642c52432e9ab
3
+ metadata.gz: c08eea218b71a40ded6f6e9b3963e7381456d4ec98ab24fbcad0dfa56394a1a8
4
+ data.tar.gz: a4abac583cea2d6e23da22f38172bec45ef3e99d1779e4f66f506a91572eb216
5
5
  SHA512:
6
- metadata.gz: e751a574e37f195a5a2b77bf1ecdbce8106339c7bfb658ed87d31198631d076128c97596182feccae70a5b50363f3cdd00fd23cad7e70bb0d4fce9bb5ee67821
7
- data.tar.gz: ade67abe89088d2845007a1c9182d0ddb970c77b184e98312d294e43e628f69962b69434ca72ed96999ddba5b2d52ad861d5fe960ec3bd048d9ab99b3a14b7a2
6
+ metadata.gz: 9c94f72e5019b5910057fd705845e70b4b8bee715d92aa09ff62f896a5e00c2c70dd80c94664ad120d531246e8bd79501780a8a549d480867252ecc172dd1fc3
7
+ data.tar.gz: 631f009963ff80f68402cb73d27aca0b04d1cc3b667b66f688c82a23daf82d84ec03b9eaef1d3cfbf36f68bc8cece4407e1e482ffe26ae14f4f64d25be5fe0b2
@@ -8,10 +8,7 @@ updates:
8
8
  - package-ecosystem: "bundler" # See documentation for possible values
9
9
  directory: "/" # Location of package manifests
10
10
  schedule:
11
- interval: "weekly"
12
- day: "wednesday"
13
- time: "09:00"
14
- timezone: "America/Sao_Paulo"
11
+ interval: "monthly"
15
12
  open-pull-requests-limit: 10
16
13
  allow:
17
14
  - dependency-type: "direct"
@@ -0,0 +1,49 @@
1
+ name: Tests
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ linter:
7
+ strategy:
8
+ fail-fast: false # I understand this is to run on all versions.
9
+ matrix:
10
+ ruby: ['2', '3.0.4']
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true
21
+
22
+ - run: bundle exec rubocop --display-cop-names --parallel
23
+
24
+ rspec:
25
+ strategy:
26
+ fail-fast: false # I understand this is to run on all versions.
27
+ matrix:
28
+ ruby: ['2', '3.0.4']
29
+
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - uses: actions/checkout@v3
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+
40
+ - run: |
41
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
42
+ chmod +x ./cc-test-reporter
43
+
44
+ - run: |
45
+ ./cc-test-reporter before-build
46
+ bundle exec rspec
47
+ ./cc-test-reporter after-build -r $CC_TEST_REPORTER_ID --exit-code $?
48
+ env:
49
+ CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.4
1
+ ruby 3.0.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_danfe (0.17.5)
4
+ br_danfe (0.17.6)
5
5
  barby (= 0.6.8)
6
6
  br_documents (>= 0.1.3)
7
7
  i18n (>= 0.8.6)
@@ -14,9 +14,9 @@ GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
16
  Ascii85 (1.1.0)
17
- activemodel (6.1.4.1)
18
- activesupport (= 6.1.4.1)
19
- activesupport (6.1.4.1)
17
+ activemodel (6.1.6.1)
18
+ activesupport (= 6.1.6.1)
19
+ activesupport (6.1.6.1)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -25,14 +25,14 @@ GEM
25
25
  afm (0.2.2)
26
26
  ast (2.4.2)
27
27
  barby (0.6.8)
28
- br_documents (0.2.2)
28
+ br_documents (0.2.3)
29
29
  activemodel (>= 4.0.0)
30
30
  i18n (>= 0.6.5)
31
31
  byebug (11.1.3)
32
32
  chunky_png (1.4.0)
33
33
  coderay (1.1.3)
34
34
  concurrent-ruby (1.1.10)
35
- diff-lcs (1.4.4)
35
+ diff-lcs (1.5.0)
36
36
  docile (1.4.0)
37
37
  ffi (1.15.3)
38
38
  formatador (0.3.0)
@@ -59,11 +59,11 @@ GEM
59
59
  rb-inotify (~> 0.9, >= 0.9.10)
60
60
  lumberjack (1.2.8)
61
61
  method_source (1.0.0)
62
- mini_portile2 (2.7.1)
63
- minitest (5.14.4)
62
+ mini_portile2 (2.8.0)
63
+ minitest (5.16.3)
64
64
  nenv (0.3.0)
65
- nokogiri (1.13.1)
66
- mini_portile2 (~> 2.7.0)
65
+ nokogiri (1.13.8)
66
+ mini_portile2 (~> 2.8.0)
67
67
  racc (~> 1.4)
68
68
  notiffany (0.1.3)
69
69
  nenv (~> 0.1)
@@ -96,23 +96,23 @@ GEM
96
96
  ffi (~> 1.0)
97
97
  regexp_parser (2.1.1)
98
98
  rexml (3.2.5)
99
- rqrcode (2.1.0)
99
+ rqrcode (2.1.2)
100
100
  chunky_png (~> 1.0)
101
101
  rqrcode_core (~> 1.0)
102
102
  rqrcode_core (1.2.0)
103
- rspec (3.10.0)
104
- rspec-core (~> 3.10.0)
105
- rspec-expectations (~> 3.10.0)
106
- rspec-mocks (~> 3.10.0)
107
- rspec-core (3.10.1)
108
- rspec-support (~> 3.10.0)
109
- rspec-expectations (3.10.1)
103
+ rspec (3.11.0)
104
+ rspec-core (~> 3.11.0)
105
+ rspec-expectations (~> 3.11.0)
106
+ rspec-mocks (~> 3.11.0)
107
+ rspec-core (3.11.0)
108
+ rspec-support (~> 3.11.0)
109
+ rspec-expectations (3.11.0)
110
110
  diff-lcs (>= 1.2.0, < 2.0)
111
- rspec-support (~> 3.10.0)
112
- rspec-mocks (3.10.2)
111
+ rspec-support (~> 3.11.0)
112
+ rspec-mocks (3.11.1)
113
113
  diff-lcs (>= 1.2.0, < 2.0)
114
- rspec-support (~> 3.10.0)
115
- rspec-support (3.10.2)
114
+ rspec-support (~> 3.11.0)
115
+ rspec-support (3.11.0)
116
116
  rubocop (0.93.1)
117
117
  parallel (~> 1.10)
118
118
  parser (>= 2.7.1.5)
@@ -143,7 +143,7 @@ GEM
143
143
  tzinfo (2.0.5)
144
144
  concurrent-ruby (~> 1.0)
145
145
  unicode-display_width (1.8.0)
146
- zeitwerk (2.5.1)
146
+ zeitwerk (2.6.0)
147
147
 
148
148
  PLATFORMS
149
149
  ruby
@@ -155,7 +155,7 @@ DEPENDENCIES
155
155
  guard-rspec
156
156
  pdf-inspector (~> 1.3.0)
157
157
  rake (= 13.0.6)
158
- rspec (= 3.10.0)
158
+ rspec (= 3.11.0)
159
159
  rubocop (~> 0.93.1)
160
160
  rubocop-performance (~> 1.10.2)
161
161
  rubocop-rspec (~> 1.44.1)
@@ -163,4 +163,4 @@ DEPENDENCIES
163
163
  simplecov-html (= 0.10.2)
164
164
 
165
165
  BUNDLED WITH
166
- 2.1.4
166
+ 2.3.21
data/README.md CHANGED
@@ -19,48 +19,50 @@ XML version | Supported?
19
19
 
20
20
  ## Installing
21
21
 
22
- gem install ruby_danfe
22
+ gem install br_danfe
23
23
 
24
24
  ## Usage
25
25
 
26
26
  ### DANFE - _Documento Auxiliar da Nota Fiscal Eletrônica_
27
27
  #### Usage in Ruby
28
28
 
29
- xml = File.read("nfe.xml")
29
+ xml = File.read("spec/fixtures/nfe/v2.00/nfe_simples_nacional.xml")
30
30
 
31
- danfe = BrDanfe::Danfe.new(xml)
32
- danfe.options.logo_path = "logo.png"
33
- danfe.save_pdf("nfe.pdf")
31
+ danfe = BrDanfe::Danfe.new(xml)
32
+ danfe.options.logo = "spec/fixtures/logo.png"
33
+ danfe.options.logo_dimensions = { width: 100, height: 100 }
34
+ danfe.save_pdf("output.pdf")
34
35
 
35
36
  #### Usage in Rails Controller
36
37
 
37
- class DanfeController < ApplicationController
38
- def new
39
- invoice = Invoice.find(params[:id])
40
- xml_as_string = invoice.generate_xml # your method that generates the NF-e's xml
38
+ class DanfeController < ApplicationController
39
+ def new
40
+ invoice = Invoice.find(params[:id])
41
+ xml_as_string = invoice.generate_xml # your method that generates the NF-e's xml
41
42
 
42
- danfe = BrDanfe::Danfe.new(xml_as_string)
43
+ danfe = BrDanfe::Danfe.new(xml_as_string)
43
44
 
44
- send_data danfe.render_pdf, filename: "danfe.pdf", type: "application/pdf"
45
- end
46
- end
45
+ send_data danfe.render_pdf, filename: "danfe.pdf", type: "application/pdf"
46
+ end
47
+ end
47
48
 
48
49
  #### Usage in Rails Controller with more than one xml
49
- class DanfeController < ApplicationController
50
- def new
51
- invoices = Invoice.where(ids: params[:ids])
52
- xmls_as_string = []
53
-
54
- invoices.each do |invoice|
55
- xmls_as_string << invoice.generate_xml # your method that generates the NF-e's xml
56
- end
57
-
58
- danfe = BrDanfe::Danfe.new(xmls_as_string)
59
-
60
- send_data danfe.render_pdf, filename: "danfe.pdf", type: "application/pdf"
61
- end
50
+
51
+ class DanfeController < ApplicationController
52
+ def new
53
+ invoices = Invoice.where(ids: params[:ids])
54
+ xmls_as_string = []
55
+
56
+ invoices.each do |invoice|
57
+ xmls_as_string << invoice.generate_xml # your method that generates the NF-e's xml
62
58
  end
63
59
 
60
+ danfe = BrDanfe::Danfe.new(xmls_as_string)
61
+
62
+ send_data danfe.render_pdf, filename: "danfe.pdf", type: "application/pdf"
63
+ end
64
+ end
65
+
64
66
  ### Options
65
67
 
66
68
  * `logo_path`: Path of sender's logo image.
@@ -70,45 +72,45 @@ XML version | Supported?
70
72
 
71
73
  #### Usage in Ruby
72
74
 
73
- xml = File.read("cce.xml")
75
+ xml = File.read("cce.xml")
74
76
 
75
- cce = BrDanfe::Cce.new(xml)
76
- cce.save_pdf("nfe.pdf")
77
+ cce = BrDanfe::Cce.new(xml)
78
+ cce.save_pdf("nfe.pdf")
77
79
 
78
80
  #### Usage in Rails Controller
79
81
 
80
- class CCeController < ApplicationController
81
- def new
82
- invoice = Invoice.find(params[:id])
83
- xml_as_string = invoice.generate_xml # your method that generates the CC-e's xml
82
+ class CCeController < ApplicationController
83
+ def new
84
+ invoice = Invoice.find(params[:id])
85
+ xml_as_string = invoice.generate_xml # your method that generates the CC-e's xml
84
86
 
85
- cce = BrDanfe::Cce.new(xml_as_string)
87
+ cce = BrDanfe::Cce.new(xml_as_string)
86
88
 
87
- send_data cce.render_pdf, filename: "cce.pdf", type: "application/pdf"
88
- end
89
- end
89
+ send_data cce.render_pdf, filename: "cce.pdf", type: "application/pdf"
90
+ end
91
+ end
90
92
 
91
93
  ### DAMDFE - _Documento Auxiliar do Manifesto Eletrônico de Documentos Fiscais_
92
94
 
93
95
  #### Usage in Ruby
94
96
 
95
- xml = File.read("mdfe.xml")
97
+ xml = File.read("mdfe.xml")
96
98
 
97
- mdfe = BrDanfe::Mdfe.new(xml)
98
- mdfe.save_pdf("mdfe.pdf")
99
+ mdfe = BrDanfe::Mdfe.new(xml)
100
+ mdfe.save_pdf("mdfe.pdf")
99
101
 
100
102
  #### Usage in Rails Controller
101
103
 
102
- class MdfeController < ApplicationController
103
- def new
104
- mdfe = Mdfe.find(params[:id])
105
- xml_as_string = mdfe.generate_xml # your method that generates the MDF-e's xml
104
+ class MdfeController < ApplicationController
105
+ def new
106
+ mdfe = Mdfe.find(params[:id])
107
+ xml_as_string = mdfe.generate_xml # your method that generates the MDF-e's xml
106
108
 
107
- mdfe = BrDanfe::Mdfe.new(xml_as_string)
109
+ mdfe = BrDanfe::Mdfe.new(xml_as_string)
108
110
 
109
- send_data mdfe.render_pdf, filename: "mdfe.pdf", type: "application/pdf"
110
- end
111
- end
111
+ send_data mdfe.render_pdf, filename: "mdfe.pdf", type: "application/pdf"
112
+ end
113
+ end
112
114
 
113
115
 
114
116
  ## I18n
@@ -121,23 +123,23 @@ If you need to customize some message or field label, you can override the conte
121
123
 
122
124
  You needs to build docker container like above:
123
125
 
124
- $ docker-compose build
126
+ $ docker-compose build
125
127
 
126
128
  You can run all RSpec specs using:
127
129
 
128
- $ docker-compose run --rm br_danfe rspec
130
+ $ docker-compose run --rm br_danfe rspec
129
131
 
130
132
 
131
133
  ## Development - Without Docker
132
134
 
133
135
  You needs to install all necessaries dependencies using bunder like above:
134
136
 
135
- $ bundle install
137
+ $ bundle install
136
138
 
137
139
 
138
140
  You can run all RSpec specs using:
139
141
 
140
- $ bundle exec rspec
142
+ $ bundle exec rspec
141
143
 
142
144
 
143
145
  ## About tests
data/br_danfe.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'guard-rspec'
30
30
  spec.add_development_dependency 'pdf-inspector', '~> 1.3.0'
31
31
  spec.add_development_dependency 'rake', '13.0.6'
32
- spec.add_development_dependency 'rspec', '3.10.0'
32
+ spec.add_development_dependency 'rspec', '3.11.0'
33
33
  spec.add_development_dependency 'rubocop', '~> 0.93.1'
34
34
  spec.add_development_dependency 'rubocop-performance', '~> 1.10.2'
35
35
  spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
@@ -1,3 +1,3 @@
1
1
  module BrDanfe
2
- VERSION = '0.17.5'.freeze
2
+ VERSION = '0.17.6'.freeze
3
3
  end
data/lib/br_danfe.rb CHANGED
@@ -11,7 +11,12 @@ require 'i18n'
11
11
  require 'br_documents'
12
12
 
13
13
  Dir["#{File.dirname(__FILE__)}/**/*.rb"].sort.each { |f| require f }
14
+
14
15
  I18n.load_path << File.expand_path('../config/locales/pt-BR.yml', __dir__)
16
+ I18n.available_locales = ['pt-BR']
17
+ I18n.default_locale = 'pt-BR'
18
+ I18n.enforce_available_locales = false
19
+
15
20
  Prawn::Font::AFM.hide_m17n_warning = true
16
21
 
17
22
  module BrDanfe
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: br_danfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.5
4
+ version: 0.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ASSEINFO
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-19 00:00:00.000000000 Z
11
+ date: 2022-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: barby
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - '='
186
186
  - !ruby/object:Gem::Version
187
- version: 3.10.0
187
+ version: 3.11.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '='
193
193
  - !ruby/object:Gem::Version
194
- version: 3.10.0
194
+ version: 3.11.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -262,7 +262,7 @@ dependencies:
262
262
  - - '='
263
263
  - !ruby/object:Gem::Version
264
264
  version: 0.10.2
265
- description:
265
+ description:
266
266
  email: asseinfo@asseinfo.com.br
267
267
  executables:
268
268
  - _guard-core
@@ -270,9 +270,9 @@ executables:
270
270
  extensions: []
271
271
  extra_rdoc_files: []
272
272
  files:
273
- - ".circleci/config.yml"
274
273
  - ".codeclimate.yml"
275
274
  - ".github/dependabot.yml"
275
+ - ".github/workflows/config.yml"
276
276
  - ".gitignore"
277
277
  - ".rspec"
278
278
  - ".rubocop.yml"
@@ -561,7 +561,7 @@ homepage: http://github.com/asseinfo/br_danfe
561
561
  licenses:
562
562
  - MIT
563
563
  metadata: {}
564
- post_install_message:
564
+ post_install_message:
565
565
  rdoc_options: []
566
566
  require_paths:
567
567
  - lib
@@ -576,8 +576,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
576
576
  - !ruby/object:Gem::Version
577
577
  version: '0'
578
578
  requirements: []
579
- rubygems_version: 3.1.6
580
- signing_key:
579
+ rubygems_version: 3.2.33
580
+ signing_key:
581
581
  specification_version: 4
582
582
  summary: DANFE pdf generator for Brazilian invoices.
583
583
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,54 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- docker:
5
- - image: circleci/ruby:2.7.4
6
- steps:
7
- - checkout
8
- - restore_cache:
9
- key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
10
- - run: bundle check || bundle install
11
- - save_cache:
12
- key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
13
- paths:
14
- - .
15
- - save_cache:
16
- key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
17
- paths:
18
- - ./vendor/bundle
19
- linter:
20
- docker:
21
- - image: circleci/ruby:2.7.4
22
- steps:
23
- - restore_cache:
24
- key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
25
- - restore_cache:
26
- key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
27
- - run: bundle exec rubocop --display-cop-names --parallel
28
- rspec:
29
- docker:
30
- - image: circleci/ruby:2.7.4
31
- steps:
32
- - restore_cache:
33
- key: brdanfe-cache-v2-{{ .Environment.CIRCLE_SHA1 }}
34
- - restore_cache:
35
- key: brdanfe-cache-v2-{{ checksum "Gemfile.lock" }}
36
- - run:
37
- name: Install Test Coverage for CodeClimate
38
- command: |
39
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
40
- chmod +x ./cc-test-reporter
41
- - run: ./cc-test-reporter before-build
42
- - run: bundle exec rspec
43
- - run: ./cc-test-reporter after-build --exit-code $?
44
- workflows:
45
- version: 2
46
- main:
47
- jobs:
48
- - build
49
- - linter:
50
- requires:
51
- - build
52
- - rspec:
53
- requires:
54
- - linter