Class: RevealCK::Builders::CreateIndexHtml
- Inherits:
-
CreationTask
- Object
- CreationTask
- RevealCK::Builders::CreateIndexHtml
- Defined in:
- lib/reveal-ck/builders/create_index_html.rb
Overview
Given a slides.html, a Rake application, a template for building out a reveal.js index.html, and a place where the resulting index.html file should end up, this class knows how to work with Rake and create the index.html.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#slides_html ⇒ Object
readonly
Returns the value of attribute slides_html.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Attributes inherited from CreationTask
#application, #things_to_create
Instance Method Summary collapse
-
#initialize(args) ⇒ CreateIndexHtml
constructor
A new instance of CreateIndexHtml.
- #setup ⇒ Object
Methods inherited from CreationTask
Methods included from RakeAware
#copy_file, #create_directory, #task
Methods included from Retrieve
Constructor Details
#initialize(args) ⇒ CreateIndexHtml
Returns a new instance of CreateIndexHtml.
12 13 14 15 16 17 18 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 12 def initialize(args) @slides_html = retrieve(:slides_html, args) @template = retrieve(:template, args) @output_dir = retrieve(:output_dir, args) @config = retrieve(:config, args) super end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 10 def config @config end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
10 11 12 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 10 def output_dir @output_dir end |
#slides_html ⇒ Object (readonly)
Returns the value of attribute slides_html.
10 11 12 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 10 def @slides_html end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
10 11 12 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 10 def template @template end |
Instance Method Details
#setup ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/reveal-ck/builders/create_index_html.rb', line 20 def setup index_html_file = "#{output_dir}/index.html" task(index_html_file => ) do content = IndexHtml.new(slides_html: , template: template, config: config).render File.open(index_html_file, 'w') do |index_html| index_html.puts(content) end end things_to_create.add(index_html_file) end |