This repository has been archived by the owner on Dec 28, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mike Cook
committed
Nov 17, 2011
1 parent
ebe54ba
commit 4ac7798
Showing
4 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
Dir["#{File.dirname(__FILE__)}/epub_validator/**/*"].each {|file| require(file)} | ||
|
||
require 'epub_validator/epub_check' | ||
require 'epub_validator/process_epub' | ||
|
||
module EpubValidator | ||
def self.check(filename) | ||
EpubCheck.process(filename) | ||
check = ProcessEpub.new | ||
check.epubcheck(filename) | ||
end | ||
end | ||
|
6 changes: 3 additions & 3 deletions
6
lib/epub_validator/epub_check.rb → lib/epub_validator/process_epub.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
module EpubValidator | ||
class EpubCheck | ||
def self.epubcheck(filename) | ||
class ProcessEpub | ||
def epubcheck(filename) | ||
epubcheck_jar = File.expand_path(File.dirname(__FILE__) + '/../epubcheck-1-2/epubcheck-1.2.jar') | ||
`java -jar #{epubcheck_jar} "#{epubfile}" 2>&1` | ||
`java -jar #{epubcheck_jar} "#{filename}" 2>&1` | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'spec_helper' | ||
|
||
module EpubValidator | ||
describe ProcessEpub do | ||
context "when it processes a file" do | ||
it "should return a message" do | ||
message = "Epubcheck Version 1.2\n\nERROR: rspec-test.epub: resource OEBPS/stylesheets/handbookish.css is missing\n\nCheck finished with warnings or errors!" | ||
ec = ProcessEpub.new | ||
ec.stub(:epubcheck).and_return(message) | ||
ec.epubcheck("test.epub").should eq(message) | ||
end | ||
end | ||
end | ||
end |