Sha256: 89e8659cd054fbf9d726c8c2969edcdcf38b06251348e07b235142a8b6b2d763

Contents?: true

Size: 812 Bytes

Versions: 20

Compression:

Stored size: 812 Bytes

Contents

module Softcover
  module Commands
    module EpubValidator
      extend Softcover::Utils
      extend self

      # Validates a book according to the EPUB standard.
      def validate!
        manifest = BookManifest.new(source: source)
        epub = path("ebooks/#{manifest.filename}.epub")
        if File.exist?(epub)
          puts "Validating EPUB..."
          system("#{java} -jar #{epubcheck} --locale en -w #{epub}")
        else
          puts "File '#{epub}' not found"
          puts "Run 'softcover build:epub' to generate"
          exit 1
        end
      end

      private

        def java
          @java ||= executable(dependency_filename(:java))
        end

        def epubcheck
          @epubcheck ||= executable(dependency_filename(:epubcheck)).inspect
        end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
softcover-1.10.4 lib/softcover/commands/epub_validator.rb
softcover-1.10.3 lib/softcover/commands/epub_validator.rb
softcover-1.10.2 lib/softcover/commands/epub_validator.rb
softcover-1.10.1 lib/softcover/commands/epub_validator.rb
softcover-1.10.0 lib/softcover/commands/epub_validator.rb
softcover-1.9.1 lib/softcover/commands/epub_validator.rb
softcover-1.9.0 lib/softcover/commands/epub_validator.rb
softcover-1.8.3 lib/softcover/commands/epub_validator.rb
softcover-1.8.2 lib/softcover/commands/epub_validator.rb
softcover-1.8.1 lib/softcover/commands/epub_validator.rb
softcover-1.8.0 lib/softcover/commands/epub_validator.rb
softcover-1.7.5 lib/softcover/commands/epub_validator.rb
softcover-1.7.4 lib/softcover/commands/epub_validator.rb
softcover-1.7.3 lib/softcover/commands/epub_validator.rb
softcover-1.7.2 lib/softcover/commands/epub_validator.rb
softcover-1.7.1 lib/softcover/commands/epub_validator.rb
softcover-1.7.0 lib/softcover/commands/epub_validator.rb
softcover-1.6.5 lib/softcover/commands/epub_validator.rb
softcover-1.6.4 lib/softcover/commands/epub_validator.rb
softcover-1.6.3 lib/softcover/commands/epub_validator.rb