Class: Glossarist::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/glossarist/cli.rb,
lib/glossarist/cli/export_command.rb,
lib/glossarist/cli/import_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, ImportCommand, 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



123
124
125
126
127
# File 'lib/glossarist/cli.rb', line 123

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)


133
134
135
# File 'lib/glossarist/cli.rb', line 133

def self.exit_on_failure?
  true
end

Instance Method Details

#export(path) ⇒ Object



119
120
121
# File 'lib/glossarist/cli.rb', line 119

def export(path)
  CLI::ExportCommand.new(path, options).run
end

#generate_latexObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/glossarist/cli.rb', line 22

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

#import(*files) ⇒ Object



101
102
103
# File 'lib/glossarist/cli.rb', line 101

def import(*files)
  CLI::ImportCommand.new(files, options).run
end

#package(dir) ⇒ Object



68
69
70
# File 'lib/glossarist/cli.rb', line 68

def package(dir)
  CLI::PackageCommand.new(dir, options).run
end

#respond_to_missing?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/glossarist/cli.rb', line 129

def respond_to_missing?
  true
end

#upgrade(source_dir) ⇒ Object



45
46
47
# File 'lib/glossarist/cli.rb', line 45

def upgrade(source_dir)
  CLI::UpgradeCommand.new(source_dir, options).run
end

#validate(path) ⇒ Object



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

def validate(path)
  CLI::ValidateCommand.new(path, options).run
end