documentalist 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +0 -2
- data/Rakefile +1 -1
- data/documentalist.gemspec +4 -4
- data/lib/backends/pdf_tools.rb +1 -1
- data/lib/documentalist.rb +25 -6
- data/test/documentalist_test.rb +8 -0
- metadata +4 -8
- data/lib/backends/open_office/bridges/jodconverter-2.2.2/ChangeLog.txt +0 -119
- data/lib/backends/open_office/bridges/jodconverter-2.2.2/docs/jodconverter-2.2.2-javadoc.jar +0 -0
data/Manifest
CHANGED
@@ -6,10 +6,8 @@ init.rb
|
|
6
6
|
lib/backends/net_pbm.rb
|
7
7
|
lib/backends/odf_merge.rb
|
8
8
|
lib/backends/open_office.rb
|
9
|
-
lib/backends/open_office/bridges/jodconverter-2.2.2/ChangeLog.txt
|
10
9
|
lib/backends/open_office/bridges/jodconverter-2.2.2/LICENSE.txt
|
11
10
|
lib/backends/open_office/bridges/jodconverter-2.2.2/README.txt
|
12
|
-
lib/backends/open_office/bridges/jodconverter-2.2.2/docs/jodconverter-2.2.2-javadoc.jar
|
13
11
|
lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-commons-io.txt
|
14
12
|
lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-openoffice.org.txt
|
15
13
|
lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-slf4j.txt
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake'
|
|
5
5
|
require 'echoe' rescue nil
|
6
6
|
|
7
7
|
if Object.const_defined? :Echoe
|
8
|
-
Echoe.new('documentalist', '0.1.
|
8
|
+
Echoe.new('documentalist', '0.1.3') do |p|
|
9
9
|
p.description = "The smooth document management experience, usable as a Rails gem plugin or standalone in any ruby application"
|
10
10
|
p.url = "http://github.com/davout/documentalist"
|
11
11
|
p.author = "David FRANCOIS"
|
data/documentalist.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{documentalist}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["David FRANCOIS"]
|
9
|
-
s.date = %q{2010-07-
|
9
|
+
s.date = %q{2010-07-05}
|
10
10
|
s.description = %q{The smooth document management experience, usable as a Rails gem plugin or standalone in any ruby application}
|
11
11
|
s.email = %q{david.francois@webflows.fr}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/backends/net_pbm.rb", "lib/backends/odf_merge.rb", "lib/backends/open_office.rb", "lib/backends/open_office/bridges/jodconverter-2.2.2/
|
13
|
-
s.files = ["README.rdoc", "Rakefile", "config/default.yml", "documentalist.gemspec", "init.rb", "lib/backends/net_pbm.rb", "lib/backends/odf_merge.rb", "lib/backends/open_office.rb", "lib/backends/open_office/bridges/jodconverter-2.2.2/
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/backends/net_pbm.rb", "lib/backends/odf_merge.rb", "lib/backends/open_office.rb", "lib/backends/open_office/bridges/jodconverter-2.2.2/LICENSE.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/README.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-commons-io.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-openoffice.org.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-slf4j.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-xstream.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/document-formats.xml", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/DEPENDENCIES.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/commons-cli-1.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/commons-io-1.4.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jodconverter-2.2.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/juh-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jurt-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/ridl-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/slf4j-api-1.5.6.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/slf4j-jdk14-1.5.6.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/unoil-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/xstream-1.3.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/src/jodconverter-2.2.2-sources.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/src/jodconverter-cli-2.2.2-sources.jar", "lib/backends/open_office/bridges/pyodconverter.py", "lib/backends/open_office/server.rb", "lib/backends/pdf_tools.rb", "lib/backends/wkhtmltopdf.rb", "lib/dependencies.rb", "lib/documentalist.rb", "lib/tasks/tasks.rb"]
|
13
|
+
s.files = ["README.rdoc", "Rakefile", "config/default.yml", "documentalist.gemspec", "init.rb", "lib/backends/net_pbm.rb", "lib/backends/odf_merge.rb", "lib/backends/open_office.rb", "lib/backends/open_office/bridges/jodconverter-2.2.2/LICENSE.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/README.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-commons-io.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-openoffice.org.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-slf4j.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-xstream.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/document-formats.xml", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/DEPENDENCIES.txt", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/commons-cli-1.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/commons-io-1.4.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jodconverter-2.2.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/juh-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/jurt-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/ridl-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/slf4j-api-1.5.6.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/slf4j-jdk14-1.5.6.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/unoil-3.0.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/lib/xstream-1.3.1.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/src/jodconverter-2.2.2-sources.jar", "lib/backends/open_office/bridges/jodconverter-2.2.2/src/jodconverter-cli-2.2.2-sources.jar", "lib/backends/open_office/bridges/pyodconverter.py", "lib/backends/open_office/server.rb", "lib/backends/pdf_tools.rb", "lib/backends/wkhtmltopdf.rb", "lib/dependencies.rb", "lib/documentalist.rb", "lib/tasks/tasks.rb", "rails/config/documentalist.yml.tpl", "rails/init.rb", "rails/initialize_configuration.rb", "test/documentalist_test.rb", "test/fixtures/fixture_001.odt", "test/fixtures/fixture_002.html", "test/net_pbm_test.rb", "test/odf_merge_test.rb", "test/open_office_test.rb", "test/pdf_tools_test.rb", "test/rails_integration_test.rb", "test/test_helper.rb", "test/wkhtmltopdf_test.rb", "Manifest"]
|
14
14
|
s.homepage = %q{http://github.com/davout/documentalist}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Documentalist", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
data/lib/backends/pdf_tools.rb
CHANGED
data/lib/documentalist.rb
CHANGED
@@ -51,15 +51,23 @@ module Documentalist
|
|
51
51
|
end
|
52
52
|
|
53
53
|
# Takes all conversion requests and dispatches them appropriately
|
54
|
-
def self.convert(file, options={})
|
55
|
-
|
54
|
+
def self.convert(file=nil, options={})
|
55
|
+
if options[:input] and options[:input_format] and file.nil?
|
56
|
+
file = File.join(Dir.tmpdir, "#{rand(10**9)}.#{options[:input_format].to_s}")
|
57
|
+
File.open(file, 'w') { |f| f.write(options[:input]) }
|
58
|
+
end
|
59
|
+
|
60
|
+
raise Documentalist::Error.new("#{file} does not exist !") unless File.exist?(file)
|
56
61
|
|
57
62
|
if options[:to_format]
|
58
63
|
options[:to] = file.gsub(/#{"\\" + File.extname(file)}$/, ".#{options[:to_format].to_s}")
|
59
64
|
elsif options[:to]
|
60
65
|
options[:to_format] = File.extname(options[:to]).gsub(/\./, "").to_sym
|
66
|
+
elsif options[:stream]
|
67
|
+
options[:to_format] = options[:stream]
|
68
|
+
options[:to] = File.join(Dir.tmpdir, "#{rand(10**9)}.#{options[:to_format]}")
|
61
69
|
else
|
62
|
-
raise Documentalist::Error.new("No destination or format was given")
|
70
|
+
raise Documentalist::Error.new("No destination, format, or stream format was given")
|
63
71
|
end
|
64
72
|
|
65
73
|
options[:from_format] = File.extname(file).gsub(/\./, "").to_sym
|
@@ -67,8 +75,19 @@ module Documentalist
|
|
67
75
|
backend = backend_for_conversion(options[:from_format], options[:to_format])
|
68
76
|
backend.convert(file, options)
|
69
77
|
|
70
|
-
|
71
|
-
|
78
|
+
if options[:input] and options[:input_format] and file.nil?
|
79
|
+
FileUtils.rm(file)
|
80
|
+
end
|
81
|
+
|
82
|
+
if options[:stream]
|
83
|
+
data = File.read(options[:to])
|
84
|
+
FileUtils.rm(options[:to])
|
85
|
+
yield(data) if block_given?
|
86
|
+
data
|
87
|
+
else
|
88
|
+
yield(options[:to]) if block_given?
|
89
|
+
options[:to]
|
90
|
+
end
|
72
91
|
end
|
73
92
|
|
74
93
|
def self.extract_text(file)
|
@@ -128,7 +147,7 @@ module Documentalist
|
|
128
147
|
|
129
148
|
# Returns the logger object used to log documentalist operations
|
130
149
|
def self.logger
|
131
|
-
unless @@logger
|
150
|
+
unless @@logger
|
132
151
|
Documentalist.config[:log_file] ||= File.join(File.dirname(File.expand_path(__FILE__)), %w{.. documentalist.log})
|
133
152
|
@@logger = Logger.new(Documentalist.config[:log_file])
|
134
153
|
@@logger.level = Logger.const_get(config[:log_level] ? config[:log_level].upcase : "WARN")
|
data/test/documentalist_test.rb
CHANGED
@@ -74,4 +74,12 @@ class DocumentalistTest < Test::Unit::TestCase
|
|
74
74
|
Documentalist.extract_text(fixture_001),
|
75
75
|
"Text was not properly extracted for fixture 001"
|
76
76
|
end
|
77
|
+
|
78
|
+
def test_extract_stream
|
79
|
+
returned_data = Documentalist.convert(fixture_001, :stream => :txt) do |data|
|
80
|
+
assert_match /thing/, data, "Converted data wasn't streamed properly"
|
81
|
+
end
|
82
|
+
|
83
|
+
assert_match /thing/, returned_data, "Converted data wasn't streamed properly"
|
84
|
+
end
|
77
85
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: documentalist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David FRANCOIS
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-05 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -76,10 +76,8 @@ extra_rdoc_files:
|
|
76
76
|
- lib/backends/net_pbm.rb
|
77
77
|
- lib/backends/odf_merge.rb
|
78
78
|
- lib/backends/open_office.rb
|
79
|
-
- lib/backends/open_office/bridges/jodconverter-2.2.2/ChangeLog.txt
|
80
79
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/LICENSE.txt
|
81
80
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/README.txt
|
82
|
-
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/jodconverter-2.2.2-javadoc.jar
|
83
81
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-commons-io.txt
|
84
82
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-openoffice.org.txt
|
85
83
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-slf4j.txt
|
@@ -115,10 +113,8 @@ files:
|
|
115
113
|
- lib/backends/net_pbm.rb
|
116
114
|
- lib/backends/odf_merge.rb
|
117
115
|
- lib/backends/open_office.rb
|
118
|
-
- lib/backends/open_office/bridges/jodconverter-2.2.2/ChangeLog.txt
|
119
116
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/LICENSE.txt
|
120
117
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/README.txt
|
121
|
-
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/jodconverter-2.2.2-javadoc.jar
|
122
118
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-commons-io.txt
|
123
119
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-openoffice.org.txt
|
124
120
|
- lib/backends/open_office/bridges/jodconverter-2.2.2/docs/third-party-licenses/license-slf4j.txt
|
@@ -1,119 +0,0 @@
|
|
1
|
-
JODConverter 2.2.2
|
2
|
-
------------------
|
3
|
-
|
4
|
-
* added docx, xlsx, and pptx (supported by OOo since v3.0) to default formats
|
5
|
-
|
6
|
-
* updated plain text format to use UTF8,CRLF as default options
|
7
|
-
|
8
|
-
* added switch to pass a custom xml document format registry file to the command line tool
|
9
|
-
|
10
|
-
JODConverter 2.2.1
|
11
|
-
------------------
|
12
|
-
|
13
|
-
** Improvement
|
14
|
-
* [JODC-12] - Provide more detailed 'conversion failed' error messages
|
15
|
-
* [JODC-24] - Add MediaWiki wikitext format
|
16
|
-
* [JODC-25] - Add configurable outputDir to Maven plugin
|
17
|
-
* [JODC-26] - Expose low level OOo services as public in OOoConnection
|
18
|
-
|
19
|
-
** New Feature
|
20
|
-
* [JODC-6] - Maven plugin
|
21
|
-
* [JODC-27] - Add utility methods to retrieve OOo version and locale at runtime
|
22
|
-
|
23
|
-
JODConverter 2.2.0
|
24
|
-
------------------
|
25
|
-
|
26
|
-
** Bug
|
27
|
-
* [JODC-14] - Incorrect Excel mime-type
|
28
|
-
* [JODC-16] - Failure when converting from .txt files with different line endings
|
29
|
-
* [JODC-18] - File extension should be treated as case insensitive
|
30
|
-
|
31
|
-
** Improvement
|
32
|
-
* [JODC-5] - Add macro execution options
|
33
|
-
* [JODC-10] - Make XStream dependency optional
|
34
|
-
* [JODC-11] - Replace commons-logging with slf4j
|
35
|
-
* [JODC-17] - Add CSV to default formats
|
36
|
-
* [JODC-19] - Revise DocumentFormat exportOptions API
|
37
|
-
* [JODC-20] - Make document formats easily customisable in webapp
|
38
|
-
* [JODC-22] - Add DocumentFamily.DRAWING
|
39
|
-
|
40
|
-
** New Feature
|
41
|
-
* [JODC-9] - IKVM compatibility to build as a .NET DLL
|
42
|
-
* [JODC-13] - Add support for converting multiple files at once in ConvertDocument command line tool
|
43
|
-
|
44
|
-
** Task
|
45
|
-
* [JODC-21] - Split CLI into separate module
|
46
|
-
|
47
|
-
JODConverter 2.1.1
|
48
|
-
-------------------
|
49
|
-
|
50
|
-
* renamed project to JODConverter
|
51
|
-
|
52
|
-
* renamed packages from net.sf.jooreports to com.artofsolving.jodconverter
|
53
|
-
|
54
|
-
* updated OpenOffice.org JARs to 2.1.0
|
55
|
-
|
56
|
-
JOOConverter 2.1.0
|
57
|
-
-------------------
|
58
|
-
|
59
|
-
* added support for custom export options (e.g. Image Quality for PDFs)
|
60
|
-
|
61
|
-
* HTML as an input format is now enabled by default
|
62
|
-
|
63
|
-
* fixed a rare pagination bug when exporting to PDF a document with fields
|
64
|
-
|
65
|
-
* many internal code improvements: switched to Maven2-based build process
|
66
|
-
and directory layout, improved unit test coverage, refactorings
|
67
|
-
|
68
|
-
JOOConverter 2.1rc2
|
69
|
-
-------------------
|
70
|
-
|
71
|
-
* file-based conversions are the default again; stream-based conversions
|
72
|
-
introduced in 2.1rc1 proved to be frequently slower so they are still
|
73
|
-
available but as an option (using StreamOpenOfficeDocumentConverter)
|
74
|
-
|
75
|
-
* made the webapp settings configurable using Spring and XML
|
76
|
-
|
77
|
-
* added a sample C#.net web service client to the online guide
|
78
|
-
|
79
|
-
JOOConverter 2.1rc1
|
80
|
-
-------------------
|
81
|
-
|
82
|
-
* now all conversions pass UNO streams instead of files to OpenOffice.org
|
83
|
-
- no need to use temporary files anymore
|
84
|
-
- works with an OOo service running as a different user
|
85
|
-
- works with an OOo service running on a different machine
|
86
|
-
|
87
|
-
* added servlet that can be invoked as a simple "web service" by remote clients
|
88
|
-
|
89
|
-
* added WordPerfect as a supported input format (thanks to Derek Hulley of Alfresco)
|
90
|
-
|
91
|
-
* added isConnected() method to OpenOfficeConnection
|
92
|
-
|
93
|
-
JOOConverter 2.0.0
|
94
|
-
------------------
|
95
|
-
|
96
|
-
* added default constructor to DocumentFormat to prevent error with XStream on some JVMs
|
97
|
-
|
98
|
-
* compiled and tested with Java 1.3 (was 1.4)
|
99
|
-
|
100
|
-
* replaced custom IO code with Jakarta Commons IO
|
101
|
-
|
102
|
-
* updated third-party libraries to their latest available versions
|
103
|
-
|
104
|
-
|
105
|
-
JOOConverter 2.0rc2
|
106
|
-
-------------------
|
107
|
-
|
108
|
-
Due to popular demand JOOConverter, while still being part of JOOReports, is now
|
109
|
-
released as a standalone project (as it was already the case with the 1.0 series).
|
110
|
-
|
111
|
-
Changes compared to the version included in JOOReports 2.0rc1
|
112
|
-
|
113
|
-
* added the converter web application
|
114
|
-
|
115
|
-
* made jar file executable with ConvertDocument as main class
|
116
|
-
|
117
|
-
* added (but unsupported) HTML and XHTML export formats
|
118
|
-
|
119
|
-
* minor bug fixes
|