vectory 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/README.adoc +167 -0
  4. data/lib/vectory/datauri.rb +13 -0
  5. data/lib/vectory/image.rb +4 -0
  6. data/lib/vectory/inkscape_converter.rb +82 -11
  7. data/lib/vectory/svg.rb +84 -1
  8. data/lib/vectory/svg_mapping.rb +118 -0
  9. data/lib/vectory/system_call.rb +10 -2
  10. data/lib/vectory/utils.rb +111 -0
  11. data/lib/vectory/vector.rb +25 -2
  12. data/lib/vectory/version.rb +1 -1
  13. data/lib/vectory.rb +3 -0
  14. data/spec/examples/svg/action_schemaexpg1.svg +124 -0
  15. data/spec/examples/svg/action_schemaexpg2.svg +124 -0
  16. data/spec/examples/svg/doc-ref.xml +109 -0
  17. data/spec/examples/svg/doc.xml +51 -0
  18. data/spec/examples/svg/doc2-ref.xml +59 -0
  19. data/spec/examples/svg/doc2.xml +28 -0
  20. data/spec/support/matchers.rb +12 -0
  21. data/spec/support/vectory_helper.rb +14 -0
  22. data/spec/vectory/cli_spec.rb +15 -14
  23. data/spec/vectory/datauri_spec.rb +80 -0
  24. data/spec/vectory/emf_spec.rb +27 -3
  25. data/spec/vectory/eps_spec.rb +36 -9
  26. data/spec/vectory/file_magic_spec.rb +3 -3
  27. data/spec/vectory/inkscape_converter_spec.rb +11 -6
  28. data/spec/vectory/ps_spec.rb +28 -3
  29. data/spec/vectory/svg_mapping_spec.rb +42 -0
  30. data/spec/vectory/svg_spec.rb +43 -3
  31. data/spec/vectory/vector_spec.rb +37 -0
  32. data/vectory.gemspec +0 -4
  33. metadata +22 -70
  34. /data/spec/examples/emf2eps/{img.eps → ref.eps} +0 -0
  35. /data/spec/examples/emf2ps/{img.ps → ref.ps} +0 -0
  36. /data/spec/examples/emf2svg/{img.svg → ref.svg} +0 -0
  37. /data/spec/examples/eps2emf/{img.emf → ref.emf} +0 -0
  38. /data/spec/examples/eps2ps/{img.ps → ref.ps} +0 -0
  39. /data/spec/examples/eps2svg/{img.svg → ref.svg} +0 -0
  40. /data/spec/examples/ps2emf/{img.emf → ref.emf} +0 -0
  41. /data/spec/examples/ps2eps/{img.eps → ref.eps} +0 -0
  42. /data/spec/examples/ps2svg/{img.svg → ref.svg} +0 -0
  43. /data/spec/examples/svg2emf/{img.emf → ref.emf} +0 -0
  44. /data/spec/examples/svg2eps/{img.eps → ref.eps} +0 -0
  45. /data/spec/examples/svg2ps/{img.ps → ref.ps} +0 -0
@@ -56,5 +56,42 @@ RSpec.describe Vectory::Vector do
56
56
  expect { image.path }.to raise_error(Vectory::NotWrittenToDiskError)
57
57
  end
58
58
  end
59
+
60
+ context "written to disk" do
61
+ before { image.write }
62
+
63
+ it "returns path on a disk" do
64
+ expect(image.path).to include(Dir.tmpdir)
65
+ end
66
+ end
67
+ end
68
+
69
+ describe "#size" do
70
+ let(:image) { Vectory::Emf.from_path("spec/examples/emf2svg/img.emf") }
71
+
72
+ it "returns content size" do
73
+ expect(image.size).to eq 1060
74
+ end
75
+ end
76
+
77
+ describe "#file_size" do
78
+ let(:image) { Vectory::Eps.from_path("spec/examples/eps2emf/img.eps") }
79
+
80
+ context "not written to disk" do
81
+ it "raises not-written error" do
82
+ expect { image.file_size }
83
+ .to raise_error(Vectory::NotWrittenToDiskError)
84
+ end
85
+ end
86
+
87
+ context "written to disk" do
88
+ before { image.write }
89
+
90
+ it "returns file size" do
91
+ expect(image.file_size).to satisfy("be either 2926 or 3125") do |v|
92
+ [2926, 3125].include?(v) # depends on file system
93
+ end
94
+ end
95
+ end
59
96
  end
60
97
  end
data/vectory.gemspec CHANGED
@@ -30,8 +30,4 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
31
  spec.add_development_dependency "htmlentities", "~> 4.3.4"
