vectory 0.4.0 → 0.4.1

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: 2f51d610adc333c06f92e8e28ca9722a890f12b03668bf12e96ce057d2574dea
4
- data.tar.gz: 792bc815a0b86a6211b83268f16b9abe7a138aba0081a2d7a95242c5e9a7af82
3
+ metadata.gz: c3691d655d3fd1a29fc05a8efc5862bf6c401b2ea2e46a6cf3b6870a0088042a
4
+ data.tar.gz: a400645b7d70451dd894f9b8e68a44adc69cbd268739c1bdcc1dc096cef568af
5
5
  SHA512:
6
- metadata.gz: 249d3f2fa7df2d216cdf5d046647507b81a55bd5db56a603a90a3890501adb10e8a03f41b272385c65a8de48c50b8b52db743ec5ddc20be88e4e5aab6ed21ca6
7
- data.tar.gz: 5ed331050b3c4a3231cabc7ba061695f017de5ea44a3056bf01537144b12c96cf5587c0a52793d3d435d961052210aefed73a52c4afc9c3563695fca8e23c91d
6
+ metadata.gz: 5e3b018076e90a60d9a04bf0aea7d7c839f69edd013f087f432302089cbae06439df73adf813bb62c8a88e2c62cbec7253c385024866f8e341269bdc7661ebdb
7
+ data.tar.gz: 27a3e056f5bbf9b96ba3dda57aa2e68c7b1981b44049916ae39bbaa2055541a00388e17e006f72f6baff58d7748e50b180a65d1cc4aae8aa05b637cf90ebdff5
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in vectory.gemspec
6
6
  gemspec
7
7
 
8
+ gem "equivalent-xml", "~> 0.6"
9
+
8
10
  gem "rake", "~> 13.0"
9
11
 
10
12
  gem "rspec", "~> 3.0"
data/Rakefile CHANGED
@@ -5,10 +5,6 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :inkscape_version do
9
- system('inkscape --version')
10
- end
11
-
12
8
  task default: :spec
13
9
 
14
10
  # require "rubocop/rake_task"
data/exe/vectory ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "vectory/cli"
4
+
5
+ Vectory.ui.level = Logger::INFO
6
+
7
+ status_code = Vectory::CLI.start(ARGV)
8
+ exit status_code.is_a?(Integer) ? status_code : Vectory::CLI::STATUS_UNKNOWN_ERROR
@@ -23,8 +23,6 @@ module Vectory
23
23
  output_path = find_output(uri, output_extension)
24
24
  raise_conversion_error(call) unless output_path
25
25
 
26
- # and return Vectory::Utils::datauri(file)
27
-
28
26
  output_path
29
27
  end
30
28
 
data/lib/vectory/utils.rb CHANGED
@@ -1,58 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "marcel"
4
3
  require "timeout"
5
4
 
6
5
  module Vectory
7
6
  class Utils
8
- # Extracted from https://github.com/metanorma/metanorma-utils/blob/v1.5.2/lib/utils/image.rb
9
7
  class << self
10
- # sources/plantuml/plantuml20200524-90467-1iqek5i.png
11
- # already includes localdir
12
- # Check whether just the local path or the other specified relative path
13
- # works.
14
- def datauri(uri, local_dir = ".")
15
- return uri if datauri?(uri) || url?(uri)
16
-
17
- options = absolute_path?(uri) ? [uri] : [uri, File.join(local_dir, uri)]
18
- path = options.detect do |p|
19
- File.exist?(p) ? p : nil
20
- end
21
-
22
- unless path
23
- warn "Image specified at `#{uri}` does not exist."
24
- return uri # Return original provided location
25
- end
26
-
27
- encode_datauri(path)
28
- end
29
-
30
- def encode_datauri(path)
31
- return nil unless File.exist?(path)
32
-
33
- type = Marcel::MimeType.for(Pathname.new(path)) ||
34
- 'text/plain; charset="utf-8"'
35
-
36
- bin = File.binread(path)
37
- data = Base64.strict_encode64(bin)
38
- "data:#{type};base64,#{data}"
39
- rescue StandardError
40
- warn "Data-URI encoding of `#{path}` failed."
41
- nil
42
- end
43
-
44
- def datauri?(uri)
45
- /^data:/.match?(uri)
46
- end
47
-
48
- def url?(url)
49
- %r{^[A-Z]{2,}://}i.match?(url)
50
- end
51
-
52
- def absolute_path?(uri)
53
- %r{^/}.match?(uri) || %r{^[A-Z]:/}.match?(uri)
54
- end
55
-
56
8
  # rubocop:disable all
57
9
  #
58
10
  # Originally from https://gist.github.com/pasela/9392115
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vectory
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
@@ -1,4 +1,3 @@
1
- require "htmlentities"
2
1
  require "nokogiri"
3
2
  require "tmpdir"
4
3
 
data/vectory.gemspec CHANGED
@@ -24,10 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = ">= 2.5.0"
25
25
 
26
26
  spec.add_runtime_dependency "emf2svg"
27
+ spec.add_runtime_dependency "nokogiri", "~> 1.14"
27
28
  spec.add_runtime_dependency "thor", "~> 1.2.1"
28
- spec.add_runtime_dependency "marcel", "~> 1.0.0"
29
-
30
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
- spec.add_development_dependency "htmlentities", "~> 4.3.4"
32
- spec.add_development_dependency "nokogiri", "~> 1.14"
33
29
  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.4.0
4
+ version: 0.4.1
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-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emf2svg
@@ -25,75 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: thor
28
+ name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.1
33
+ version: '1.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.1
40
+ version: '1.14'
41
41
  - !ruby/object:Gem::Dependency
42
- name: marcel
42
+ name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: 1.2.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
55
- - !ruby/object:Gem::Dependency
56
- name: equivalent-xml
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.6'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.6'
69
- - !ruby/object:Gem::Dependency
70
- name: htmlentities
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 4.3.4
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 4.3.4
83
- - !ruby/object:Gem::Dependency
84
- name: nokogiri
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.14'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.14'
54
+ version: 1.2.1
97
55
  description: |
98
56
  Vectory performs pairwise vector image conversions for common
99
57
  vector image formats, such as SVG, EMF, EPS and PS.
@@ -113,7 +71,7 @@ files:
113
71
  - README.adoc
114
72
  - Rakefile
115
73
  - bin/vectory
116
- - emf.emf
74
+ - exe/vectory
117
75
  - lib/vectory.rb
118
76
  - lib/vectory/cli.rb
119
77
  - lib/vectory/datauri.rb
data/emf.emf DELETED
@@ -1 +0,0 @@
1
- AQAAAMgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAJAQAACgAAAACAAAALgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADAAIAAoADQAMAAzADUAYQA0AGYALAAgADIAMAAyADAALQAwADUALQAwADEAKQAgAAAAbwBkAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAJAQAAA==