Sha256: 2f32e73fec9914adf55f508021ccfc57abe7a94cda05ef15a05288d563452585

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')

require 'shining'

ACTIONS   = {
  :new_on!            => ['build'],
  :new_slide!         => ['slide'],
  :compile_templates! => ['compile'],
  :vendorize          => ['vendor', 'vendorize'],
  :play               => ['play', 'go']
}

def bail! reason
  Shining.error reason
  exit -2
end

def figure_what_to_do!
  help_and_exit! if ARGV.empty?
  if ACTIONS.values.flatten.include? ARGV.first
    action = ACTIONS.select { |action, args| args.include? ARGV.first }.flatten.first
    send action, *ARGV[1..(ARGV.length - 1)]
  else
    new_on! ARGV.first
  end
end

def help_and_exit!
  STDERR.puts <<-HELP
Shine - Generates a new Shining presentation
  Usage:
    shine <directory>
  Example:
    shine mycoolpreso
  HELP
  exit -1
end

def new_on! dir
  Shining::Preso.new dir
end

def new_slide! name, format = 'html'
  preso = Shining::Preso.open Dir.pwd
  preso.new_slide "#{name}.#{format}", :with => ['styles', 'script']
end

def vendorize
  preso = Shining::Preso.open Dir.pwd
  bail! 'This preso seems vendorized already.' if preso.vendorized?
  preso.vendorize!
end

def compile_templates!
  preso = Shining::Preso.open Dir.pwd
  preso.compile_templates!
end

def play
  preso = Shining::Preso.open Dir.pwd
  player = Shining::Player.new preso
  player.go!
end

figure_what_to_do!

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shining-1.1.7 bin/shine
shining-1.1.5 bin/shine
shining-1.1.4 bin/shine
shining-1.1.3 bin/shine
shining-1.1.2 bin/shine
shining-1.1.1 bin/shine
shining-1.1.0 bin/shine