transmuter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.todo ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <todo version="0.1.20">
3
+ <note priority="veryhigh" time="1317646083">
4
+ We need to document every module, every class and every function so we'd get a nide documentation from source code.
5
+ </note>
6
+ <note priority="medium" time="1317642736">
7
+ Add an optional Header/Footer option to specify header/footer files, they should be of any supported type.
8
+ </note>
9
+ <note priority="medium" time="1317642895">
10
+ Add an option allowing the user to turn off syntax highlighting
11
+ </note>
12
+ <note priority="medium" time="1317642982">
13
+ Better handle options passed from Thor to Source class, instead of manually setting options[:stylesheets] I think we should just send the options hash
14
+ </note>
15
+ <note priority="medium" time="1317643052">
16
+ The Textile and Markdown classes looks a lot like each other, make some Meta-programming, inheritence may suffice
17
+ </note>
18
+ </todo>
@@ -0,0 +1,493 @@
1
+ 2011-10-03 Wael Nasreddine <wael.nasreddine@gmail.com>
2
+ * textile: Initial import.
3
+
4
+ Files changed:
5
+ lib/transmuter/format.rb | 1 +
6
+ lib/transmuter/format/textile.rb | 40 ++++++++++
7
+ spec/transmuter/format/textile_spec.rb | 134 ++++++++++++++++++++++++++++++++
8
+ transmuter.gemspec | 1 +
9
+ 4 files changed, 176 insertions(+), 0 deletions(-)
10
+
11
+ * spec_helper: ROOT_PATH is already defined in the library.
12
+
13
+ Files changed:
14
+ spec/spec_helper.rb | 3 +--
15
+ 1 files changed, 1 insertions(+), 2 deletions(-)
16
+
17
+ * README: Fix a typo.
18
+
19
+ Files changed:
20
+ README.md | 2 +-
21
+ 1 files changed, 1 insertions(+), 1 deletions(-)
22
+
23
+ * ChangeLog: Initial Commit.
24
+
25
+ Files changed:
26
+ ChangeLog | 466 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
27
+ 1 files changed, 466 insertions(+), 0 deletions(-)
28
+
29
+ * cli/thor: Add Textile.
30
+
31
+ Files changed:
32
+ lib/transmuter/cli/thor.rb | 2 ++
33
+ 1 files changed, 2 insertions(+), 0 deletions(-)
34
+
35
+ * bin/transmute: Make sure pygments and wkhtmltopdf exists.
36
+
37
+ Files changed:
38
+ bin/transmute | 10 ++++++++++
39
+ lib/transmuter.rb | 16 ++++++++++++++++
40
+ 2 files changed, 26 insertions(+), 0 deletions(-)
41
+
42
+ * README: Update the README.
43
+
44
+ Files changed:
45
+ README.md | 28 +++++++++++++++++++++++++---
46
+ 1 files changed, 25 insertions(+), 3 deletions(-)
47
+
48
+ * cli: Remove the Help module, Thor provides it's own help method
49
+
50
+ Files changed:
51
+ lib/transmuter/cli.rb | 2 --
52
+ lib/transmuter/cli/help.rb | 14 --------------
53
+ lib/transmuter/cli/thor.rb | 2 +-
54
+ 3 files changed, 1 insertions(+), 17 deletions(-)
55
+
56
+ * transmuter: Add default stylesheets.
57
+
58
+ Files changed:
59
+ lib/transmuter/cli.rb | 2 +
60
+ lib/transmuter/cli/thor.rb | 11 +++++
61
+ lib/transmuter/cli/transmute.rb | 6 ++-
62
+ spec/transmuter/cli/thor_spec.rb | 25 ++++++++++++
63
+ spec/transmuter/cli/transmute_spec.rb | 22 +++++++---
64
+ stylesheets/default.css | 67 +++++++++++++++++++++++++++++++++
65
+ 6 files changed, 125 insertions(+), 8 deletions(-)
66
+
67
+ * landing: Define ROOT_PATH so we can easily access the gem's root folder.
68
+
69
+ Files changed:
70
+ bin/transmute | 3 +--
71
+ lib/transmuter.rb | 2 ++
72
+ spec/spec_helper.rb | 2 +-
73
+ 3 files changed, 4 insertions(+), 3 deletions(-)
74
+
75
+ * thor: I did not write handle_error so in the mean time use the transmute!
76
+ method.
77
+
78
+ Files changed:
79
+ lib/transmuter/cli/thor.rb | 2 +-
80
+ 1 files changed, 1 insertions(+), 1 deletions(-)
81
+
82
+ * transmute_spec: Add tests for HTML => PDF.
83
+
84
+ Files changed:
85
+ spec/transmuter/cli/transmute_spec.rb | 52 ++++++++++++++++++++++++++++----
86
+ 1 files changed, 45 insertions(+), 7 deletions(-)
87
+
88
+ * format/html, format/markdown, format/pdf: Complete the pdf transmusion.
89
+
90
+ Files changed:
91
+ lib/transmuter/format/html.rb | 6 ++++
92
+ lib/transmuter/format/markdown.rb | 6 ++++
93
+ lib/transmuter/format/pdf.rb | 19 +++++++++++++
94
+ spec/transmuter/format/html_spec.rb | 27 +++++++++++++++++++
95
+ spec/transmuter/format/markdown_spec.rb | 28 ++++++++++++++++++++
96
+ spec/transmuter/format/pdf_spec.rb | 43 +++++++++++++++++++++++++++++++
97
+ 6 files changed, 129 insertions(+), 0 deletions(-)
98
+
99
+ * format/html, format/markdown: Define a method that can get me the options.
100
+
101
+ Files changed:
102
+ lib/transmuter/format/html.rb | 6 ++++++
103
+ lib/transmuter/format/markdown.rb | 10 +++++++---
104
+ 2 files changed, 13 insertions(+), 3 deletions(-)
105
+
106
+ * transmute: We do not need to call process in the destination class, it is
107
+ already been done in the source transmution method itself.
108
+
109
+ Files changed:
110
+ lib/transmuter/cli/transmute.rb | 5 +----
111
+ 1 files changed, 1 insertions(+), 4 deletions(-)
112
+
113
+ * html: Fix the bug of multiple heads.
114
+
115
+ Files changed:
116
+ lib/transmuter/format/html.rb | 12 +++++++++---
117
+ 1 files changed, 9 insertions(+), 3 deletions(-)
118
+
119
+ * gemspec: Add pry for debugging to the gemspec.
120
+
121
+ Files changed:
122
+ transmuter.gemspec | 3 +++
123
+ 1 files changed, 3 insertions(+), 0 deletions(-)
124
+
125
+ * html_spec: Add a test showing the bug: If <head> section already exists,
126
+ another one is added, however the section should be modified.
127
+
128
+ Files changed:
129
+ spec/transmuter/format/html_spec.rb | 22 ++++++++++++++++++++--
130
+ 1 files changed, 20 insertions(+), 2 deletions(-)
131
+
132
+ * cli/transmute: use at_least() instead of once and twice, I think
133
+ expectation is bleeding from one example to another.
134
+
135
+ Files changed:
136
+ spec/transmuter/cli/thor_spec.rb | 4 ++--
137
+ spec/transmuter/cli/transmute_spec.rb | 2 +-
138
+ 2 files changed, 3 insertions(+), 3 deletions(-)
139
+
140
+ * cli/transmute: add tests.
141
+
142
+ Files changed:
143
+ lib/transmuter/cli/transmute.rb | 8 ++--
144
+ spec/transmuter/cli/thor_spec.rb | 2 +-
145
+ spec/transmuter/cli/transmute_spec.rb | 65 +++++++++++++++++++++++++++---
146
+ spec/transmuter/format/markdown_spec.rb | 4 --
147
+ 4 files changed, 63 insertions(+), 16 deletions(-)
148
+
149
+ * transmuter: Implement the first *very basic* read of source file and write
150
+ of destination file. TODO: cli/transmute.rb need tests!!
151
+
152
+ Files changed:
153
+ lib/transmuter/cli/transmute.rb | 48 ++++++++++++++++++++++++++++++---
154
+ spec/transmuter/cli/thor_spec.rb | 6 ++--
155
+ spec/transmuter/cli/transmute_spec.rb | 4 +++
156
+ spec/transmuter/format_spec.rb | 4 +++
157
+ 4 files changed, 55 insertions(+), 7 deletions(-)
158
+
159
+ * gitignore: Do not track HTML/PDF files.
160
+
161
+ Files changed:
162
+ .gitignore | 2 ++
163
+ 1 files changed, 2 insertions(+), 0 deletions(-)
164
+
165
+ * format: autoload.
166
+
167
+ Files changed:
168
+ lib/transmuter/core_ext.rb | 1 +
169
+ lib/transmuter/format.rb | 12 +++++++++---
170
+ 2 files changed, 10 insertions(+), 3 deletions(-)
171
+
172
+ * travis: It seems that redcarpet does not work with JRuby, disable it on
173
+ travis-ci for now.
174
+
175
+ Files changed:
176
+ .travis.yml | 1 -
177
+ 1 files changed, 0 insertions(+), 1 deletions(-)
178
+
179
+ * format/markdown, format/html: Move the HTML specific parsings into the HTML
180
+ format.
181
+
182
+ Files changed:
183
+ lib/transmuter/format/html.rb | 57 ++++++++++++++++
184
+ lib/transmuter/format/markdown.rb | 47 +------------
185
+ spec/transmuter/format/html_spec.rb | 108 +++++++++++++++++++++++++++++++
186
+ spec/transmuter/format/markdown_spec.rb | 82 ++----------------------
187
+ 4 files changed, 175 insertions(+), 119 deletions(-)
188
+
189
+ * markdown_spec: Remove external dependencies, mock as much as we can.
190
+
191
+ Files changed:
192
+ spec/transmuter/format/markdown_spec.rb | 14 +++++++++++---
193
+ 1 files changed, 11 insertions(+), 3 deletions(-)
194
+
195
+
196
+ 2011-10-02 Wael Nasreddine <wael.nasreddine@gmail.com>
197
+ * travis: Jruby 1.9 please.
198
+
199
+ Files changed:
200
+ .travis.yml | 1 +
201
+ 1 files changed, 1 insertions(+), 0 deletions(-)
202
+
203
+ * gemspec: Ruby >= 1.9.2 please.
204
+
205
+ Files changed:
206
+ transmuter.gemspec | 2 ++
207
+ 1 files changed, 2 insertions(+), 0 deletions(-)
208
+
209
+ * README: add simple usage (which is not implemented yet).
210
+
211
+ Files changed:
212
+ README.md | 10 ++++++++++
213
+ 1 files changed, 10 insertions(+), 0 deletions(-)
214
+
215
+ * README: Add Travis-ci and Pledgie.
216
+
217
+ Files changed:
218
+ README.md | 4 +++-
219
+ 1 files changed, 3 insertions(+), 1 deletions(-)
220
+
221
+ * Add .travis-ci
222
+
223
+ Files changed:
224
+ .travis.yml | 8 ++++++++
225
+ 1 files changed, 8 insertions(+), 0 deletions(-)
226
+
227
+ * markdown: complete the markdown functionality.
228
+
229
+ Files changed:
230
+ lib/transmuter/format/markdown.rb | 46 +++++++++++-
231
+ spec/transmuter/format/markdown_spec.rb | 123 +++++++++++++++++++++++++++++--
232
+ 2 files changed, 162 insertions(+), 7 deletions(-)
233
+
234
+ * formar/markdown: add a call to_html
235
+
236
+ Files changed:
237
+ lib/transmuter/format/markdown.rb | 20 +++++++++++
238
+ spec/transmuter/format/markdown_spec.rb | 58 +++++++++++++++++++++++++++++++
239
+ 2 files changed, 78 insertions(+), 0 deletions(-)
240
+
241
+ * format: initial modules.
242
+
243
+ Files changed:
244
+ lib/transmuter.rb | 1 +
245
+ lib/transmuter/format.rb | 3 +++
246
+ lib/transmuter/format/html.rb | 6 ++++++
247
+ lib/transmuter/format/markdown.rb | 10 ++++++++++
248
+ lib/transmuter/format/pdf.rb | 6 ++++++
249
+ spec/transmuter/format/html_spec.rb | 6 ++++++
250
+ spec/transmuter/format/markdown_spec.rb | 19 +++++++++++++++++++
251
+ spec/transmuter/format/pdf_spec.rb | 6 ++++++
252
+ 8 files changed, 57 insertions(+), 0 deletions(-)
253
+
254
+ * cli/transmute: Implement transmute as a non-exception raising transmute!
255
+ method.
256
+
257
+ Files changed:
258
+ lib/transmuter/cli/transmute.rb | 8 ++++++++
259
+ spec/transmuter/cli/transmute_spec.rb | 27 +++++++++++++++++++++++++--
260
+ 2 files changed, 33 insertions(+), 2 deletions(-)
261
+
262
+ * cli: Rename Execute to Transmute, execute is a method that does exist
263
+ already in Thor and we're overwriting it.
264
+
265
+ Files changed:
266
+ bin/transmute | 2 +-
267
+ lib/transmuter/cli.rb | 6 +++---
268
+ lib/transmuter/cli/execute.rb | 17 -----------------
269
+ lib/transmuter/cli/thor.rb | 4 ++++
270
+ lib/transmuter/cli/transmute.rb | 18 ++++++++++++++++++
271
+ spec/transmuter/cli/execute_spec.rb | 14 --------------
272
+ spec/transmuter/cli/thor_spec.rb | 9 +++++++++
273
+ spec/transmuter/cli/transmute_spec.rb | 14 ++++++++++++++
274
+ 8 files changed, 49 insertions(+), 35 deletions(-)
275
+
276
+ * cli: Move everything one level down to a Runner class and make CLI a
277
+ module.
278
+
279
+ Files changed:
280
+ bin/transmute | 2 +-
281
+ lib/transmuter/cli.rb | 9 ++-
282
+ lib/transmuter/cli/execute.rb | 2 +-
283
+ lib/transmuter/cli/help.rb | 2 +-
284
+ lib/transmuter/cli/thor.rb | 118 +++++++++++++++++++----------------
285
+ spec/transmuter/cli/execute_spec.rb | 2 +-
286
+ spec/transmuter/cli/thor_spec.rb | 34 +++++-----
287
+ spec/transmuter/cli_spec.rb | 8 ---
288
+ 8 files changed, 92 insertions(+), 85 deletions(-)
289
+
290
+ * bin: Add a binary file that starts transmute.
291
+
292
+ Files changed:
293
+ bin/transmute | 8 ++++++++
294
+ 1 files changed, 8 insertions(+), 0 deletions(-)
295
+
296
+ * cli: add two functions execute and execute! as InstanceMethods.
297
+
298
+ Files changed:
299
+ lib/transmuter/cli/execute.rb | 4 ++--
300
+ spec/transmuter/cli/execute_spec.rb | 14 ++++++++++++++
301
+ 2 files changed, 16 insertions(+), 2 deletions(-)
302
+
303
+ * cli: output or output_format should be set.
304
+
305
+ Files changed:
306
+ lib/transmuter/cli/thor.rb | 4 ++++
307
+ spec/transmuter/cli/thor_spec.rb | 10 ++++++++++
308
+ 2 files changed, 14 insertions(+), 0 deletions(-)
309
+
310
+ * cli: parse output file name.
311
+
312
+ Files changed:
313
+ lib/transmuter/cli/thor.rb | 9 +++++++++
314
+ spec/transmuter/cli/thor_spec.rb | 13 +++++++++++++
315
+ 2 files changed, 22 insertions(+), 0 deletions(-)
316
+
317
+ * cli: Add an output argument.
318
+
319
+ Files changed:
320
+ lib/transmuter/cli/thor.rb | 6 ++++++
321
+ spec/transmuter/cli/thor_spec.rb | 11 +++++++++++
322
+ 2 files changed, 17 insertions(+), 0 deletions(-)
323
+
324
+ * cli: Add a function to set the output file format.
325
+
326
+ Files changed:
327
+ lib/transmuter/cli/thor.rb | 4 ++++
328
+ spec/transmuter/cli/thor_spec.rb | 13 +++++++++++++
329
+ 2 files changed, 17 insertions(+), 0 deletions(-)
330
+
331
+ * cli: Add an optional class_option called :output_format.
332
+
333
+ Files changed:
334
+ lib/transmuter/cli/thor.rb | 7 +++++++
335
+ spec/transmuter/cli/thor_spec.rb | 11 +++++++++++
336
+ 2 files changed, 18 insertions(+), 0 deletions(-)
337
+
338
+ * cli: The input format can actually be parsed from the input file name.
339
+
340
+ Files changed:
341
+ lib/transmuter/cli/thor.rb | 16 +++++++++++++++-
342
+ spec/transmuter/cli/thor_spec.rb | 25 +++++++++++++++++++++++++
343
+ 2 files changed, 40 insertions(+), 1 deletions(-)
344
+
345
+ * cli: correctly set input_format.
346
+
347
+ Files changed:
348
+ lib/transmuter/cli/thor.rb | 4 ++++
349
+ spec/transmuter/cli/thor_spec.rb | 8 ++++++++
350
+ 2 files changed, 12 insertions(+), 0 deletions(-)
351
+
352
+ * cli: Add an optional class_option called :input_format.
353
+
354
+ Files changed:
355
+ lib/transmuter/cli/thor.rb | 6 ++++++
356
+ spec/transmuter/cli/thor_spec.rb | 12 ++++++++++++
357
+ 2 files changed, 18 insertions(+), 0 deletions(-)
358
+
359
+ * cli: Add a method to set the input file name.
360
+
361
+ Files changed:
362
+ lib/transmuter/cli/thor.rb | 3 +++
363
+ spec/transmuter/cli/thor_spec.rb | 7 +++++++
364
+ 2 files changed, 10 insertions(+), 0 deletions(-)
365
+
366
+ * cli_spec: The subject should pass validations.
367
+
368
+ Files changed:
369
+ spec/transmuter/cli/thor_spec.rb | 6 +++++-
370
+ 1 files changed, 5 insertions(+), 1 deletions(-)
371
+
372
+ * cli: Add an input argument.
373
+
374
+ Files changed:
375
+ lib/transmuter/cli/thor.rb | 7 +++++++
376
+ spec/transmuter/cli/thor_spec.rb | 11 +++++++++++
377
+ 2 files changed, 18 insertions(+), 0 deletions(-)
378
+
379
+ * cli: Add a description to the Thor group.
380
+
381
+ Files changed:
382
+ lib/transmuter/cli/thor.rb | 1 +
383
+ spec/transmuter/cli/thor_spec.rb | 2 ++
384
+ 2 files changed, 3 insertions(+), 0 deletions(-)
385
+
386
+ * cli: Should be a Thor::Group.
387
+
388
+ Files changed:
389
+ lib/transmuter/cli/thor.rb | 3 ++-
390
+ spec/transmuter/cli/thor_spec.rb | 14 ++++++++++++++
391
+ spec/transmuter/cli_spec.rb | 6 ------
392
+ 3 files changed, 16 insertions(+), 7 deletions(-)
393
+
394
+ * Add active_support gem and include active_support's core extensions.
395
+
396
+ Files changed:
397
+ lib/transmuter.rb | 1 +
398
+ lib/transmuter/core_ext.rb | 3 +++
399
+ transmuter.gemspec | 4 ++--
400
+ 3 files changed, 6 insertions(+), 2 deletions(-)
401
+
402
+ * cli: rename options to thor.
403
+
404
+ Files changed:
405
+ lib/transmuter/cli.rb | 2 +-
406
+ lib/transmuter/cli/options.rb | 6 ------
407
+ lib/transmuter/cli/thor.rb | 6 ++++++
408
+ 3 files changed, 7 insertions(+), 7 deletions(-)
409
+
410
+ * gemspec: Include a good commented section to include active_support, if I
411
+ did need it at some point.
412
+
413
+ Files changed:
414
+ transmuter.gemspec | 3 ++-
415
+ 1 files changed, 2 insertions(+), 1 deletions(-)
416
+
417
+ * cli: The start method is actually defined in Thor and should not be
418
+ overwritten.
419
+
420
+ Files changed:
421
+ lib/transmuter/cli.rb | 3 ---
422
+ 1 files changed, 0 insertions(+), 3 deletions(-)
423
+
424
+ * cli: Add some examples to assure some methods exists, methods are empty
425
+ still!.
426
+
427
+ Files changed:
428
+ lib/transmuter/cli.rb | 9 ++++++++-
429
+ lib/transmuter/cli/execute.rb | 17 +++++++++++++++++
430
+ lib/transmuter/cli/help.rb | 14 ++++++++++++++
431
+ lib/transmuter/cli/options.rb | 6 ++++++
432
+ spec/transmuter/cli_spec.rb | 13 ++++++++++++-
433
+ 5 files changed, 57 insertions(+), 2 deletions(-)
434
+
435
+ * transmuter/cli: initial import.
436
+
437
+ Files changed:
438
+ lib/transmuter.rb | 3 ++-
439
+ lib/transmuter/cli.rb | 6 ++++++
440
+ spec/transmuter/cli_spec.rb | 7 +++++++
441
+ 3 files changed, 15 insertions(+), 1 deletions(-)
442
+
443
+ * Guardfile: Initial Import.
444
+
445
+ Files changed:
446
+ Guardfile | 13 +++++++++++++
447
+ 1 files changed, 13 insertions(+), 0 deletions(-)
448
+
449
+ * spec_helper.rb: ROOT_PATH was not defined.
450
+
451
+ Files changed:
452
+ spec/spec_helper.rb | 3 ++-
453
+ 1 files changed, 2 insertions(+), 1 deletions(-)
454
+
455
+ * Add requirements and the spec_helper.rb file.
456
+
457
+ Files changed:
458
+ Gemfile | 17 +++++++++++++++++
459
+ Rakefile | 7 +++++++
460
+ lib/transmuter.rb | 6 +-----
461
+ lib/transmuter/version.rb | 7 +++----
462
+ spec/spec_helper.rb | 24 ++++++++++++++++++++++++
463
+ transmuter.gemspec | 19 ++++++++++++++++++-
464
+ 6 files changed, 70 insertions(+), 10 deletions(-)
465
+
466
+ * Edit the description.
467
+
468
+ Files changed:
469
+ transmuter.gemspec | 4 ++--
470
+ 1 files changed, 2 insertions(+), 2 deletions(-)
471
+
472
+ * Edit the gemspec file.
473
+
474
+ Files changed:
475
+ transmuter.gemspec | 10 ++--------
476
+ 1 files changed, 2 insertions(+), 8 deletions(-)
477
+
478
+ * Initialize the project.
479
+
480
+ Files changed:
481
+ .gitignore | 4 ++++
482
+ Gemfile | 4 ++++
483
+ Rakefile | 1 +
484
+ lib/transmuter.rb | 5 +++++
485
+ lib/transmuter/version.rb | 8 ++++++++
486
+ transmuter.gemspec | 24 ++++++++++++++++++++++++
487
+ 6 files changed, 46 insertions(+), 0 deletions(-)
488
+
489
+ * Add a README.
490
+
491
+ Files changed:
492
+ README.md | 37 +++++++++++++++++++++++++++++++++++++
493
+ 1 files changed, 37 insertions(+), 0 deletions(-)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Wael Nasreddine <wael.nasreddine@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Transmuter is a command line tool to convert Markdown files into HTML or PDF
4
4
  files, it can also be used to convert HTML files to PDF, it uses in the