32
32
  spec.add_development_dependency "nokogiri", "~> 1.14"
33
- spec.add_development_dependency "rspec", "~> 3.0"
34
- spec.add_development_dependency "rubocop", "~> 1.22.1"
35
- spec.add_development_dependency "rubocop-rails", "~> 2.9"
36
- spec.add_development_dependency "rubocop-performance", "~> 1.10"
37
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vectory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-16 00:00:00.000000000 Z
11
+ date: 2023-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emf2svg
@@ -94,62 +94,6 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.14'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 1.22.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 1.22.1
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rails
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '2.9'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '2.9'
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop-performance
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.10'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '1.10'
153
97
  description: |
154
98
  Vectory performs pairwise vector image conversions for common
155
99
  vector image formats, such as SVG, EMF, EPS and PS.
@@ -180,40 +124,47 @@ files:
180
124
  - lib/vectory/inkscape_converter.rb
181
125
  - lib/vectory/ps.rb
182
126
  - lib/vectory/svg.rb
127
+ - lib/vectory/svg_mapping.rb
183
128
  - lib/vectory/system_call.rb
184
129
  - lib/vectory/utils.rb
185
130
  - lib/vectory/vector.rb
186
131
  - lib/vectory/version.rb
187
132
  - spec/examples/emf2eps/img.emf
188
133
  - spec/examples/emf2eps/img.emf.datauri
189
- - spec/examples/emf2eps/img.eps
134
+ - spec/examples/emf2eps/ref.eps
190
135
  - spec/examples/emf2ps/img.emf
191
- - spec/examples/emf2ps/img.ps
136
+ - spec/examples/emf2ps/ref.ps
192
137
  - spec/examples/emf2svg/img.emf
193
- - spec/examples/emf2svg/img.svg
194
- - spec/examples/eps2emf/img.emf
138
+ - spec/examples/emf2svg/ref.svg
195
139
  - spec/examples/eps2emf/img.eps
196
140
  - spec/examples/eps2emf/img.eps.datauri
141
+ - spec/examples/eps2emf/ref.emf
197
142
  - spec/examples/eps2ps/img.eps
198
- - spec/examples/eps2ps/img.ps
143
+ - spec/examples/eps2ps/ref.ps
199
144
  - spec/examples/eps2svg/img.eps
200
- - spec/examples/eps2svg/img.svg
145
+ - spec/examples/eps2svg/ref.svg
201
146
  - spec/examples/eps_but_svg_extension.svg
202
147
  - spec/examples/img.jpg
203
- - spec/examples/ps2emf/img.emf
204
148
  - spec/examples/ps2emf/img.ps
205
149
  - spec/examples/ps2emf/img.ps.datauri
206
- - spec/examples/ps2eps/img.eps
150
+ - spec/examples/ps2emf/ref.emf
207
151
  - spec/examples/ps2eps/img.ps
152
+ - spec/examples/ps2eps/ref.eps
208
153
  - spec/examples/ps2svg/img.ps
209
- - spec/examples/ps2svg/img.svg
210
- - spec/examples/svg2emf/img.emf
154
+ - spec/examples/ps2svg/ref.svg
155
+ - spec/examples/svg/action_schemaexpg1.svg
156
+ - spec/examples/svg/action_schemaexpg2.svg
157
+ - spec/examples/svg/doc-ref.xml
158
+ - spec/examples/svg/doc.xml
159
+ - spec/examples/svg/doc2-ref.xml
160
+ - spec/examples/svg/doc2.xml
211
161
  - spec/examples/svg2emf/img.svg
212
162
  - spec/examples/svg2emf/img.svg.datauri
213
- - spec/examples/svg2eps/img.eps
163
+ - spec/examples/svg2emf/ref.emf
214
164
  - spec/examples/svg2eps/img.svg
215
- - spec/examples/svg2ps/img.ps
165
+ - spec/examples/svg2eps/ref.eps
216
166
  - spec/examples/svg2ps/img.svg
167
+ - spec/examples/svg2ps/ref.ps
217
168
  - spec/spec_helper.rb
218
169
  - spec/support/matchers.rb
219
170
  - spec/support/text_matcher.rb
@@ -225,6 +176,7 @@ files:
225
176
  - spec/vectory/file_magic_spec.rb
226
177
  - spec/vectory/inkscape_converter_spec.rb
227
178
  - spec/vectory/ps_spec.rb
179
+ - spec/vectory/svg_mapping_spec.rb
228
180
  - spec/vectory/svg_spec.rb
229
181
  - spec/vectory/vector_spec.rb
230
182
  - spec/vectory_spec.rb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes