vectory 0.7.0 → 0.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff5471297e323f4b1bac83778ca6bd5f51b78459e919c0905c0b584b87942b49
4
- data.tar.gz: d4c5629914ba5ae8b0fc13781972b088359e9b71ea697a9d7a751f6b72c1128d
3
+ metadata.gz: 208113512c63f1549e160d037bf418c61ce1495cd4475fc517adaa8f962fe5e3
4
+ data.tar.gz: bbabf9cb905e9c08706d350e476feba0f8403becd943910bf704edcf80cc2a21
5
5
  SHA512:
6
- metadata.gz: 7b5bb40332285a833e1c2a8e4442617628c97d4cf334fe6216a518e88d3f822aeb8efd66907bed0cfbe3eb6e2bbbb036767b7ab70b58a1bf9ec959c96cc07bfc
7
- data.tar.gz: 53f4070802a2baad61650431a7e3b36da9296f17e0e26d586dd43ed3285b7b2bd82c320541142cca856683930f894cc3dc547eee775fc2bccb404ea198b54f93
6
+ metadata.gz: b7e5fd2ad0686242cc2c578e16f9456bf15fb95128e9ad26ee95a55cbee4a22edc06d4c8dc50a19f7c63954b2dff8ebfc99091a79e9099b8ac6aa4d574ab0b87
7
+ data.tar.gz: f25e2881b8d25b8ba3b9351fd7d613247e8489a9deeba557d9a3f259cb919b5e89beda150ae6069fc62d571d0acc55fd664456b6d9bfa935e254c033c749cb00
data/lib/vectory/cli.rb CHANGED
@@ -11,6 +11,7 @@ module Vectory
11
11
  STATUS_CONVERSION_ERROR = 4
12
12
  STATUS_SYSTEM_CALL_ERROR = 5
13
13
  STATUS_INKSCAPE_NOT_FOUND_ERROR = 6
14
+ STATUS_SAME_FORMAT_ERROR = 7
14
15
 
15
16
  MAP_ERROR_TO_STATUS = {
16
17
  Vectory::ConversionError => STATUS_CONVERSION_ERROR,
@@ -62,6 +63,10 @@ module Vectory
62
63
  end
63
64
 
64
65
  input_format = detect_input_format(file)
66
+ if same_format?(input_format, options[:format])
67
+ return same_format_error(options[:format])
68
+ end
69
+
65
70
  unless supported_input_format?(input_format)
66
71
  return unsupported_input_format_error
67
72
  end
@@ -93,6 +98,16 @@ module Vectory
93
98
  FileMagic.detect(file)
94
99
  end
95
100
 
101
+ def same_format?(input_format, output_format)
102
+ input_format.to_s == output_format
103
+ end
104
+
105
+ def same_format_error(format)
106
+ Vectory.ui.error("Could not convert to the same format '#{format}'.")
107
+
108
+ STATUS_SAME_FORMAT_ERROR
109
+ end
110
+
96
111
  def supported_input_format?(format)
97
112
  SupportedInputFormats.all.include?(format)
98
113
  end
data/lib/vectory/utils.rb CHANGED
@@ -19,7 +19,7 @@ module Vectory
19
19
  path = path_which_exist(uri, local_dir)
20
20
  path and return encode_datauri(path)
21
21
 
22
- warn "Image specified at `#{uri}` does not exist."
22
+ Vectory.ui.warn "Image specified at `#{uri}` does not exist."
23
23
  uri # Return original provided location
24
24
  end
25
25
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vectory
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  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.7.0
4
+ version: 0.7.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: 2024-01-17 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emf2svg