latexpdf 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/latexpdf/pdf_generator.rb +8 -5
- data/lib/latexpdf/version.rb +1 -1
- data/test/dummy/log/test.log +408 -0
- data/test/latexpdf/pdf_generator_test.rb +33 -5
- data/test/test_helper.rb +5 -2
- data/test/testdata/empty.tex +5 -0
- metadata +19 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 116374bb6fc3670040f270aca98e42d15ec1e314
|
4
|
+
data.tar.gz: 7d68a6ee817e3cd4a08007f81c8d83d90db9ae48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7545099cdabd7b5e3d72b9f2ccf42ae94e27ffb292f75e7f25ff1e75e31fbdc76ed7ebbfc7eacedd7d636b5111693c8a70e9a341473562992172adabb101b0ee
|
7
|
+
data.tar.gz: 1d830bed031ee69ae103be08a2a0ad36dc880138080b2a903c48b96ad6a05f5b51254638489fb8c411130018c2ad0266acc75b9790a078f850efa44632ac114c
|
@@ -14,12 +14,15 @@ module Latexpdf
|
|
14
14
|
|
15
15
|
def generate
|
16
16
|
write_tex
|
17
|
-
Latexpdf.configuration.passes.times do
|
18
|
-
run_tex
|
17
|
+
(Latexpdf.configuration.passes - 1).times do
|
18
|
+
run_tex generate_pdf: true
|
19
19
|
end
|
20
|
+
run_tex generate_pdf: false
|
20
21
|
if pdf_exist?
|
21
22
|
@pdf_file = target_pdf_file
|
22
23
|
@content = File.read(pdf_file)
|
24
|
+
else
|
25
|
+
raise LatexpdfError.new "Tex failed: No PDF generated"
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -53,16 +56,16 @@ module Latexpdf
|
|
53
56
|
"xelatex"
|
54
57
|
end
|
55
58
|
|
56
|
-
def run_tex
|
59
|
+
def run_tex(generate_pdf: false)
|
57
60
|
args = %w[-halt-on-error -shell-escape -interaction batchmode]
|
61
|
+
args += %w[-no-pdf] unless generate_pdf
|
58
62
|
args = args + ["#{target_tex_file}"]
|
59
63
|
|
60
64
|
result = exec_in_build_path do
|
61
65
|
system tex_command, *args, [:out, :err] => "/dev/null"
|
62
66
|
end
|
63
67
|
|
64
|
-
raise LatexpdfError.new "
|
65
|
-
raise LatexpdfError.new "Latex PDF not generated:\n#{tex_log}" unless pdf_exist?
|
68
|
+
raise LatexpdfError.new "Tex failed:\n#{tex_log}" unless result
|
66
69
|
end
|
67
70
|
|
68
71
|
def exec_in_build_path
|
data/lib/latexpdf/version.rb
CHANGED
@@ -0,0 +1,408 @@
|
|
1
|
+
-----------------------------------------------------------
|
2
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
3
|
+
-----------------------------------------------------------
|
4
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:24:37 +0200
|
5
|
+
Processing by TexController#example as PDF
|
6
|
+
Rendered tex/example.pdf.tex (624.3ms)
|
7
|
+
Completed 500 Internal Server Error in 635ms
|
8
|
+
---------------------------------------------------------
|
9
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
10
|
+
---------------------------------------------------------
|
11
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:24:37 +0200
|
12
|
+
Processing by TexController#example2 as PDF
|
13
|
+
Rendered tex/example2.pdf.tex (637.1ms)
|
14
|
+
Completed 500 Internal Server Error in 640ms
|
15
|
+
-------------------------------------------------------------
|
16
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
17
|
+
-------------------------------------------------------------
|
18
|
+
-----------------------------------------------------------
|
19
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
20
|
+
-----------------------------------------------------------
|
21
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:25:11 +0200
|
22
|
+
Processing by TexController#example as PDF
|
23
|
+
Rendered tex/example.pdf.tex (960.1ms)
|
24
|
+
Completed 200 OK in 967ms (Views: 967.3ms)
|
25
|
+
---------------------------------------------------------
|
26
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
27
|
+
---------------------------------------------------------
|
28
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:25:12 +0200
|
29
|
+
Processing by TexController#example2 as PDF
|
30
|
+
Rendered tex/example2.pdf.tex (930.6ms)
|
31
|
+
Completed 200 OK in 933ms (Views: 932.4ms)
|
32
|
+
-------------------------------------------------------------
|
33
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
34
|
+
-------------------------------------------------------------
|
35
|
+
---------------------------------------------------------
|
36
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
37
|
+
---------------------------------------------------------
|
38
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:26:07 +0200
|
39
|
+
Processing by TexController#example2 as PDF
|
40
|
+
Rendered tex/example2.pdf.tex (2732.4ms)
|
41
|
+
Completed 200 OK in 2740ms (Views: 2740.2ms)
|
42
|
+
-----------------------------------------------------------
|
43
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
44
|
+
-----------------------------------------------------------
|
45
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:26:10 +0200
|
46
|
+
Processing by TexController#example as PDF
|
47
|
+
Rendered tex/example.pdf.tex (2727.6ms)
|
48
|
+
Completed 200 OK in 2730ms (Views: 2729.5ms)
|
49
|
+
-------------------------------------------------------------
|
50
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
51
|
+
-------------------------------------------------------------
|
52
|
+
-----------------------------------------------------------
|
53
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
54
|
+
-----------------------------------------------------------
|
55
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:26:24 +0200
|
56
|
+
Processing by TexController#example as PDF
|
57
|
+
Rendered tex/example.pdf.tex (945.0ms)
|
58
|
+
Completed 200 OK in 953ms (Views: 952.8ms)
|
59
|
+
---------------------------------------------------------
|
60
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
61
|
+
---------------------------------------------------------
|
62
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:26:25 +0200
|
63
|
+
Processing by TexController#example2 as PDF
|
64
|
+
Rendered tex/example2.pdf.tex (947.0ms)
|
65
|
+
Completed 200 OK in 949ms (Views: 949.1ms)
|
66
|
+
-------------------------------------------------------------
|
67
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
68
|
+
-------------------------------------------------------------
|
69
|
+
-------------------------------------------------------------
|
70
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
71
|
+
-------------------------------------------------------------
|
72
|
+
-----------------------------------------------------------
|
73
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
74
|
+
-----------------------------------------------------------
|
75
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:28:06 +0200
|
76
|
+
Processing by TexController#example as PDF
|
77
|
+
Rendered tex/example.pdf.tex (2696.9ms)
|
78
|
+
Completed 200 OK in 2705ms (Views: 2704.5ms)
|
79
|
+
---------------------------------------------------------
|
80
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
81
|
+
---------------------------------------------------------
|
82
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:28:09 +0200
|
83
|
+
Processing by TexController#example2 as PDF
|
84
|
+
Rendered tex/example2.pdf.tex (2725.3ms)
|
85
|
+
Completed 200 OK in 2727ms (Views: 2727.3ms)
|
86
|
+
-----------------------------------------------------------
|
87
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
88
|
+
-----------------------------------------------------------
|
89
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:30:23 +0200
|
90
|
+
Processing by TexController#example as PDF
|
91
|
+
Rendered tex/example.pdf.tex (1118.0ms)
|
92
|
+
Completed 200 OK in 1127ms (Views: 1126.8ms)
|
93
|
+
---------------------------------------------------------
|
94
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
95
|
+
---------------------------------------------------------
|
96
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:30:24 +0200
|
97
|
+
Processing by TexController#example2 as PDF
|
98
|
+
Rendered tex/example2.pdf.tex (1172.1ms)
|
99
|
+
Completed 200 OK in 1174ms (Views: 1174.0ms)
|
100
|
+
-------------------------------------------------------------
|
101
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
102
|
+
-------------------------------------------------------------
|
103
|
+
-----------------------------------------------------------
|
104
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
105
|
+
-----------------------------------------------------------
|
106
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:30:37 +0200
|
107
|
+
Processing by TexController#example as PDF
|
108
|
+
Rendered tex/example.pdf.tex (2934.3ms)
|
109
|
+
Completed 200 OK in 2942ms (Views: 2941.3ms)
|
110
|
+
---------------------------------------------------------
|
111
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
112
|
+
---------------------------------------------------------
|
113
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:30:40 +0200
|
114
|
+
Processing by TexController#example2 as PDF
|
115
|
+
Rendered tex/example2.pdf.tex (2894.2ms)
|
116
|
+
Completed 200 OK in 2896ms (Views: 2896.4ms)
|
117
|
+
-------------------------------------------------------------
|
118
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
119
|
+
-------------------------------------------------------------
|
120
|
+
-----------------------------------------------------------
|
121
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
122
|
+
-----------------------------------------------------------
|
123
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:31:07 +0200
|
124
|
+
Processing by TexController#example as PDF
|
125
|
+
Rendered tex/example.pdf.tex (933.9ms)
|
126
|
+
Completed 200 OK in 941ms (Views: 941.0ms)
|
127
|
+
---------------------------------------------------------
|
128
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
129
|
+
---------------------------------------------------------
|
130
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:31:08 +0200
|
131
|
+
Processing by TexController#example2 as PDF
|
132
|
+
Rendered tex/example2.pdf.tex (927.0ms)
|
133
|
+
Completed 200 OK in 929ms (Views: 929.0ms)
|
134
|
+
-------------------------------------------------------------
|
135
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
136
|
+
-------------------------------------------------------------
|
137
|
+
-------------------------------------------------------------
|
138
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
139
|
+
-------------------------------------------------------------
|
140
|
+
-----------------------------------------------------------
|
141
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
142
|
+
-----------------------------------------------------------
|
143
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:32:50 +0200
|
144
|
+
Processing by TexController#example as PDF
|
145
|
+
Rendered tex/example.pdf.tex (930.9ms)
|
146
|
+
Completed 200 OK in 938ms (Views: 938.0ms)
|
147
|
+
---------------------------------------------------------
|
148
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
149
|
+
---------------------------------------------------------
|
150
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:32:51 +0200
|
151
|
+
Processing by TexController#example2 as PDF
|
152
|
+
Rendered tex/example2.pdf.tex (937.2ms)
|
153
|
+
Completed 200 OK in 939ms (Views: 939.3ms)
|
154
|
+
-----------------------------------------------------------
|
155
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
156
|
+
-----------------------------------------------------------
|
157
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:33:41 +0200
|
158
|
+
Processing by TexController#example as PDF
|
159
|
+
Rendered tex/example.pdf.tex (948.9ms)
|
160
|
+
Completed 200 OK in 956ms (Views: 956.0ms)
|
161
|
+
---------------------------------------------------------
|
162
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
163
|
+
---------------------------------------------------------
|
164
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:33:42 +0200
|
165
|
+
Processing by TexController#example2 as PDF
|
166
|
+
Rendered tex/example2.pdf.tex (1103.0ms)
|
167
|
+
Completed 200 OK in 1105ms (Views: 1104.8ms)
|
168
|
+
-------------------------------------------------------------
|
169
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
170
|
+
-------------------------------------------------------------
|
171
|
+
-------------------------------------------------------------
|
172
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
173
|
+
-------------------------------------------------------------
|
174
|
+
---------------------------------------------------------
|
175
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
176
|
+
---------------------------------------------------------
|
177
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:35:50 +0200
|
178
|
+
Processing by TexController#example2 as PDF
|
179
|
+
Rendered tex/example2.pdf.tex (2740.6ms)
|
180
|
+
Completed 200 OK in 2749ms (Views: 2749.2ms)
|
181
|
+
-----------------------------------------------------------
|
182
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
183
|
+
-----------------------------------------------------------
|
184
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:35:52 +0200
|
185
|
+
Processing by TexController#example as PDF
|
186
|
+
Rendered tex/example.pdf.tex (2712.3ms)
|
187
|
+
Completed 200 OK in 2714ms (Views: 2714.2ms)
|
188
|
+
-------------------------------------------------------------
|
189
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
190
|
+
-------------------------------------------------------------
|
191
|
+
-----------------------------------------------------------
|
192
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
193
|
+
-----------------------------------------------------------
|
194
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:37:28 +0200
|
195
|
+
Processing by TexController#example as PDF
|
196
|
+
Rendered tex/example.pdf.tex (949.8ms)
|
197
|
+
Completed 200 OK in 958ms (Views: 958.1ms)
|
198
|
+
---------------------------------------------------------
|
199
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
200
|
+
---------------------------------------------------------
|
201
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:37:29 +0200
|
202
|
+
Processing by TexController#example2 as PDF
|
203
|
+
Rendered tex/example2.pdf.tex (942.9ms)
|
204
|
+
Completed 200 OK in 945ms (Views: 944.9ms)
|
205
|
+
-----------------------------------------------------------
|
206
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
207
|
+
-----------------------------------------------------------
|
208
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:39:08 +0200
|
209
|
+
Processing by TexController#example as PDF
|
210
|
+
Rendered tex/example.pdf.tex (929.4ms)
|
211
|
+
Completed 200 OK in 937ms (Views: 936.6ms)
|
212
|
+
---------------------------------------------------------
|
213
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
214
|
+
---------------------------------------------------------
|
215
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:39:09 +0200
|
216
|
+
Processing by TexController#example2 as PDF
|
217
|
+
Rendered tex/example2.pdf.tex (939.0ms)
|
218
|
+
Completed 200 OK in 941ms (Views: 940.9ms)
|
219
|
+
-------------------------------------------------------------
|
220
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
221
|
+
-------------------------------------------------------------
|
222
|
+
-----------------------------------------------------------
|
223
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
224
|
+
-----------------------------------------------------------
|
225
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:39:22 +0200
|
226
|
+
Processing by TexController#example as PDF
|
227
|
+
Rendered tex/example.pdf.tex (2881.1ms)
|
228
|
+
Completed 200 OK in 2889ms (Views: 2888.7ms)
|
229
|
+
---------------------------------------------------------
|
230
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
231
|
+
---------------------------------------------------------
|
232
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:39:25 +0200
|
233
|
+
Processing by TexController#example2 as PDF
|
234
|
+
Rendered tex/example2.pdf.tex (2736.1ms)
|
235
|
+
Completed 200 OK in 2738ms (Views: 2738.3ms)
|
236
|
+
-------------------------------------------------------------
|
237
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
238
|
+
-------------------------------------------------------------
|
239
|
+
---------------------------------------------------------
|
240
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
241
|
+
---------------------------------------------------------
|
242
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:40:01 +0200
|
243
|
+
Processing by TexController#example2 as PDF
|
244
|
+
Rendered tex/example2.pdf.tex (2792.3ms)
|
245
|
+
Completed 200 OK in 2800ms (Views: 2800.2ms)
|
246
|
+
-----------------------------------------------------------
|
247
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
248
|
+
-----------------------------------------------------------
|
249
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:40:04 +0200
|
250
|
+
Processing by TexController#example as PDF
|
251
|
+
Rendered tex/example.pdf.tex (2715.8ms)
|
252
|
+
Completed 200 OK in 2718ms (Views: 2717.7ms)
|
253
|
+
-------------------------------------------------------------
|
254
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
255
|
+
-------------------------------------------------------------
|
256
|
+
---------------------------------------------------------
|
257
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
258
|
+
---------------------------------------------------------
|
259
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:40:30 +0200
|
260
|
+
Processing by TexController#example2 as PDF
|
261
|
+
Rendered tex/example2.pdf.tex (2740.6ms)
|
262
|
+
Completed 200 OK in 2748ms (Views: 2747.9ms)
|
263
|
+
-----------------------------------------------------------
|
264
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
265
|
+
-----------------------------------------------------------
|
266
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:40:33 +0200
|
267
|
+
Processing by TexController#example as PDF
|
268
|
+
Rendered tex/example.pdf.tex (2776.9ms)
|
269
|
+
Completed 200 OK in 2779ms (Views: 2778.9ms)
|
270
|
+
-------------------------------------------------------------
|
271
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
272
|
+
-------------------------------------------------------------
|
273
|
+
-----------------------------------------------------------
|
274
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
275
|
+
-----------------------------------------------------------
|
276
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:40:54 +0200
|
277
|
+
Processing by TexController#example as PDF
|
278
|
+
Rendered tex/example.pdf.tex (2730.4ms)
|
279
|
+
Completed 200 OK in 2740ms (Views: 2739.8ms)
|
280
|
+
---------------------------------------------------------
|
281
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
282
|
+
---------------------------------------------------------
|
283
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:40:56 +0200
|
284
|
+
Processing by TexController#example2 as PDF
|
285
|
+
Rendered tex/example2.pdf.tex (2749.1ms)
|
286
|
+
Completed 200 OK in 2751ms (Views: 2751.2ms)
|
287
|
+
-------------------------------------------------------------
|
288
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
289
|
+
-------------------------------------------------------------
|
290
|
+
-------------------------------------------------------------
|
291
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
292
|
+
-------------------------------------------------------------
|
293
|
+
---------------------------------------------------------
|
294
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
295
|
+
---------------------------------------------------------
|
296
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:41:42 +0200
|
297
|
+
Processing by TexController#example2 as PDF
|
298
|
+
Rendered tex/example2.pdf.tex (929.4ms)
|
299
|
+
Completed 200 OK in 937ms (Views: 936.8ms)
|
300
|
+
-----------------------------------------------------------
|
301
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
302
|
+
-----------------------------------------------------------
|
303
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:41:43 +0200
|
304
|
+
Processing by TexController#example as PDF
|
305
|
+
Rendered tex/example.pdf.tex (913.1ms)
|
306
|
+
Completed 200 OK in 915ms (Views: 914.9ms)
|
307
|
+
-----------------------------------------------------------
|
308
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
309
|
+
-----------------------------------------------------------
|
310
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:41:50 +0200
|
311
|
+
Processing by TexController#example as PDF
|
312
|
+
Rendered tex/example.pdf.tex (934.6ms)
|
313
|
+
Completed 200 OK in 943ms (Views: 942.6ms)
|
314
|
+
---------------------------------------------------------
|
315
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
316
|
+
---------------------------------------------------------
|
317
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:41:51 +0200
|
318
|
+
Processing by TexController#example2 as PDF
|
319
|
+
Rendered tex/example2.pdf.tex (921.4ms)
|
320
|
+
Completed 200 OK in 924ms (Views: 923.7ms)
|
321
|
+
-------------------------------------------------------------
|
322
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
323
|
+
-------------------------------------------------------------
|
324
|
+
-----------------------------------------------------------
|
325
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
326
|
+
-----------------------------------------------------------
|
327
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 18:47:01 +0200
|
328
|
+
Processing by TexController#example as PDF
|
329
|
+
Rendered tex/example.pdf.tex (1094.4ms)
|
330
|
+
Completed 200 OK in 1102ms (Views: 1101.7ms)
|
331
|
+
---------------------------------------------------------
|
332
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
333
|
+
---------------------------------------------------------
|
334
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 18:47:02 +0200
|
335
|
+
Processing by TexController#example2 as PDF
|
336
|
+
Rendered tex/example2.pdf.tex (933.3ms)
|
337
|
+
Completed 200 OK in 935ms (Views: 935.1ms)
|
338
|
+
-------------------------------------------------------------
|
339
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
340
|
+
-------------------------------------------------------------
|
341
|
+
---------------------------------------------------------
|
342
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
343
|
+
---------------------------------------------------------
|
344
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 20:13:38 +0200
|
345
|
+
Processing by TexController#example2 as PDF
|
346
|
+
Rendered tex/example2.pdf.tex (958.3ms)
|
347
|
+
Completed 200 OK in 966ms (Views: 965.6ms)
|
348
|
+
-----------------------------------------------------------
|
349
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
350
|
+
-----------------------------------------------------------
|
351
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 20:13:39 +0200
|
352
|
+
Processing by TexController#example as PDF
|
353
|
+
Rendered tex/example.pdf.tex (936.9ms)
|
354
|
+
Completed 200 OK in 940ms (Views: 939.7ms)
|
355
|
+
-------------------------------------------------------------
|
356
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
357
|
+
-------------------------------------------------------------
|
358
|
+
-------------------------------------------------------------
|
359
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
360
|
+
-------------------------------------------------------------
|
361
|
+
---------------------------------------------------------
|
362
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
363
|
+
---------------------------------------------------------
|
364
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 20:17:32 +0200
|
365
|
+
Processing by TexController#example2 as PDF
|
366
|
+
Rendered tex/example2.pdf.tex (2714.3ms)
|
367
|
+
Completed 200 OK in 2721ms (Views: 2721.1ms)
|
368
|
+
-----------------------------------------------------------
|
369
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
370
|
+
-----------------------------------------------------------
|
371
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 20:17:35 +0200
|
372
|
+
Processing by TexController#example as PDF
|
373
|
+
Rendered tex/example.pdf.tex (2826.5ms)
|
374
|
+
Completed 200 OK in 2829ms (Views: 2828.5ms)
|
375
|
+
-------------------------------------------------------------
|
376
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
377
|
+
-------------------------------------------------------------
|
378
|
+
-----------------------------------------------------------
|
379
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
380
|
+
-----------------------------------------------------------
|
381
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 20:33:04 +0200
|
382
|
+
Processing by TexController#example as PDF
|
383
|
+
Rendered tex/example.pdf.tex (1096.3ms)
|
384
|
+
Completed 200 OK in 1104ms (Views: 1103.8ms)
|
385
|
+
---------------------------------------------------------
|
386
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
387
|
+
---------------------------------------------------------
|
388
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 20:33:06 +0200
|
389
|
+
Processing by TexController#example2 as PDF
|
390
|
+
Rendered tex/example2.pdf.tex (929.5ms)
|
391
|
+
Completed 200 OK in 931ms (Views: 931.2ms)
|
392
|
+
-----------------------------------------------------------
|
393
|
+
RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
|
394
|
+
-----------------------------------------------------------
|
395
|
+
Started GET "/tex/example.pdf" for 127.0.0.1 at 2016-05-30 20:35:08 +0200
|
396
|
+
Processing by TexController#example as PDF
|
397
|
+
Rendered tex/example.pdf.tex (2700.8ms)
|
398
|
+
Completed 200 OK in 2710ms (Views: 2710.0ms)
|
399
|
+
---------------------------------------------------------
|
400
|
+
RenderingTest: test_Generate_PDF_using_escaped_characters
|
401
|
+
---------------------------------------------------------
|
402
|
+
Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-05-30 20:35:11 +0200
|
403
|
+
Processing by TexController#example2 as PDF
|
404
|
+
Rendered tex/example2.pdf.tex (2698.0ms)
|
405
|
+
Completed 200 OK in 2700ms (Views: 2699.9ms)
|
406
|
+
-------------------------------------------------------------
|
407
|
+
ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
|
408
|
+
-------------------------------------------------------------
|
@@ -7,25 +7,53 @@ module Latexpdf
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_generate_pdf
|
10
|
+
set_subject "minimal.tex"
|
10
11
|
subject.generate
|
11
12
|
assert File.file?(pdf_file)
|
12
13
|
assert_match (/Test latex document/), pdf_reader.pages.first.text
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_fail_on_invalid_tex
|
16
|
-
|
17
|
-
@subject = PdfGenerator.new(invalid_tex_file)
|
17
|
+
set_subject "invalid_tex.tex"
|
18
18
|
e = assert_raises LatexpdfError do
|
19
19
|
subject.generate
|
20
20
|
end
|
21
21
|
assert_match (/Missing \\begin\{document\}/), e.message
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
def test_fail_on_empty_tex
|
25
|
+
set_subject "empty.tex"
|
26
|
+
e = assert_raises LatexpdfError do
|
27
|
+
subject.generate
|
28
|
+
end
|
29
|
+
assert_match (/Tex failed: No PDF generated/), e.message
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_invokes_tex_N_times
|
33
|
+
set_subject "minimal.tex"
|
34
|
+
|
35
|
+
Latexpdf.configure do |config|
|
36
|
+
config.passes = 3
|
37
|
+
end
|
38
|
+
|
39
|
+
subject.expects(:run_tex).with({generate_pdf: true}).twice
|
40
|
+
subject.expects(:run_tex).with({generate_pdf: false}).once
|
41
|
+
|
42
|
+
e = assert_raises LatexpdfError do
|
43
|
+
subject.generate
|
44
|
+
end
|
45
|
+
assert_match (/Tex failed: No PDF generated/), e.message
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
25
49
|
|
26
50
|
def subject
|
27
|
-
|
28
|
-
|
51
|
+
@subject
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_subject(file)
|
55
|
+
tex_file = File.join(data_path, file)
|
56
|
+
@subject = PdfGenerator.new(File.read(tex_file))
|
29
57
|
end
|
30
58
|
|
31
59
|
def pdf_file
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Configure Rails Environment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
|
-
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
4
|
-
require "rails/test_help"
|
5
3
|
|
6
4
|
require "simplecov"
|
7
5
|
SimpleCov.start if ENV["COVERAGE"]
|
8
6
|
|
7
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
8
|
+
require "rails/test_help"
|
9
|
+
|
10
|
+
|
9
11
|
require "minitest/autorun"
|
12
|
+
require 'mocha/mini_test'
|
10
13
|
|
11
14
|
old_verbose, $VERBOSE = $VERBOSE, nil
|
12
15
|
require "pdf-reader"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latexpdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthijs Ooms
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mocha
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.1'
|
111
125
|
description: Latexpdf is a renderer for rails which compiles Tex files with ERB to
|
112
126
|
a PDF using xelatex by default so that it supports Unicode.
|
113
127
|
email:
|
@@ -163,6 +177,7 @@ files:
|
|
163
177
|
- test/dummy/config/routes.rb
|
164
178
|
- test/dummy/config/secrets.yml
|
165
179
|
- test/dummy/log/development.log
|
180
|
+
- test/dummy/log/test.log
|
166
181
|
- test/dummy/public/404.html
|
167
182
|
- test/dummy/public/422.html
|
168
183
|
- test/dummy/public/500.html
|
@@ -176,6 +191,7 @@ files:
|
|
176
191
|
- test/latexpdf/logger_test.rb
|
177
192
|
- test/latexpdf/pdf_generator_test.rb
|
178
193
|
- test/test_helper.rb
|
194
|
+
- test/testdata/empty.tex
|
179
195
|
- test/testdata/invalid_tex.tex
|
180
196
|
- test/testdata/minimal.tex
|
181
197
|
homepage: https://github.com/mjooms/latexpdf
|
@@ -238,6 +254,7 @@ test_files:
|
|
238
254
|
- test/dummy/config/secrets.yml
|
239
255
|
- test/dummy/config.ru
|
240
256
|
- test/dummy/log/development.log
|
257
|
+
- test/dummy/log/test.log
|
241
258
|
- test/dummy/public/404.html
|
242
259
|
- test/dummy/public/422.html
|
243
260
|
- test/dummy/public/500.html
|
@@ -251,6 +268,7 @@ test_files:
|
|
251
268
|
- test/latexpdf/logger_test.rb
|
252
269
|
- test/latexpdf/pdf_generator_test.rb
|
253
270
|
- test/test_helper.rb
|
271
|
+
- test/testdata/empty.tex
|
254
272
|
- test/testdata/invalid_tex.tex
|
255
273
|
- test/testdata/minimal.tex
|
256
274
|
- Rakefile
|