Sha256: f3759aa2459e06cff39273e215df8d4f8e43f4bccf60b203340e5de28fa1bc5f

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

module Rpub
  module Commands
    class Package < Base
      include CompilationHelpers

      identifier 'package'

      def invoke
        super
        Compile.new(options).invoke
        return unless config.has_key?('package_file')
        Compressor.open(config.fetch('package_file')) do |zip|
          zip.store_file create_book.filename, File.read(create_book.filename)
          config.fetch('package') { [] }.each do |file|
            zip.compress_file file, File.read(file)
          end
        end
      end

    private

      def parser
        OptionParser.new do |opts|
          opts.banner = <<-EOS
Usage: rpub package

Compile your ebook to an ePub file and package it into an archive together with
optional other files for easy distibution. You might want to include a README
file, a license or other promotion material.

Options:
EOS
          opts.separator ''
          opts.separator 'Generic options:'
          opts.separator ''

          opts.on_tail '-h', '--help', 'Display this message' do
            puts opts
            exit
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rpub-0.4.0 lib/rpub/commands/package.rb
rpub-0.3.0 lib/rpub/commands/package.rb
rpub-0.2.1 lib/rpub/commands/package.rb
rpub-0.2.0 lib/rpub/commands/package.rb
rpub-0.1.0 lib/rpub/commands/package.rb