Class: Xantora::CLI

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

Overview

Class responsible for the CLI logic based on thor

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/xantora/cli.rb', line 13

def self.exit_on_failure?
  true
end

Instance Method Details

#convert(source) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/xantora/cli.rb', line 38

def convert(source)
  if File.directory? source
    puts "[.] Scanning #{source} directory for .adoc files ..."
    Dir.glob(File.join(source, "/**/pages/*.adoc")) { |file| convert_document(file, options) }
  elsif source.end_with? ".adoc"
    convert_document(source, options)
  else
    puts "[error] No valid source detected."
    exit 1
  end
end

#versionObject



18
19
20
# File 'lib/xantora/cli.rb', line 18

def version
  puts "v#{Xantora::VERSION}"
end