-
Notifications
You must be signed in to change notification settings - Fork 1
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
David FRANCOIS
committed
Jul 4, 2010
1 parent
4139dad
commit 222e8f2
Showing
7 changed files
with
63 additions
and
8 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,3 +1,15 @@ | ||
= Documentalist | ||
Rails gem for easily managing documents, converting them from a format to another, | ||
and merging data into ODF templates. | ||
|
||
Rails gem for talking to OpenOffice and merging data into OpenDocument templates using an ERB-like syntax. | ||
= Checking for external dependencies | ||
Documentalist assembles various moving parts that are necessary to perform the actual | ||
conversions, you can run run the documentalist:backends:checks task to see if these | ||
dependencies are met on your system, if it isn't the case it will give you some tips | ||
on how to fix it. | ||
|
||
= Examples | ||
Documentalist.convert('/home/somefile.doc', :to => '/home/someotherfile.pdf') | ||
|
||
= Installation | ||
Require the gem in your Rails or Ruby application and you should be good to go ! |
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
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
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,11 @@ | ||
module Documentalist | ||
module WkHtmlToPdf | ||
include Documentalist::Dependencies | ||
|
||
depends_on_binaries! "wkhtmltopdf" => "install wkhtmltopdf package" | ||
|
||
def self.convert(file, options) | ||
system "wkhtmltopdf -q #{file} #{options[:to]}" | ||
end | ||
end | ||
end |
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
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,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<p> | ||
Test content | ||
</p> | ||
</body> | ||
</html> |
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,21 @@ | ||
require 'test_helper' | ||
|
||
class WkHtmlToPdfTest < Test::Unit::TestCase | ||
def test_right_backend_is_picked | ||
assert_equal Documentalist.backend_for_conversion("test.html", "test.pdf"), | ||
Documentalist::WkHtmlToPdf, | ||
"Wrong backend picked" | ||
end | ||
|
||
def test_conversion | ||
temp_file = File.join(Dir.tmpdir, "#{rand(10**9)}.pdf") | ||
|
||
Documentalist.convert(fixture_002, :to => temp_file) | ||
assert File.exists?(temp_file), "No converted PDF created" | ||
|
||
assert_match /Test content/, Documentalist.extract_text(temp_file) | ||
|
||
FileUtils.rm temp_file | ||
assert !File.exists?(temp_file), "We didn't clean up properly" | ||
end | ||
end |