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



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

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)


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

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


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

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)


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

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

#update_local_doc_reposObject

Raises:

  • (Thor::Error)


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

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)


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

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