Class: Glossarist::CLI

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

Defined Under Namespace

Classes: ExportCommand, 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



102
103
104
105
106
# File 'lib/glossarist/cli.rb', line 102

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)


112
113
114
# File 'lib/glossarist/cli.rb', line 112

def self.exit_on_failure?
  true
end

Instance Method Details

#export(path) ⇒ Object



97
98
99
100
# File 'lib/glossarist/cli.rb', line 97

def export(path)
  require_relative "cli/export_command"
  Glossarist::CLI::ExportCommand.new(path, options).run
end

#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



64
65
66
67
# File 'lib/glossarist/cli.rb', line 64

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

#respond_to_missing?Boolean

Returns:

  • (Boolean)


108
109
110
# File 'lib/glossarist/cli.rb', line 108

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



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

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