reveal-ck 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/reveal-ck +18 -12
- data/lib/reveal-ck.rb +3 -10
- data/lib/reveal-ck/builders.rb +4 -0
- data/lib/reveal-ck/builders/build_task.rb +21 -0
- data/lib/reveal-ck/builders/builder.rb +27 -0
- data/lib/reveal-ck/builders/index_html.rb +85 -0
- data/lib/reveal-ck/builders/packaged_slides.rb +84 -0
- data/lib/reveal-ck/changers.rb +3 -0
- data/lib/reveal-ck/changers/slicer.rb +25 -0
- data/lib/reveal-ck/changers/splicer.rb +37 -0
- data/lib/reveal-ck/changers/string_replacer.rb +18 -0
- data/lib/reveal-ck/config.rb +51 -23
- data/lib/reveal-ck/presentation.rb +24 -15
- data/lib/reveal-ck/presentation_dsl.rb +20 -12
- data/lib/reveal-ck/slide.rb +3 -3
- data/lib/reveal-ck/templates.rb +3 -0
- data/lib/reveal-ck/templates/finder.rb +35 -0
- data/lib/reveal-ck/templates/processor.rb +32 -0
- data/lib/reveal-ck/templates/render_scope.rb +14 -0
- data/lib/reveal-ck/version.rb +1 -1
- data/rakelib/examples.rake +7 -0
- data/spec/data/{slicer → changers/slicer}/after_remove +0 -0
- data/spec/data/{slicer → changers/slicer}/before_remove +0 -0
- data/spec/data/{splicer → changers/splicer}/abcd +0 -0
- data/spec/data/{splicer → changers/splicer}/after_insert +0 -0
- data/spec/data/{splicer → changers/splicer}/before_insert +0 -0
- data/spec/data/{string_replacer → changers/string_replacer}/after_replace +0 -0
- data/spec/data/{string_replacer → changers/string_replacer}/before_replace +0 -0
- data/spec/data/config/full_config.toml +7 -0
- data/spec/data/config/partial_config.toml +1 -0
- data/spec/data/presentation/slides.haml +2 -0
- data/spec/data/presentation/slides.rb +5 -0
- data/spec/data/{dsl/slides.rb → presentation_dsl/dsl.rb} +4 -0
- data/spec/data/templates/finder/code/function.rb +3 -0
- data/spec/data/{template_finder/automated/automated.slim → templates/finder/quotes/create} +0 -0
- data/spec/data/{template_finder/automated/common.haml → templates/finder/templates/template_one.slim} +0 -0
- data/spec/data/{template_finder/custom/common.haml → templates/finder/templates/template_two.slim} +0 -0
- data/spec/data/{template_finder/custom/custom.slim → templates/finder/templates/text.slim} +0 -0
- data/spec/data/{haml → templates/processor}/basic.haml +0 -0
- data/spec/data/{slim → templates/processor}/basic.slim +0 -0
- data/spec/data/templates/render_scope/quote +2 -0
- data/spec/examples/programmatic_slides_spec.rb +12 -0
- data/spec/examples/slide_output_spec.rb +12 -0
- data/spec/lib/reveal-ck/builders/builder_spec.rb +39 -0
- data/spec/lib/reveal-ck/builders/packaged_slides_spec.rb +39 -0
- data/spec/lib/reveal-ck/changers/slicer_spec.rb +46 -0
- data/spec/lib/reveal-ck/changers/splicer_spec.rb +45 -0
- data/spec/lib/reveal-ck/changers/string_replacer_spec.rb +35 -0
- data/spec/lib/reveal-ck/config_spec.rb +68 -20
- data/spec/lib/reveal-ck/presentation_dsl_spec.rb +21 -11
- data/spec/lib/reveal-ck/presentation_spec.rb +40 -38
- data/spec/lib/reveal-ck/slide_spec.rb +3 -3
- data/spec/lib/reveal-ck/templates/finder_spec.rb +88 -0
- data/spec/lib/reveal-ck/templates/processor_spec.rb +31 -0
- data/spec/lib/reveal-ck/templates/render_scope_spec.rb +24 -0
- data/templates/{title.slim → intro.slim} +0 -0
- metadata +77 -71
- data/lib/reveal-ck/build_task.rb +0 -19
- data/lib/reveal-ck/builder.rb +0 -25
- data/lib/reveal-ck/file_slicer.rb +0 -23
- data/lib/reveal-ck/file_splicer.rb +0 -36
- data/lib/reveal-ck/file_string_replacer.rb +0 -16
- data/lib/reveal-ck/presentation_builder.rb +0 -94
- data/lib/reveal-ck/slide_builder.rb +0 -81
- data/lib/reveal-ck/slides_html_builder.rb +0 -39
- data/lib/reveal-ck/template_finder.rb +0 -33
- data/lib/reveal-ck/template_processor.rb +0 -28
- data/spec/data/config/config.toml +0 -6
- data/spec/data/html/converted_basic_haml.html +0 -10
- data/spec/data/html/converted_basic_slim.html +0 -10
- data/spec/data/html/reveal-js-index.html +0 -375
- data/spec/data/slides_html_builder/slides.haml +0 -3
- data/spec/data/slides_html_builder/slides.rb +0 -14
- data/spec/data/slides_html_builder/slides.slim +0 -2
- data/spec/lib/reveal-ck/builder_spec.rb +0 -37
- data/spec/lib/reveal-ck/file_slicer_spec.rb +0 -44
- data/spec/lib/reveal-ck/file_splicer_spec.rb +0 -43
- data/spec/lib/reveal-ck/file_string_replacer_spec.rb +0 -34
- data/spec/lib/reveal-ck/presentation_builder_spec.rb +0 -37
- data/spec/lib/reveal-ck/slides_html_builder_spec.rb +0 -102
- data/spec/lib/reveal-ck/template_finder_spec.rb +0 -87
- data/spec/lib/reveal-ck/template_processor_spec.rb +0 -29
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module RevealCK
|
4
|
+
module Templates
|
5
|
+
describe Processor do
|
6
|
+
|
7
|
+
let :slim_file do
|
8
|
+
spec_data 'templates', 'processor', 'basic.slim'
|
9
|
+
end
|
10
|
+
|
11
|
+
let :haml_file do
|
12
|
+
spec_data 'templates', 'processor', 'basic.haml'
|
13
|
+
end
|
14
|
+
|
15
|
+
let :pretty_printed_basic do
|
16
|
+
/<p>\s+This is basic (Slim|Haml)\s+<\/p>/
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'can process a slim template' do
|
20
|
+
processor = Processor.open slim_file
|
21
|
+
processor.output.should match pretty_printed_basic
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'can process a haml template' do
|
25
|
+
processor = Processor.open haml_file
|
26
|
+
processor.output.should match pretty_printed_basic
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module RevealCK
|
4
|
+
module Templates
|
5
|
+
describe RenderScope do
|
6
|
+
|
7
|
+
let :quote_file do
|
8
|
+
spec_data 'templates', 'render_scope', 'quote'
|
9
|
+
end
|
10
|
+
|
11
|
+
let :render_scope do
|
12
|
+
RenderScope.new
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#contents_of' do
|
16
|
+
it 'provides access to a file on the file system' do
|
17
|
+
quote = render_scope.contents_of quote_file
|
18
|
+
expect(quote).to include 'begin it'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reveal-ck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jed Northridge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -279,68 +279,73 @@ files:
|
|
279
279
|
- reveal.js/test/test.html
|
280
280
|
- reveal.js/test/test.js
|
281
281
|
- lib/reveal-ck.rb
|
282
|
-
- lib/reveal-ck/
|
283
|
-
- lib/reveal-ck/
|
282
|
+
- lib/reveal-ck/builders.rb
|
283
|
+
- lib/reveal-ck/builders/build_task.rb
|
284
|
+
- lib/reveal-ck/builders/builder.rb
|
285
|
+
- lib/reveal-ck/builders/index_html.rb
|
286
|
+
- lib/reveal-ck/builders/packaged_slides.rb
|
287
|
+
- lib/reveal-ck/changers.rb
|
288
|
+
- lib/reveal-ck/changers/slicer.rb
|
289
|
+
- lib/reveal-ck/changers/splicer.rb
|
290
|
+
- lib/reveal-ck/changers/string_replacer.rb
|
284
291
|
- lib/reveal-ck/config.rb
|
285
|
-
- lib/reveal-ck/file_slicer.rb
|
286
|
-
- lib/reveal-ck/file_splicer.rb
|
287
|
-
- lib/reveal-ck/file_string_replacer.rb
|
288
292
|
- lib/reveal-ck/presentation.rb
|
289
|
-
- lib/reveal-ck/presentation_builder.rb
|
290
293
|
- lib/reveal-ck/presentation_dsl.rb
|
291
294
|
- lib/reveal-ck/slide.rb
|
292
|
-
- lib/reveal-ck/
|
293
|
-
- lib/reveal-ck/
|
294
|
-
- lib/reveal-ck/
|
295
|
-
- lib/reveal-ck/
|
295
|
+
- lib/reveal-ck/templates.rb
|
296
|
+
- lib/reveal-ck/templates/finder.rb
|
297
|
+
- lib/reveal-ck/templates/processor.rb
|
298
|
+
- lib/reveal-ck/templates/render_scope.rb
|
296
299
|
- lib/reveal-ck/version.rb
|
297
300
|
- rakelib/cane.rake
|
298
301
|
- rakelib/cucumber.rake
|
302
|
+
- rakelib/examples.rake
|
299
303
|
- rakelib/rspec.rake
|
300
304
|
- rakelib/simplecov.rake
|
301
305
|
- templates/code.slim
|
302
306
|
- templates/image.slim
|
307
|
+
- templates/intro.slim
|
303
308
|
- templates/quote.slim
|
304
309
|
- templates/text.slim
|
305
|
-
- templates/title.slim
|
306
310
|
- README.md
|
307
311
|
- features/data/images/ruby100.png
|
308
312
|
- features/step_definitions/file_management_steps.rb
|
309
313
|
- features/support/env.rb
|
310
314
|
- features/support/file_management.rb
|
311
|
-
- spec/data/
|
312
|
-
- spec/data/
|
313
|
-
- spec/data/
|
314
|
-
- spec/data/
|
315
|
-
- spec/data/
|
316
|
-
- spec/data/
|
317
|
-
- spec/data/
|
318
|
-
- spec/data/
|
319
|
-
- spec/data/
|
320
|
-
- spec/data/
|
321
|
-
- spec/data/
|
322
|
-
- spec/data/
|
323
|
-
- spec/data/
|
324
|
-
- spec/data/
|
325
|
-
- spec/data/
|
326
|
-
- spec/data/
|
327
|
-
- spec/data/
|
328
|
-
- spec/data/
|
329
|
-
- spec/data/
|
330
|
-
- spec/data/
|
331
|
-
- spec/
|
332
|
-
- spec/
|
315
|
+
- spec/data/changers/slicer/after_remove
|
316
|
+
- spec/data/changers/slicer/before_remove
|
317
|
+
- spec/data/changers/splicer/abcd
|
318
|
+
- spec/data/changers/splicer/after_insert
|
319
|
+
- spec/data/changers/splicer/before_insert
|
320
|
+
- spec/data/changers/string_replacer/after_replace
|
321
|
+
- spec/data/changers/string_replacer/before_replace
|
322
|
+
- spec/data/config/full_config.toml
|
323
|
+
- spec/data/config/partial_config.toml
|
324
|
+
- spec/data/presentation/slides.haml
|
325
|
+
- spec/data/presentation/slides.rb
|
326
|
+
- spec/data/presentation_dsl/dsl.rb
|
327
|
+
- spec/data/templates/finder/code/function.rb
|
328
|
+
- spec/data/templates/finder/quotes/create
|
329
|
+
- spec/data/templates/finder/templates/template_one.slim
|
330
|
+
- spec/data/templates/finder/templates/template_two.slim
|
331
|
+
- spec/data/templates/finder/templates/text.slim
|
332
|
+
- spec/data/templates/processor/basic.haml
|
333
|
+
- spec/data/templates/processor/basic.slim
|
334
|
+
- spec/data/templates/render_scope/quote
|
335
|
+
- spec/examples/programmatic_slides_spec.rb
|
336
|
+
- spec/examples/slide_output_spec.rb
|
337
|
+
- spec/lib/reveal-ck/builders/builder_spec.rb
|
338
|
+
- spec/lib/reveal-ck/builders/packaged_slides_spec.rb
|
339
|
+
- spec/lib/reveal-ck/changers/slicer_spec.rb
|
340
|
+
- spec/lib/reveal-ck/changers/splicer_spec.rb
|
341
|
+
- spec/lib/reveal-ck/changers/string_replacer_spec.rb
|
333
342
|
- spec/lib/reveal-ck/config_spec.rb
|
334
|
-
- spec/lib/reveal-ck/file_slicer_spec.rb
|
335
|
-
- spec/lib/reveal-ck/file_splicer_spec.rb
|
336
|
-
- spec/lib/reveal-ck/file_string_replacer_spec.rb
|
337
|
-
- spec/lib/reveal-ck/presentation_builder_spec.rb
|
338
343
|
- spec/lib/reveal-ck/presentation_dsl_spec.rb
|
339
344
|
- spec/lib/reveal-ck/presentation_spec.rb
|
340
345
|
- spec/lib/reveal-ck/slide_spec.rb
|
341
|
-
- spec/lib/reveal-ck/
|
342
|
-
- spec/lib/reveal-ck/
|
343
|
-
- spec/lib/reveal-ck/
|
346
|
+
- spec/lib/reveal-ck/templates/finder_spec.rb
|
347
|
+
- spec/lib/reveal-ck/templates/processor_spec.rb
|
348
|
+
- spec/lib/reveal-ck/templates/render_scope_spec.rb
|
344
349
|
- spec/lib/reveal-ck_spec.rb
|
345
350
|
- bin/reveal-ck
|
346
351
|
homepage: https://github.com/jedcn/reveal-ck
|
@@ -373,37 +378,38 @@ test_files:
|
|
373
378
|
- features/step_definitions/file_management_steps.rb
|
374
379
|
- features/support/env.rb
|
375
380
|
- features/support/file_management.rb
|
376
|
-
- spec/data/
|
377
|
-
- spec/data/
|
378
|
-
- spec/data/
|
379
|
-
- spec/data/
|
380
|
-
- spec/data/
|
381
|
-
- spec/data/
|
382
|
-
- spec/data/
|
383
|
-
- spec/data/
|
384
|
-
- spec/data/
|
385
|
-
- spec/data/
|
386
|
-
- spec/data/
|
387
|
-
- spec/data/
|
388
|
-
- spec/data/
|
389
|
-
- spec/data/
|
390
|
-
- spec/data/
|
391
|
-
- spec/data/
|
392
|
-
- spec/data/
|
393
|
-
- spec/data/
|
394
|
-
- spec/data/
|
395
|
-
- spec/data/
|
396
|
-
- spec/
|
397
|
-
- spec/
|
381
|
+
- spec/data/changers/slicer/after_remove
|
382
|
+
- spec/data/changers/slicer/before_remove
|
383
|
+
- spec/data/changers/splicer/abcd
|
384
|
+
- spec/data/changers/splicer/after_insert
|
385
|
+
- spec/data/changers/splicer/before_insert
|
386
|
+
- spec/data/changers/string_replacer/after_replace
|
387
|
+
- spec/data/changers/string_replacer/before_replace
|
388
|
+
- spec/data/config/full_config.toml
|
389
|
+
- spec/data/config/partial_config.toml
|
390
|
+
- spec/data/presentation/slides.haml
|
391
|
+
- spec/data/presentation/slides.rb
|
392
|
+
- spec/data/presentation_dsl/dsl.rb
|
393
|
+
- spec/data/templates/finder/code/function.rb
|
394
|
+
- spec/data/templates/finder/quotes/create
|
395
|
+
- spec/data/templates/finder/templates/template_one.slim
|
396
|
+
- spec/data/templates/finder/templates/template_two.slim
|
397
|
+
- spec/data/templates/finder/templates/text.slim
|
398
|
+
- spec/data/templates/processor/basic.haml
|
399
|
+
- spec/data/templates/processor/basic.slim
|
400
|
+
- spec/data/templates/render_scope/quote
|
401
|
+
- spec/examples/programmatic_slides_spec.rb
|
402
|
+
- spec/examples/slide_output_spec.rb
|
403
|
+
- spec/lib/reveal-ck/builders/builder_spec.rb
|
404
|
+
- spec/lib/reveal-ck/builders/packaged_slides_spec.rb
|
405
|
+
- spec/lib/reveal-ck/changers/slicer_spec.rb
|
406
|
+
- spec/lib/reveal-ck/changers/splicer_spec.rb
|
407
|
+
- spec/lib/reveal-ck/changers/string_replacer_spec.rb
|
398
408
|
- spec/lib/reveal-ck/config_spec.rb
|
399
|
-
- spec/lib/reveal-ck/file_slicer_spec.rb
|
400
|
-
- spec/lib/reveal-ck/file_splicer_spec.rb
|
401
|
-
- spec/lib/reveal-ck/file_string_replacer_spec.rb
|
402
|
-
- spec/lib/reveal-ck/presentation_builder_spec.rb
|
403
409
|
- spec/lib/reveal-ck/presentation_dsl_spec.rb
|
404
410
|
- spec/lib/reveal-ck/presentation_spec.rb
|
405
411
|
- spec/lib/reveal-ck/slide_spec.rb
|
406
|
-
- spec/lib/reveal-ck/
|
407
|
-
- spec/lib/reveal-ck/
|
408
|
-
- spec/lib/reveal-ck/
|
412
|
+
- spec/lib/reveal-ck/templates/finder_spec.rb
|
413
|
+
- spec/lib/reveal-ck/templates/processor_spec.rb
|
414
|
+
- spec/lib/reveal-ck/templates/render_scope_spec.rb
|
409
415
|
- spec/lib/reveal-ck_spec.rb
|
data/lib/reveal-ck/build_task.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module RevealCK
|
2
|
-
#
|
3
|
-
# Public: A BuildTask couple a written description (in the form of a
|
4
|
-
# string) with an action in (the form of a proc). It executes the
|
5
|
-
# proc on demand via go!
|
6
|
-
#
|
7
|
-
class BuildTask
|
8
|
-
|
9
|
-
def initialize(description, action)
|
10
|
-
@description = description
|
11
|
-
@action = action
|
12
|
-
end
|
13
|
-
|
14
|
-
def go
|
15
|
-
@action.call
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
data/lib/reveal-ck/builder.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module RevealCK
|
2
|
-
#
|
3
|
-
# Public: A Builder knows how to execute BuildTasks. These are added
|
4
|
-
# via add_task, and executed via build!
|
5
|
-
#
|
6
|
-
# It is expected to be subclassed, and the subclass must override
|
7
|
-
# register_tasks.
|
8
|
-
#
|
9
|
-
class Builder
|
10
|
-
|
11
|
-
def register_tasks
|
12
|
-
raise 'Subclasses must implement register_tasks'
|
13
|
-
end
|
14
|
-
|
15
|
-
def add_task(description, &action)
|
16
|
-
@tasks << BuildTask.new(description, action)
|
17
|
-
end
|
18
|
-
|
19
|
-
def build!
|
20
|
-
register_tasks unless @tasks
|
21
|
-
@tasks.each { |task| task.go }
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module RevealCK
|
2
|
-
#
|
3
|
-
# Public: A FileSlicer knows how to remove a section of a file.
|
4
|
-
#
|
5
|
-
class FileSlicer
|
6
|
-
|
7
|
-
def self.remove!(slice_file, range)
|
8
|
-
lines = File.open(slice_file).readlines
|
9
|
-
slicer = FileSlicer.new lines
|
10
|
-
sliced_lines = slicer.remove range
|
11
|
-
File.open(slice_file, 'w') { |file| file << sliced_lines.join }
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(lines)
|
15
|
-
@lines = lines
|
16
|
-
end
|
17
|
-
|
18
|
-
def remove(range)
|
19
|
-
@lines.select.with_index { |line, index| ! range.cover? index }
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module RevealCK
|
2
|
-
#
|
3
|
-
# Public: A FileSplicer knows how to insert a list of lines into a
|
4
|
-
# file.
|
5
|
-
#
|
6
|
-
class FileSplicer
|
7
|
-
|
8
|
-
def initialize(lines)
|
9
|
-
@lines = lines
|
10
|
-
end
|
11
|
-
|
12
|
-
def insert(new_lines, opts)
|
13
|
-
index = @lines.each.with_index do |line, i|
|
14
|
-
break i + 1 if line.include? opts[:after]
|
15
|
-
end
|
16
|
-
@lines.insert(index, new_lines).flatten
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.insert!(to_insert, opts)
|
20
|
-
to_insert_lines = readlines to_insert
|
21
|
-
insert_into_file = opts[:into]
|
22
|
-
insert_into_lines = readlines insert_into_file
|
23
|
-
|
24
|
-
splicer = FileSplicer.new insert_into_lines
|
25
|
-
spliced_lines = splicer.insert to_insert_lines, after: opts[:after]
|
26
|
-
File.open(insert_into_file, 'w') { |file| file << spliced_lines.join }
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def self.readlines(file)
|
32
|
-
File.open(file).readlines
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module RevealCK
|
2
|
-
#
|
3
|
-
# Public: A FileStringReplacer knows how to replace one string
|
4
|
-
# in a file with another.
|
5
|
-
#
|
6
|
-
class FileStringReplacer
|
7
|
-
|
8
|
-
def self.replace!(file, args)
|
9
|
-
old, new = args[:old], args[:new]
|
10
|
-
lines = File.open(file).read
|
11
|
-
lines = lines.sub old, new
|
12
|
-
File.open(file, 'w') { |file| file << lines }
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module RevealCK
|
4
|
-
#
|
5
|
-
# Public: A PresentationBuilder knows how to bundle together all of
|
6
|
-
# the various files that makeup a reveal.js presentation
|
7
|
-
#
|
8
|
-
class PresentationBuilder < Builder
|
9
|
-
|
10
|
-
attr_reader :image_files, :slides_file, :config
|
11
|
-
attr_reader :tasks
|
12
|
-
|
13
|
-
def initialize(args)
|
14
|
-
@image_files = args[:image_files]
|
15
|
-
@slides_file = args[:slides_file]
|
16
|
-
@presentation = args[:presentation]
|
17
|
-
missing_info = 'either :slides_file or :presentation is required'
|
18
|
-
raise missing_info unless @slides_file || @presentation
|
19
|
-
@output_dir = args[:output_dir]
|
20
|
-
@config = args[:config]
|
21
|
-
end
|
22
|
-
|
23
|
-
def output_dir(child = nil)
|
24
|
-
if child
|
25
|
-
File.join(@output_dir, child)
|
26
|
-
else
|
27
|
-
@output_dir
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def register_tasks
|
34
|
-
@tasks = []
|
35
|
-
slides_html = output_dir 'slides.html'
|
36
|
-
create_dir output_dir
|
37
|
-
transform_slides @slides_file, @presentation, slides_html
|
38
|
-
bundle_revealjs output_dir
|
39
|
-
bundle_image_files image_files, output_dir('images')
|
40
|
-
config = @presentation || @config
|
41
|
-
create_index_html slides_html, output_dir('index.html'), config
|
42
|
-
end
|
43
|
-
|
44
|
-
def create_dir(dir)
|
45
|
-
add_task "Ensuring #{dir}/ exists" do
|
46
|
-
FileUtils.mkdir_p dir, verbose: false
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def transform_slides(slides_file, presentation, slides_html)
|
51
|
-
if slides_file
|
52
|
-
description = "Transforming #{slides_file} into '#{slides_html}'}"
|
53
|
-
builder = SlidesHtmlBuilder.new input_file: slides_file
|
54
|
-
else
|
55
|
-
description = "Transforming Presentation into '#{slides_html}'}"
|
56
|
-
builder = SlidesHtmlBuilder.new presentation: presentation
|
57
|
-
end
|
58
|
-
add_task description do
|
59
|
-
builder.write_to file: slides_html
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundle_revealjs(output_dir)
|
64
|
-
add_task "Bundling up the revealjs stuff into #{output_dir}/" do
|
65
|
-
FileUtils.cp_r(RevealCK::REVEALJS_FILES,
|
66
|
-
output_dir,
|
67
|
-
verbose: false)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def bundle_image_files(image_files, image_output_dir)
|
72
|
-
if image_files
|
73
|
-
add_task "Copying in images into '#{image_output_dir}'" do
|
74
|
-
FileUtils.mkdir_p(image_output_dir, verbose: false)
|
75
|
-
FileUtils.cp_r(image_files,
|
76
|
-
image_output_dir,
|
77
|
-
verbose: false)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def create_index_html(slides_html, index_html, config)
|
83
|
-
add_task 'Creating slides/index.html' do
|
84
|
-
slide_builder =
|
85
|
-
SlideBuilder.new({
|
86
|
-
user_slides: slides_html,
|
87
|
-
reveal_slides: index_html,
|
88
|
-
config: config
|
89
|
-
})
|
90
|
-
slide_builder.build!
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|