Class: Rpub::Commands::Package

Inherits:
Base
  • Object
show all
Includes:
Rpub::CompilationHelpers
Defined in:
lib/rpub/commands/package.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods included from Rpub::CompilationHelpers

#concatenated_document, #config, #create_book, #layout, #markdown_files, #styles

Methods inherited from Base

#help, #initialize

Methods included from SubclassTracker

#each, #identifier, #inherited, #matching

Constructor Details

This class inherits a constructor from Rpub::Commands::Base

Instance Method Details

#invokeObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rpub/commands/package.rb', line 8

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