Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 143 lines (113 sloc) 4.472 kb
#! /usr/bin/env ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'showoff'
require 'rubygems'
require 'gli'
include GLI
version ShowOff::Version
desc 'Create new showoff presentation'
arg_name 'dir_name'
long_desc 'This command helps start a new showoff presentation by setting up the proper directory structure for you. It takes the directory name you would like showoff to create for you.'
command [:create,:init] do |c|
c.desc 'Don''t create sample slides'
c.switch [:n,:nosamples]
c.desc 'sample slide directory name'
c.default_value 'one'
c.flag [:d,:slidedir]
c.action do |global_options,options,args|
raise "dir_name is required" if args.empty?
ShowOffUtils.create(args[0],!options[:n],options[:d])
end
end
desc 'Puts your showoff presentation into a gh-pages branch'
long_desc 'Generates a static version of your presentation into your gh-pages branch for publishing to GitHub Pages'
command :github do |c|
c.action do |global_options,options,args|
ShowOffUtils.github
end
end
desc 'Serves the showoff presentation in the current directory'
desc 'Setup your presentation to serve on Heroku'
arg_name 'heroku_name'
long_desc 'Creates the Gemfile and config.ru file needed to push a showoff pres to heroku. It will then run ''heroku create'' for you to register the new project on heroku and add the remote for you. Then all you need to do is commit the new created files and run ''git push heroku'' to deploy.'
command :heroku do |c|
c.desc 'add password protection to your heroku site'
c.flag [:p,:password]
c.desc 'force overwrite of existing Gemfile/.gems and config.ru files if they exist'
c.switch [:f,:force]
c.desc 'Use older-style .gems file instead of bundler-style Gemfile'
c.switch [:g,:dotgems]
c.action do |global_options,options,args|
raise "heroku_name is required" if args.empty?
ShowOffUtils.heroku(args[0],options[:f],options[:p],options[:g])
end
end
desc 'Serves the showoff presentation in the specified (or current) directory'
arg_name "[pres_dir]"
default_value "."
command :serve do |c|
c.desc 'Port on which to run'
c.default_value "9090"
c.flag [:p,:port]
c.desc 'Host or ip to run on'
c.default_value "localhost"
c.flag [:h,:host]
c.desc 'JSON file used to describe presentation'
c.default_value "showoff.json"
c.flag [:f, :pres_file]
c.action do |global_options,options,args|
ShowOff.run! :host => options[:h], :port => options[:p].to_i, :pres_file => options[:f], :pres_dir => args[0]
end
end
desc 'Add a new slide at the end in a given dir'
arg_name '[title]'
long_desc 'Outputs or creates a new slide. With -d and -n, a new slide is created in the given dir, numbered to appear as the last slide in that dir (use -u to avoid numbering). Without those, outputs the slide markdown to stdout (useful for shelling out from your editor). You may also specify a source file to use for a code slide'
command [:add,:new] do |c|
c.desc 'Don''t number the slide, use the given name verbatim'
c.switch [:u,:nonumber]
c.desc 'Include code from the given file as the slide body'
c.arg_name 'path to file'
c.flag [:s,:source]
c.desc 'Slide Type/Style'
c.arg_name 'valid showoff style/type'
c.default_value 'title'
c.flag [:t,:type,:style]
c.desc 'Slide dir (where to put a new slide file)'
c.arg_name 'dir'
c.flag [:d,:dir]
c.desc 'Slide name (name of the new slide file)'
c.arg_name 'basename'
c.flag [:n,:name]
c.action do |global_options,options,args|
title = args.join(" ")
ShowOffUtils.add_slide(:dir => options[:d],
:name => options[:n],
:title => title,
:number => !options[:u],
:code => options[:s],
:type => options[:t])
end
end
desc 'Generate static version of presentation'
arg_name 'name'
long_desc 'Creates a static, one page version of the presentation as {name}.html'
command [:static] do |c|
c.action do |global_options,options,args|
ShowOff.do_static(args[0])
end
end
pre do |global,command,options,args|
# Pre logic here
# Return true to proceed; false to abourt and not call the
# chosen command
true
end
post do |global,command,options,args|
# Post logic here
end
on_error do |exception|
# Error logic here
# return false to skip default error handling
true
end
exit GLI.run(ARGV)
Jump to Line
Something went wrong with that request. Please try again.