Class: Vectory::CLI
- Inherits:
-
Thor
show all
- Defined in:
- lib/vectory/cli.rb
Defined Under Namespace
Modules: SupportedInputFormats, SupportedOutputFormats
Constant Summary
collapse
- STATUS_SUCCESS =
0
- STATUS_UNKNOWN_ERROR =
1
- STATUS_UNSUPPORTED_INPUT_FORMAT_ERROR =
2
- STATUS_UNSUPPORTED_OUTPUT_FORMAT_ERROR =
3
- STATUS_CONVERSION_ERROR =
4
- STATUS_SYSTEM_CALL_ERROR =
5
- STATUS_INKSCAPE_NOT_FOUND_ERROR =
6
- STATUS_SAME_FORMAT_ERROR =
7
- MAP_ERROR_TO_STATUS =
{
Vectory::ConversionError => STATUS_CONVERSION_ERROR,
Vectory::InkscapeNotFoundError => STATUS_INKSCAPE_NOT_FOUND_ERROR,
Vectory::SystemCallError => STATUS_SYSTEM_CALL_ERROR,
}.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
44
45
46
|
# File 'lib/vectory/cli.rb', line 44
def self.exit_on_failure?
false
end
|
Instance Method Details
#convert(file) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/vectory/cli.rb', line 60
def convert(file)
unless supported_format?(options[:format])
return unsupported_format_error(options[:format])
end
input_format = detect_input_format(file)
if same_format?(input_format, options[:format])
return same_format_error(options[:format])
end
unless supported_input_format?(input_format)
return unsupported_input_format_error
end
object = source_object(file, input_format)
convert_to_format(object, options)
end
|