Sha256: 2452896ed0115eb4d4a8bbfcd13f47ac4899f87c2c551e2faa59b2365734d72c

Contents?: true

Size: 934 Bytes

Versions: 6

Compression:

Stored size: 934 Bytes

Contents

require 'gepub'
require 'optparse'

def usage
  STDERR.print "gepuber [-d destination ] <source-directory>\r\n"
  exit 1
end

def srccheck(srcdir)
  if !File.exist?(srcdir) || !File.directory?(srcdir) 
    STDERR.print "#{srcdir} is not a directory"
    exit 1
  end
  if !File.exist?(File.join(srcdir, 'gepuber.conf'))
    STDERR.print "gepuber.conf does not exists in#{srcdir}."
    exit 1
  end
end

def destcheck(destdir)
  if (File.exist?(destdir) && !File.directory?(destdir))
    STDERR.print "#{destdir} is not a directory\n"
    exit 1
  end
end

destbasedir = "."

opt = OptionParser.new

usage if ARGV.length < 1

opt.on('-d [directory]') { |dir|
  destbasedir = dir
}

destbasedir = File.expand_path(destbasedir)

srcdir = opt.parse(ARGV)[0]
srccheck(srcdir)

Dir.chdir(srcdir)
begin
  File.open('gepuber.conf', 'rb') {
    |io|
    gepuber = GEPUB::Gepuber.new(eval("#{io.read}"))
    gepuber.create destbasedir
  }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gepub-0.5.0 bin/gepuber
gepub-0.4.5 bin/gepuber
gepub-0.4.3 bin/gepuber
gepub-0.4.2 bin/gepuber
gepub-0.4.1 bin/gepuber
gepub-0.4.0 bin/gepuber