Sha256: b81b69921c039224fa6e72d20e61ef3e0dc3b72588a5dc639759ed6e82b2a021

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 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, :index_html, :output_dir, :config

      def initialize(args)
        @slides_html = retrieve(:slides_html, args)
        @index_html = retrieve(:index_html, 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,
                                  index_file: index_html,
                                  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

1 entries across 1 versions & 1 rubygems

Version Path
reveal-ck-0.3.0 lib/reveal-ck/builders/create_index_html.rb