Sha256: a9c08621182a9df23ce37fb68b0f9eb4c5259315d1123f3b78ce8054de785594

Contents?: true

Size: 1.49 KB

Versions: 33

Compression:

Stored size: 1.49 KB

Contents

module Softcover
  module Commands
    module Build
      include Softcover::Output
      extend self

      # Builds the book for the given format.
      def for_format(format, options={})
        raise 'Invalid format' unless Softcover::FORMATS.include?(format)
        building_message(format.upcase, options)
        builder_for(format).build!(options)
        if format == 'html' && !(options[:silent] || options[:quiet])
          puts "LaTeX-to-XML debug information output to log/tralics.log"
        end
      end

      # Builds the book for all formats.
      def all_formats(options={})
        building_message('all formats', options)
        Softcover::BUILD_ALL_FORMATS.each do |format|
          if format == 'mobi'
            building_message('EPUB & MOBI', options)
          else
            building_message(format.upcase, options)
          end
          builder_for(format).build!(options)
        end
      end

      # Builds the book preview.
      def preview(options={})
        building_message('preview', options)
        builder_for('preview').build!
      end

      # Returns the builder for the given format.
      def builder_for(format)
        "Softcover::Builders::#{format.titleize}".constantize.new
      end

      private

        # Shows a message when building a particular format.
        def building_message(format, options={})
          unless options[:silent] || options[:'find-overfull']
            puts "Building #{format}..."
          end
        end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
softcover-0.8.9 lib/softcover/commands/build.rb
softcover-0.8.8 lib/softcover/commands/build.rb
softcover-0.8.7 lib/softcover/commands/build.rb
softcover-0.8.6 lib/softcover/commands/build.rb
softcover-0.8.5 lib/softcover/commands/build.rb
softcover-0.8.4 lib/softcover/commands/build.rb
softcover-0.8.3 lib/softcover/commands/build.rb
softcover-0.8.2 lib/softcover/commands/build.rb
softcover-0.8.1 lib/softcover/commands/build.rb
softcover-0.8.0 lib/softcover/commands/build.rb
softcover-0.7.11 lib/softcover/commands/build.rb
softcover-0.7.10 lib/softcover/commands/build.rb
softcover-0.7.9 lib/softcover/commands/build.rb
softcover-0.7.8 lib/softcover/commands/build.rb
softcover-0.7.7 lib/softcover/commands/build.rb
softcover-0.7.6 lib/softcover/commands/build.rb
softcover-0.7.5 lib/softcover/commands/build.rb
softcover-0.7.4 lib/softcover/commands/build.rb
softcover-0.7.3 lib/softcover/commands/build.rb
softcover-0.7.2 lib/softcover/commands/build.rb