Sha256: badba1027e7e7bfb3df28bfbc5e7e608d218ea0b09dd49e9f87eeabfcc3535e8

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 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"
require "thin" # i hate webrick

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)"
  opt :style, "Specify the style theme from deck.js/themes/style/", default: "swiss"
  opt :transition, "Specify the transition theme from deck.js/themes/transition/", default: "horizontal-slide"
end

if options.delete(: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  #todo: pass theme options
    # deck.to_pretty(:output => file)  # todo: figure out why this doesn't work
    file.write deck.to_pretty
  end

else

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deckrb-0.5.2 bin/deck
deckrb-0.5.1 bin/deck
deckrb-0.5.0 bin/deck