5
- backgound [Redcarper](https://github.com/tanoku/redcarpet),
5
+ backgound
6
+ [Redcarpet](https://github.com/tanoku/redcarpet),
7
+ [RedCloth](http://redcloth.org),
6
8
  [Albino](https://github.com/github/albino) and
7
9
  [PDFkit](https://github.com/jdpace/PDFKit).
8
10
 
@@ -68,4 +70,29 @@ Custom CSS files can be be multiple path separated by a space, for example:
68
70
 
69
71
  ```bash
70
72
  $ transmute file.md -t html -s custom1.css custom2.css
71
- ```
73
+ ```
74
+
75
+ # License
76
+
77
+ ## This code is free to use under the terms of the MIT license.
78
+
79
+ Copyright (c) 2011 Wael Nasreddine <wael.nasreddine@gmail.com>
80
+
81
+ Permission is hereby granted, free of charge, to any person obtaining
82
+ a copy of this software and associated documentation files (the
83
+ "Software"), to deal in the Software without restriction, including
84
+ without limitation the rights to use, copy, modify, merge, publish,
85
+ distribute, sublicense, and/or sell copies of the Software, and to
86
+ permit persons to whom the Software is furnished to do so, subject to
87
+ the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be
90
+ included in all copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
93
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
95
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
96
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
97
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
98
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/TODO ADDED
@@ -0,0 +1,14 @@
1
+ - We need to document every module, every class and every function so we'd get a nide documentation from source code.
2
+ (added Mon Oct 3 14:48:03 2011, incomplete, priority veryhigh)
3
+
4
+ - Add an optional Header/Footer option to specify header/footer files, they should be of any supported type.
5
+ (added Mon Oct 3 13:52:16 2011, incomplete, priority medium)
6
+
7
+ - Add an option allowing the user to turn off syntax highlighting
8
+ (added Mon Oct 3 13:54:55 2011, incomplete, priority medium)
9
+
10
+ - Better handle options passed from Thor to Source class, instead of manually setting options[:stylesheets] I think we should just send the options hash
11
+ (added Mon Oct 3 13:56:22 2011, incomplete, priority medium)
12
+
13
+ - The Textile and Markdown classes looks a lot like each other, make some Meta-programming, inheritence may suffice
14
+ (added Mon Oct 3 13:57:32 2011, incomplete, priority medium)
@@ -4,4 +4,14 @@
4
4
  $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
5
5
 
6
6
  require 'transmuter'
7
+
8
+ # Verify requirements
9
+ unless which("pygmentize")
10
+ abort "Please install pygments, please read the README.md file for more information"
11
+ end
12
+
13
+ unless which("wkhtmltopdf")
14
+ abort "Please install wkhtmltopdf, please read the README.md file for more information"
15
+ end
16
+
7
17
  Transmuter::CLI::Runner.start
@@ -1,5 +1,21 @@
1
1
  ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
2
2
 
3
+ # Taken from hub
4
+ # https://github.com/defunkt/hub/blob/master/lib/hub/context.rb#L186
5
+ # Cross-platform way of finding an executable in the $PATH.
6
+ #
7
+ # which('ruby') #=> /usr/bin/ruby
8
+ def which(cmd)
9
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
10
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
11
+ exts.each { |ext|
12
+ exe = "#{path}/#{cmd}#{ext}"
13
+ return exe if File.executable? exe
14
+ }
15
+ end
16
+ return nil
17
+ end
18
+
3
19
  require "transmuter/version"
4
20
  require "transmuter/core_ext"
5
21
  require "transmuter/format"
@@ -80,6 +80,8 @@ module Transmuter
80
80
  case @input.split('.').last
81
81
  when /^(md|markdown)$/
82
82
  "markdown"
83
+ when /^textile/
84
+ "textile"
83
85
  when /^(html|htm)/
84
86
  "html"
85
87
  else
@@ -3,6 +3,7 @@ module Transmuter
3
3
  extend ::ActiveSupport::Autoload
4
4
 
5
5
  autoload :Markdown
6
+ autoload :Textile
6
7
  autoload :Html
7
8
  autoload :Pdf
8
9
  end
@@ -0,0 +1,40 @@
1
+ require 'redcloth'
2
+
3
+ module Transmuter
4
+ module Format
5
+ class Textile
6
+ def initialize(textile, options = {})
7
+ parse_options(options)
8
+ @textile = textile
9
+ end
10
+
11
+ def to_pdf
12
+ html = to_html
13
+ pdf = Pdf.new(html, get_options)
14
+ pdf.process
15
+ end
16
+
17
+ def to_html
18
+ html = Html.new(parse_textile, get_options)
19
+ html.process
20
+ end
21
+
22
+ protected
23
+ def get_options
24
+ @options.dup
25
+ end
26
+
27
+ def parse_options(options)
28
+ @options = options.dup
29
+ end
30
+
31
+ def create_textile
32
+ RedCloth.new(@textile)
33
+ end
34
+
35
+ def parse_textile
36
+ create_textile.to_html
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,7 +1,7 @@
1
1
  module Transmuter
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- PATCH = 1
4
+ PATCH = 2
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
- $:.push File.expand_path("#{ROOT_PATH}/lib")
2
+ $:.push File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
3
 
5
4
  require 'rubygems'
6
5
  require 'rspec'
@@ -0,0 +1,134 @@
1
+ require 'spec_helper'
2
+
3
+ module Format
4
+ describe Textile do
5
+
6
+ let(:textile_h1) { 'h1. Heading 1' }
7
+ let(:html_h1) { '<h1>Heading 1</h1>' }
8
+ let(:textile_ruby) { %(```ruby\ndef say_hi\n "Hello, world!"\nend\n```) }
9
+ let(:html_ruby) { %(<pre lang=\"ruby\"><code>def say_hi\n &quot;Hello, world!&quot;\nend\n</code></pre>\n) }
10
+
11
+ subject { Textile.new(textile_h1, stylesheets: "/path/to/file.css") }
12
+
13
+ before(:each) do
14
+ File.stubs(:read).with('/path/to/file.css').returns('h1 { color: #000; }')
15
+ end
16
+
17
+ describe "#new" do
18
+ it "should require textile" do
19
+ -> { Textile.new }.should raise_error ArgumentError, "wrong number of arguments (0 for 1)"
20
+ end
21
+
22
+ it "should set @textile" do
23
+ m = Textile.new(textile_h1)
24
+ m.instance_variable_get("@textile").should == textile_h1
25
+ end
26
+ end
27
+
28
+ describe "#parse_options" do
29
+ it "should have parse_options as a protected method" do
30
+ Textile.protected_instance_methods.should include(:parse_options)
31
+ end
32
+
33
+ it "should set @options" do
34
+ subject.instance_variable_get('@options').should_not be_empty
35
+ end
36
+ end
37
+
38
+ describe "#create_textile" do
39
+ it "should have create_textile as a protected method" do
40
+ Textile.protected_instance_methods.should include(:create_textile)
41
+ end
42
+
43
+ it "should create a new RedCloth object" do
44
+ m = subject.send :create_textile
45
+ m.should be_instance_of RedCloth::TextileDoc
46
+ end
47
+ end
48
+
49
+ describe "#parse_textile" do
50
+ it "should have parse_textile as a protected method" do
51
+ Textile.protected_instance_methods.should include(:parse_textile)
52
+ end
53
+
54
+ it "should call create_textile" do
55
+ textile = mock()
56
+ textile.stubs(:to_html).returns(true)
57
+ Textile.any_instance.expects(:create_textile).once.returns(textile)
58
+
59
+ subject.send(:parse_textile)
60
+ end
61
+
62
+ it "should call RedCloth.to_html" do
63
+ RedCloth::TextileDoc.any_instance.expects(:to_html).returns(true)
64
+
65
+ subject.send(:parse_textile)
66
+ end
67
+
68
+ it "should render simple textile" do
69
+ subject.send(:parse_textile).should match(%r(#{html_h1}))
70
+ end
71
+ end
72
+
73
+ describe "#to_html" do
74
+ describe "call stach" do
75
+ it "should call parse_textile" do
76
+ Textile.any_instance.expects(:parse_textile).once.returns(html_h1)
77
+
78
+ subject.to_html
79
+ end
80
+
81
+ it "should call process on the Html object" do
82
+ Html.any_instance.expects(:process).once.returns(html_h1)
83
+
84
+ subject.to_html
85
+ end
86
+ end
87
+
88
+ it { should respond_to :to_html }
89
+
90
+ it "should call RedCloth.to_html" do
91
+ RedCloth::TextileDoc.any_instance.expects(:to_html).returns(html_h1)
92
+
93
+ subject.to_html
94
+ end
95
+
96
+ it "should render simple textile" do
97
+ subject.to_html.should match(%r(#{html_h1}))
98
+ end
99
+
100
+ it "should render simple textile and include stylesheets" do
101
+ subject.to_html.should
102
+ match(%r(<html>.*<head>.*<style [^>]*>h1 { color: #000; }.*</style>.*</head>.*<body>.*#{html_h1}.*</body>.*</html>)m)
103
+ end
104
+ end
105
+
106
+ describe "#to_pdf" do
107
+ before(:each) do
108
+ pdfkit_instance = mock()
109
+ pdfkit_instance.stubs(:to_pdf).returns true
110
+ PDFKit = mock() unless defined?(PDFKit)
111
+ PDFKit.stubs(:new).returns(pdfkit_instance)
112
+ end
113
+
114
+ it { should respond_to :to_pdf }
115
+
116
+ describe "call stack" do
117
+
118
+ it "should call to_html" do
119
+ Html.any_instance.expects(:process).returns(html_h1).once
120
+
121
+ subject.to_pdf
122
+ end
123
+
124
+ it "should create a new Pdf object" do
125
+ pdf = mock
126
+ pdf.stubs(:process).returns(true)
127
+ Pdf.expects(:new).returns(pdf).once
128
+
129
+ subject.to_pdf
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Wael Nasreddine"]
9
9
  s.email = ["wael.nasreddine@gmail.com"]
10
10
  s.homepage = ""
11
- s.summary = %q{The Alien device to convert Markdown to PDF with colorized code.}
11
+ s.summary = %q{The Alien device to convert Markdown and Textile files to HTML or PDF.}
12
12
  s.description = s.summary
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'thor', '~>0.14.6'
25
25
  s.add_dependency 'pdfkit', '~>0.5.2'
26
26
  s.add_dependency 'redcarpet', '~>1.17.2'
27
+ s.add_dependency 'RedCloth', '~>4.2.8'
27
28
  s.add_dependency 'albino', '~>1.3.3'
28
29
  s.add_dependency 'nokogiri', '~>1.5.0'
29
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transmuter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &2152151940 !ruby/object:Gem::Requirement
16
+ requirement: &2156675640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152151940
24
+ version_requirements: *2156675640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &2152150240 !ruby/object:Gem::Requirement
27
+ requirement: &2156675180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2152150240
35
+ version_requirements: *2156675180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: thor
38
- requirement: &2152147660 !ruby/object:Gem::Requirement
38
+ requirement: &2156674720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.14.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2152147660
46
+ version_requirements: *2156674720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: pdfkit
49
- requirement: &2152141120 !ruby/object:Gem::Requirement
49
+ requirement: &2156674260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.5.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2152141120
57
+ version_requirements: *2156674260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: redcarpet
60
- requirement: &2152132040 !ruby/object:Gem::Requirement
60
+ requirement: &2156673800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,21 @@ dependencies:
65
65
  version: 1.17.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2152132040
68
+ version_requirements: *2156673800
69
+ - !ruby/object:Gem::Dependency
70
+ name: RedCloth
71
+ requirement: &2156673340 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 4.2.8
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *2156673340
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: albino
71
- requirement: &2152129140 !ruby/object:Gem::Requirement
82
+ requirement: &2156672880 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 1.3.3
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *2152129140
90
+ version_requirements: *2156672880
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: nokogiri
82
- requirement: &2152122960 !ruby/object:Gem::Requirement
93
+ requirement: &2156672420 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 1.5.0
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *2152122960
101
+ version_requirements: *2156672420
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: guard
93
- requirement: &2152118620 !ruby/object:Gem::Requirement
104
+ requirement: &2156671960 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: 0.6.2
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *2152118620
112
+ version_requirements: *2156671960
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: guard-bundler
104
- requirement: &2152113660 !ruby/object:Gem::Requirement
115
+ requirement: &2156671500 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: 0.1.3
110
121
  type: :development
111
122
  prerelease: false
112
- version_requirements: *2152113660
123
+ version_requirements: *2156671500
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: guard-rspec
115
- requirement: &2151940660 !ruby/object:Gem::Requirement
126
+ requirement: &2156671040 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ~>
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: 0.4.3
121
132
  type: :development
122
133
  prerelease: false
123
- version_requirements: *2151940660
134
+ version_requirements: *2156671040
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: rspec
126
- requirement: &2151936960 !ruby/object:Gem::Requirement
137
+ requirement: &2156670580 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ~>
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: 2.6.0
132
143
  type: :development
133
144
  prerelease: false
134
- version_requirements: *2151936960
145
+ version_requirements: *2156670580
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: mocha
137
- requirement: &2151934460 !ruby/object:Gem::Requirement
148
+ requirement: &2156670120 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ~>
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: 0.10.0
143
154
  type: :development
144
155
  prerelease: false
145
- version_requirements: *2151934460
156
+ version_requirements: *2156670120
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: pry
148
- requirement: &2151932660 !ruby/object:Gem::Requirement
159
+ requirement: &2156669660 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ~>
@@ -153,8 +164,8 @@ dependencies:
153
164
  version: 0.9.6.2
154
165
  type: :development
155
166
  prerelease: false
156
- version_requirements: *2151932660
157
- description: The Alien device to convert Markdown to PDF with colorized code.
167
+ version_requirements: *2156669660
168
+ description: The Alien device to convert Markdown and Textile files to HTML or PDF.
158
169
  email:
159
170
  - wael.nasreddine@gmail.com
160
171
  executables:
@@ -163,11 +174,15 @@ extensions: []
163
174
  extra_rdoc_files: []
164
175
  files:
165
176
  - .gitignore
177
+ - .todo
166
178
  - .travis.yml
179
+ - ChangeLog
167
180
  - Gemfile
168
181
  - Guardfile
182
+ - MIT-LICENSE
169
183
  - README.md
170
184
  - Rakefile
185
+ - TODO
171
186
  - bin/transmute
172
187
  - lib/transmuter.rb
173
188
  - lib/transmuter/cli.rb
@@ -178,6 +193,7 @@ files:
178
193
  - lib/transmuter/format/html.rb
179
194
  - lib/transmuter/format/markdown.rb
180
195
  - lib/transmuter/format/pdf.rb
196
+ - lib/transmuter/format/textile.rb
181
197
  - lib/transmuter/version.rb
182
198
  - spec/spec_helper.rb
183
199
  - spec/transmuter/cli/thor_spec.rb
@@ -186,6 +202,7 @@ files:
186
202
  - spec/transmuter/format/html_spec.rb
187
203
  - spec/transmuter/format/markdown_spec.rb
188
204
  - spec/transmuter/format/pdf_spec.rb
205
+ - spec/transmuter/format/textile_spec.rb
189
206
  - spec/transmuter/format_spec.rb
190
207
  - stylesheets/default.css
191
208
  - transmuter.gemspec
@@ -212,7 +229,7 @@ rubyforge_project:
212
229
  rubygems_version: 1.8.10
213
230
  signing_key:
214
231
  specification_version: 3
215
- summary: The Alien device to convert Markdown to PDF with colorized code.
232
+ summary: The Alien device to convert Markdown and Textile files to HTML or PDF.
216
233
  test_files:
217
234
  - spec/spec_helper.rb
218
235
  - spec/transmuter/cli/thor_spec.rb
@@ -221,4 +238,5 @@ test_files:
221
238
  - spec/transmuter/format/html_spec.rb
222
239
  - spec/transmuter/format/markdown_spec.rb
223
240
  - spec/transmuter/format/pdf_spec.rb
241
+ - spec/transmuter/format/textile_spec.rb
224
242
  - spec/transmuter/format_spec.rb