Sha256: 0f40e4a911350071153b1110b2f6d966f81fc43d20379aeb1bd83de057d90806

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby

here = File.expand_path(File.dirname(__FILE__))
$: << File.join(here, '..', 'lib')

require "trollop"
require "rack"
require "deck"
require "deck/rack_app"
require "deck/version"

options = Trollop.options do
  version "deck v#{Deck::VERSION}"
  banner version
  banner "Usage: deck [options] [slides]"
  banner "(see http://github.com/alexch/deck.rb README for more help)"
  opt :port, "Specify alternate port", :default => 4333
  opt :build, "Build an HTML file instead of launching a server (WARNING: not very useful yet)"
end

if options[:build]
  slides = []
  output_path = nil
  output_dir = "."  # for now, since deck.js is relative to the project root

  ARGV.each do |arg|
    # output_dir ||= File.dirname(arg)
    basename ||= File.basename(arg, ".md")
    output_path ||= "#{output_dir}/#{basename}.html"
    slides += Deck::Slide.from_file arg
  end

  File.open(output_path, "w") do |file|
    deck = Deck::SlideDeck.new :slides => slides
    # deck.to_pretty(:output => file)  # todo: figure out why this doesn't work
    file.write deck.to_pretty
  end

else

  port = options[:port]
  slide_files = ARGV
  Rack::Handler.default.run Deck::RackApp.build(slide_files), :Port => port
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deckrb-0.4.2 bin/deck