odf-report 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/README.textile +16 -18
- data/lib/odf-report/file.rb +5 -2
- data/lib/odf-report/report.rb +1 -1
- data/lib/odf-report/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzhiYWE2MTU5OTRjZWQ2NGExZDc1ZDRjMGUzM2ZlZWU1ZWY4ZWUwNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTBkNGEzZjE1NmNkMjc3MTdiNjdmNjZhMDI4ZjAzYjg5NTU0NjJjZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjU1YzA0ZjY5YmRlMmJhZTE4YmM0NjY5MDQ0MDkyNGFlYjU1MGYzOTM1NTk0
|
10
|
+
Y2IyODBlMmEwNWRiODgzZmViMDI1MGE1MmJhODUxYzc3MWY4NDdlNzZmYTEw
|
11
|
+
YzVmZDA5NDIwNTVlYTRjMTQ0YTM1ZTQ0N2JkOTE4MDIyYThkOTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDNlY2U4ZTU2NTUxZTYzYTZlMWZkN2YxYjI1YTE0YTFlODBmMzFiOTdmMThk
|
14
|
+
YzYyMWQwN2QzZDcxZDhmZjE3ZmQ1ZjFhY2E0NTY5MzcxM2M4NWE3NmEzZTBk
|
15
|
+
ZTI1MjI2OGJmZGMzZGIzYTcwZDYxNjYzYzYyYTgzYjhkNDFmNDc=
|
data/.gitignore
CHANGED
data/README.textile
CHANGED
@@ -2,9 +2,17 @@ h1. ODF-REPORT
|
|
2
2
|
|
3
3
|
Gem for generating .odt files by making strings, images, tables and sections replacements in a previously created .odt file.
|
4
4
|
|
5
|
+
h3. NEW
|
6
|
+
|
7
|
+
* as per popular request, now uses rubyzip ~> 1.1.0
|
8
|
+
* uses @Zip::OutputStream.write_buffer@ to generate the file. This should avoid corruption issues.
|
9
|
+
* the @.generate@ method now returns the actual report binary, so you can send_data it directly
|
10
|
+
* you can also use @.generate('file.odt')@, which saves the report to the specified file
|
11
|
+
|
5
12
|
h2. INSTALL
|
6
13
|
|
7
|
-
|
14
|
+
In your Gemfile
|
15
|
+
<pre>gem 'odf-report' </pre>
|
8
16
|
|
9
17
|
h2. USAGE
|
10
18
|
|
@@ -185,20 +193,19 @@ def print
|
|
185
193
|
|
186
194
|
end
|
187
195
|
|
188
|
-
|
189
|
-
|
190
|
-
|
196
|
+
send_data report.generate, type: 'application/vnd.oasis.opendocument.text',
|
197
|
+
disposition: 'attachment',
|
198
|
+
filename: 'report.odt'
|
191
199
|
|
192
200
|
end
|
193
201
|
</pre>
|
194
202
|
|
195
|
-
The @generate@ method will, er... generate the document in a temp dir and returns the full path of the generated file, so you can send it back to the user.
|
196
203
|
|
197
204
|
_That's all I have to say about that._
|
198
205
|
|
199
206
|
h4. Generating a document in a standalone script
|
200
207
|
|
201
|
-
It's just the same as in a Rails app, but you can inform the path where the file will be
|
208
|
+
It's just the same as in a Rails app, but you can inform the path where the file will be saved.
|
202
209
|
|
203
210
|
<pre>
|
204
211
|
report = ODFReport::Report.new("ticket.odt") do |r|
|
@@ -207,21 +214,12 @@ report = ODFReport::Report.new("ticket.odt") do |r|
|
|
207
214
|
|
208
215
|
end
|
209
216
|
|
210
|
-
report.generate("./documents/")
|
217
|
+
report.generate("./documents/new_ticket.odt")
|
211
218
|
</pre>
|
212
219
|
|
213
220
|
<hr/>
|
214
221
|
|
215
222
|
h3. REQUIREMENTS
|
216
223
|
|
217
|
-
*rubyzip*: for manipulating the contents of the odt file, since it's actually a zip file.
|
218
|
-
*nokogiri*: for parsing and manipulating the document xml files.
|
219
|
-
|
220
|
-
|
221
|
-
<hr/>
|
222
|
-
|
223
|
-
h3. THE FUTURE
|
224
|
-
|
225
|
-
Well, this is my first attempt. This gem was extracted from an actual project we developed internally, to fulfill our specific needs.
|
226
|
-
|
227
|
-
That said, I would really appreciate any input you can come up with. Critics, suggestions, bug reports are welcome and will be thoroughly examined.
|
224
|
+
* rubyzip*: for manipulating the contents of the odt file, since it's actually a zip file.
|
225
|
+
* nokogiri*: for parsing and manipulating the document xml files.
|
data/lib/odf-report/file.rb
CHANGED
@@ -21,9 +21,11 @@ module ODFReport
|
|
21
21
|
|
22
22
|
file.each do |entry|
|
23
23
|
|
24
|
-
|
24
|
+
next if entry.directory?
|
25
25
|
|
26
|
-
|
26
|
+
entry.get_input_stream do |is|
|
27
|
+
|
28
|
+
data = is.sysread
|
27
29
|
|
28
30
|
if content_files.include?(entry.name)
|
29
31
|
yield data
|
@@ -31,6 +33,7 @@ module ODFReport
|
|
31
33
|
|
32
34
|
@output_stream.put_next_entry(entry.name)
|
33
35
|
@output_stream.write data
|
36
|
+
|
34
37
|
end
|
35
38
|
|
36
39
|
end
|
data/lib/odf-report/report.rb
CHANGED
data/lib/odf-report/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odf-report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Duarte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|