facturx 1.0.0 → 1.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -1
- data/DOCUMENTATION.md +302 -0
- data/README.md +71 -89
- data/lib/facturx/attach.rb +4 -20
- data/lib/facturx/composers/ghostscript/runner.rb +19 -80
- data/lib/facturx/error.rb +6 -2
- data/lib/facturx/generate.rb +4 -4
- data/lib/facturx/pdf/composer.rb +32 -0
- data/lib/facturx/profile.rb +1 -1
- data/lib/facturx/profiles.rb +1 -8
- data/lib/facturx/schematron_adapter.rb +30 -0
- data/lib/facturx/source_reader.rb +1 -1
- data/lib/facturx/subprocess.rb +154 -0
- data/lib/facturx/validation.rb +61 -0
- data/lib/facturx/version.rb +1 -1
- data/lib/facturx/{conformance.rb → writer/tracker.rb} +53 -85
- data/lib/facturx/writer.rb +22 -14
- data/lib/facturx/xml/conformance_validator.rb +20 -0
- data/lib/facturx/xml/parser.rb +1 -1
- data/lib/facturx/xml/report_builder.rb +44 -0
- data/lib/facturx/xml/schema_registry.rb +22 -0
- data/lib/facturx/xml/schema_validator.rb +7 -2
- data/lib/facturx/xml/validator.rb +36 -0
- data/lib/facturx/xml/verifier.rb +17 -11
- data/lib/facturx.rb +18 -6
- data/rbi/facturx.rbi +702 -36
- metadata +11 -3
- data/lib/facturx/composers/ghostscript/output_capture.rb +0 -39
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: facturx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AdVitam
|
|
@@ -52,6 +52,7 @@ extensions: []
|
|
|
52
52
|
extra_rdoc_files: []
|
|
53
53
|
files:
|
|
54
54
|
- CHANGELOG.md
|
|
55
|
+
- DOCUMENTATION.md
|
|
55
56
|
- LICENSE.txt
|
|
56
57
|
- NOTICE.md
|
|
57
58
|
- README.md
|
|
@@ -65,10 +66,8 @@ files:
|
|
|
65
66
|
- lib/facturx/composers/ghostscript.rb
|
|
66
67
|
- lib/facturx/composers/ghostscript/defaults.rb
|
|
67
68
|
- lib/facturx/composers/ghostscript/locator.rb
|
|
68
|
-
- lib/facturx/composers/ghostscript/output_capture.rb
|
|
69
69
|
- lib/facturx/composers/ghostscript/runner.rb
|
|
70
70
|
- lib/facturx/composers/ghostscript/version_probe.rb
|
|
71
|
-
- lib/facturx/conformance.rb
|
|
72
71
|
- lib/facturx/diagnostic.rb
|
|
73
72
|
- lib/facturx/document.rb
|
|
74
73
|
- lib/facturx/embedding.rb
|
|
@@ -84,6 +83,7 @@ files:
|
|
|
84
83
|
- lib/facturx/model/payment.rb
|
|
85
84
|
- lib/facturx/model/reference.rb
|
|
86
85
|
- lib/facturx/model/trade.rb
|
|
86
|
+
- lib/facturx/pdf/composer.rb
|
|
87
87
|
- lib/facturx/pdf/document.rb
|
|
88
88
|
- lib/facturx/pdf/extractor.rb
|
|
89
89
|
- lib/facturx/pdf/inspector.rb
|
|
@@ -129,7 +129,9 @@ files:
|
|
|
129
129
|
- lib/facturx/schema/LICENSE-APACHE-2.0.txt
|
|
130
130
|
- lib/facturx/schema/NOTICE.md
|
|
131
131
|
- lib/facturx/schema/SHA256SUMS
|
|
132
|
+
- lib/facturx/schematron_adapter.rb
|
|
132
133
|
- lib/facturx/source_reader.rb
|
|
134
|
+
- lib/facturx/subprocess.rb
|
|
133
135
|
- lib/facturx/term.rb
|
|
134
136
|
- lib/facturx/terms.rb
|
|
135
137
|
- lib/facturx/terms/declaration.rb
|
|
@@ -145,6 +147,7 @@ files:
|
|
|
145
147
|
- lib/facturx/terms/declarations/taxes.rb
|
|
146
148
|
- lib/facturx/terms/declarations/totals.rb
|
|
147
149
|
- lib/facturx/terms/reference.rb
|
|
150
|
+
- lib/facturx/validation.rb
|
|
148
151
|
- lib/facturx/version.rb
|
|
149
152
|
- lib/facturx/writer.rb
|
|
150
153
|
- lib/facturx/writer/context.rb
|
|
@@ -169,10 +172,15 @@ files:
|
|
|
169
172
|
- lib/facturx/writer/stages/trade_settlement/payment.rb
|
|
170
173
|
- lib/facturx/writer/stages/trade_settlement/summary.rb
|
|
171
174
|
- lib/facturx/writer/stages/trade_settlement/taxes.rb
|
|
175
|
+
- lib/facturx/writer/tracker.rb
|
|
176
|
+
- lib/facturx/xml/conformance_validator.rb
|
|
172
177
|
- lib/facturx/xml/namespaces.rb
|
|
173
178
|
- lib/facturx/xml/parser.rb
|
|
174
179
|
- lib/facturx/xml/profile_detector.rb
|
|
180
|
+
- lib/facturx/xml/report_builder.rb
|
|
181
|
+
- lib/facturx/xml/schema_registry.rb
|
|
175
182
|
- lib/facturx/xml/schema_validator.rb
|
|
183
|
+
- lib/facturx/xml/validator.rb
|
|
176
184
|
- lib/facturx/xml/verifier.rb
|
|
177
185
|
- rbi/facturx.rbi
|
|
178
186
|
homepage: https://github.com/AdVitam/facturx
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Facturx
|
|
4
|
-
module Composers
|
|
5
|
-
class Ghostscript
|
|
6
|
-
class OutputCapture
|
|
7
|
-
TRUNCATION_MARKER = '...[truncated]'
|
|
8
|
-
|
|
9
|
-
def initialize(stream, limit:)
|
|
10
|
-
@stream = stream
|
|
11
|
-
@limit = limit
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def call
|
|
15
|
-
buffer = +''.b
|
|
16
|
-
truncated = false
|
|
17
|
-
while (chunk = @stream.read(4_096))
|
|
18
|
-
remaining = @limit - buffer.bytesize
|
|
19
|
-
buffer << chunk.byteslice(0, remaining) if remaining.positive?
|
|
20
|
-
truncated ||= chunk.bytesize > remaining
|
|
21
|
-
end
|
|
22
|
-
truncate(buffer, truncated)
|
|
23
|
-
rescue IOError
|
|
24
|
-
buffer
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
def truncate(buffer, truncated)
|
|
30
|
-
return buffer unless truncated
|
|
31
|
-
|
|
32
|
-
marker = TRUNCATION_MARKER.byteslice(0, @limit)
|
|
33
|
-
kept_bytes = [@limit - marker.bytesize, 0].max
|
|
34
|
-
buffer.byteslice(0, kept_bytes).to_s << marker
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|