class Bookwatch::CLI

Attributes

legacy_commands[R]

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/bookwatch/cli.rb, line 10
def self.exit_on_failure?
  true
end
new(*) click to toggle source
Calls superclass method
# File lib/bookwatch/cli.rb, line 89
def initialize(*)
  super

  @legacy_commands = Bookwatch::Commands::Collection.new(colorized_streams, git)
end

Public Instance Methods

help(command=nil) click to toggle source
Calls superclass method
# File lib/bookwatch/cli.rb, line 24
def help(command=nil)
  super
end
method_missing(command, *args) click to toggle source

desc 'imprint <local|remote> [options]', 'DISABLED: Generate a PDF for a given book' option :verbose, type: :boolean option 'dita-flags', desc: '–dita-flags="<dita-option>=<value>"' def imprint(source)

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

end

# File lib/bookwatch/cli.rb, line 79
def method_missing(command, *args)
  puts "Unknown command '#{command}'"
  puts ""
  help
end
version() click to toggle source
# File lib/bookwatch/cli.rb, line 18
def version
  gemspec = File.expand_path('../../../bookwatch.gemspec', __FILE__)
  say "bookwatch #{Gem::Specification::load(gemspec).version}"
end
watch(*repos) click to toggle source
# File lib/bookwatch/cli.rb, line 64
def watch(*repos)
  code = legacy_commands.watch(repos)
  raise Thor::Error, '' if code != 0
end

Private Instance Methods

colorized_streams() click to toggle source
# File lib/bookwatch/cli.rb, line 99
def colorized_streams
  @streams ||= {
    err: Streams::ColorizedStream.new(Colorizer::Colors.red, $stderr),
    out: $stdout,
    success: Streams::ColorizedStream.new(Colorizer::Colors.green, $stdout),
    warn: Streams::ColorizedStream.new(Colorizer::Colors.yellow, $stdout),
  }
end
git() click to toggle source
# File lib/bookwatch/cli.rb, line 95
def git
  @git ||= Ingest::GitAccessor.new
end