Sha256: deb8ea658999632bfd7fb814be1c743e27eabc27a748f5ee0a9bf9d8707551ae

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

require 'English'
require 'optparse'
require 'irb'
require 'epub/parser'

shell = IRB

OptionParser.new {|opt|
  opt.banner = <<EOB
Open EPUB file in IRB

Usage: #{File.basename($PROGRAM_NAME)} EPUBFILE

EOB
  opt.on '--pry', 'Use Pry instead of IRB as shell' do
    require 'pry'
    shell = Pry
  end
}.parse!

$0 = File.basename($PROGRAM_NAME)
include EPUB::Book::Features
file = ARGV.shift
EPUB::OCF::PhysicalContainer.adapter = :File if File.directory? file
unless File.readable? file
  uri = URI.parse(file) rescue nil
  if uri
    EPUB::OCF::PhysicalContainer.adapter = :UnpackedURI
    file = uri
  end
end
EPUB::Parser.parse(file, :book => self)
$stderr.puts "Enter \"exit\" to exit #{shell}"
shell.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
epub-parser-0.2.2 bin/epub-open
epub-parser-0.2.1 bin/epub-open