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



75
76
77
78
79
# File 'lib/bookbinder/cli.rb', line 75

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)


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

def bind(source)
  code = legacy_commands.bind(source, options[:verbose], options['dita-flags'], options[:require_valid_subnav_links])
  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

#help(command = nil) ⇒ Object



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

def help(command=nil)
  super
end

#imprint(source) ⇒ Object

Raises:

  • (Thor::Error)


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

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)


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

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

#update_local_doc_reposObject

Raises:

  • (Thor::Error)


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

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

#watch(*repos) ⇒ Object

Raises:

  • (Thor::Error)


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

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