Class: RSMP::Schema::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rsmp_schema/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

avoid Thor returnin 0 on failures, see github.com/coinbase/salus/pull/380/files

Returns:

  • (Boolean)


31
32
33
# File 'lib/rsmp_schema/cli.rb', line 31

def self.exit_on_failure?
  true
end

Instance Method Details

#convertObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rsmp_schema/cli.rb', line 9

def convert
  unless options[:in]
    puts "Error: Input option missing"
    exit
  end

  unless options[:out]
    puts "Error: Output option missing"
    exit
  end

  unless File.exist? options[:in]
    puts "Error: Input path file #{options[:in]} not found"
    exit
  end

  sxl = RSMP::Convert::Import::YAML.read options[:in]
  RSMP::Convert::Export::JSONSchema.write sxl, options[:out]
end