Sha256: 5a6d67d5a371059c7b2b8760a3a95356bf7b6525ed15b888b503b2d31bdbb1b4

Contents?: true

Size: 1.1 KB

Versions: 18

Compression:

Stored size: 1.1 KB

Contents

require 'rake'

module RevealCK
  module Builders
    # 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.
    class CreateIndexHtml < CreationTask
      attr_reader :slides_html, :template, :output_dir, :config

      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

      def setup
        index_html_file = "#{output_dir}/index.html"
        task(index_html_file => slides_html) do
          content = IndexHtml.new(slides_html: 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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.5.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.5.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.4.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.3.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.3.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.2.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.1.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.0.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-3.0.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.6.2 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.6.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.6.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.5.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.5.0 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.4.2 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.4.1 lib/reveal-ck/builders/create_index_html.rb
reveal-ck-0.4.0 lib/reveal-ck/builders/create_index_html.rb