Class: Bookbinder::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args) ⇒ Object



68
69
70
71
72
# File 'lib/bookbinder/cli.rb', line 68

def method_missing(command, *args)
  puts "Unknown command '#{command}'"
  puts ""
  help
end

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/bookbinder/cli.rb', line 10

def self.exit_on_failure?
  true
end

Instance Method Details

#bind(source) ⇒ Object

Raises:

  • (Thor::Error)


37
38
39
40
# File 'lib/bookbinder/cli.rb', line 37

def bind(source)
  code = legacy_commands.bind(source, options[:verbose], options['dita-flags'])
  raise Thor::Error, '' if code != 0
end

#generate(book_name) ⇒ Object

Raises:

  • (Thor::Error)


29
30
31
32
# File 'lib/bookbinder/cli.rb', line 29

def generate(book_name)
  code = legacy_commands.generate(book_name)
  raise Thor::Error, '' if code != 0
end

#helpObject



24
25
26
# File 'lib/bookbinder/cli.rb', line 24

def help
  super
end

#imprint(source) ⇒ Object

Raises:

  • (Thor::Error)


63
64
65
66
# File 'lib/bookbinder/cli.rb', line 63

def imprint(source)
  code = legacy_commands.imprint(source, options[:verbose], options['dita-flags'])
  raise Thor::Error, '' if code != 0
end

#punch(git_tag) ⇒ Object

Raises:

  • (Thor::Error)


43
44
45
46
# File 'lib/bookbinder/cli.rb', line 43

def punch(git_tag)
  code = legacy_commands.punch(git_tag)
  raise Thor::Error, '' if code != 0
end

#update_local_doc_reposObject

Raises:

  • (Thor::Error)


49
50
51
52
# File 'lib/bookbinder/cli.rb', line 49

def update_local_doc_repos
  code = legacy_commands.update_local_doc_repos
  raise Thor::Error, '' if code != 0
end

#versionObject



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

def version
  gemspec = File.expand_path('../../../bookbinder.gemspec', __FILE__)
  say "bookbinder #{Gem::Specification::load(gemspec).version}"
end

#watchObject

Raises:

  • (Thor::Error)


55
56
57
58
# File 'lib/bookbinder/cli.rb', line 55

def watch
  code = legacy_commands.watch
  raise Thor::Error, '' if code != 0
end