Class: Glossarist::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/glossarist/cli.rb,
lib/glossarist/cli/package_command.rb,
lib/glossarist/cli/upgrade_command.rb,
lib/glossarist/cli/validate_command.rb

Defined Under Namespace

Classes: PackageCommand, UpgradeCommand, ValidateCommand

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



79
80
81
82
83
# File 'lib/glossarist/cli.rb', line 79

def method_missing(*args)
  warn "No method found named: #{args[0]}"
  warn "Run with `--help` or `-h` to see available options"
  exit 1
end

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/glossarist/cli.rb', line 89

def self.exit_on_failure?
  true
end

Instance Method Details

#generate_latexObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/glossarist/cli.rb', line 17

def generate_latex
  assets = []

  if options[:extra_attributes]
    Glossarist.configure do |config|
      config.register_extension_attributes(options[:extra_attributes])
    end
  end

  concept_set = Glossarist::ConceptSet.new(options[:concepts_path], assets)
  latex_str = concept_set.to_latex(options[:latex_concepts])
  output_latex(latex_str)
end

#package(dir) ⇒ Object



60
61
62
63
# File 'lib/glossarist/cli.rb', line 60

def package(dir)
  require_relative "cli/package_command"
  Glossarist::CLI::PackageCommand.new(dir, options).run
end

#respond_to_missing?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/glossarist/cli.rb', line 85

def respond_to_missing?
  true
end

#upgrade(source_dir) ⇒ Object



40
41
42
43
# File 'lib/glossarist/cli.rb', line 40

def upgrade(source_dir)
  require_relative "cli/upgrade_command"
  Glossarist::CLI::UpgradeCommand.new(source_dir, options).run
end

#validate(path) ⇒ Object



74
75
76
77
# File 'lib/glossarist/cli.rb', line 74

def validate(path)
  require_relative "cli/validate_command"
  Glossarist::CLI::ValidateCommand.new(path, options).run
end