Sha256: eb48c694835c6a17579fceaa34e2a6411e6476017396b0bcaa8af0c3e495fdf4
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
#!/usr/bin/env ruby here = File.expand_path(File.dirname(__FILE__)) root = File.join(here, '..') $: << File.join(here, '..', 'lib') require "rack" require "deck" require "deck/app" command = ARGV.shift case command when '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 += Slide.from_file arg end File.open(output_path, "w") do |file| deck = Deck.new :slides => slides # deck.to_pretty(:output => file) # todo: figure out why this doesn't work file.write deck.to_pretty end when 'run' # Fix Rack bug https://github.com/rack/rack/issues/301 require 'deck/rack_static_patch' port = 4333 # todo: option app = Rack::Builder.app do use Rack::ShowExceptions use Rack::ShowStatus use Rack::Static, :urls => ["/deck"], :root => root run Deck::App.new(Dir.pwd, ARGV) end Rack::Handler.default.run app, :Port => port else puts "Unknown command '#{command}'" puts <<-USAGE Usage: deck build src.md... deck run src.md... USAGE exit 1 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deckrb-0.1.0 | bin/deck |