Class: Burr::Cli

Inherits:
Thor show all
Defined in:
lib/burr/cli.rb

Instance Method Summary collapse

Instance Method Details

#export(format) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/burr/cli.rb', line 12

def export(format)
  valid = %w(site pdf epub mobi all)

  if valid.include?(format)
    book = Burr::Book.new(config, format)
    case format
    when 'site'
      book.export_site
    when 'pdf'
      unless Dependency.prince_installed?
        book.ui.warn "Please install PrinceXML first."
        exit 1
      end
      book.export_pdf
    when 'epub'
      book.export_epub
    when 'mobi'
      unless Dependency.kindlegen_installed?
        book.ui.warn "Please install kindelgen first."
        exit 1
      end
      book.export_mobi
    when 'all'
      puts 'pending'
      # book.export_all
    end
  else
    raise "ERROR: invalid format. Formats: #{valid.join(', ')}."
  end
end

#new(path) ⇒ Object



5
6
7
8
9
# File 'lib/burr/cli.rb', line 5

def new(path)
  generator = Burr::Generator.new
  generator.destination_root = path
  generator.invoke_all
end

#serverObject



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

def server
  Burr::Server.start!
end

#versionObject



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

def version
  puts Burr::Version::STRING
end