54 lines
1.0 KiB
Ruby
Executable File
54 lines
1.0 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require 'rubygems'
|
|
require 'bundler'
|
|
|
|
begin
|
|
Bundler.setup(:default)
|
|
rescue Bundler::GemfileNotFound
|
|
$: << File.expand_path('../../lib', __FILE__)
|
|
end
|
|
|
|
require 'thor'
|
|
require 'attentive'
|
|
|
|
begin
|
|
load 'presentation.rb'
|
|
rescue LoadError => e
|
|
end
|
|
|
|
class Attentive::CLI < Thor
|
|
include Thor::Actions
|
|
|
|
default_task :start
|
|
|
|
desc "start", "Start a Rack server for previewing the presentation"
|
|
method_options [ :port, '-p' ] => 9393
|
|
def start
|
|
if Attentive.has_presentation?
|
|
Attentive::Server.start!
|
|
else
|
|
raise Attentive::NoPresentationError
|
|
end
|
|
end
|
|
|
|
def self.source_root
|
|
File.expand_path('../../skel', __FILE__)
|
|
end
|
|
|
|
desc "create", "Create a new skeleton presentation"
|
|
def create(name)
|
|
self.destination_root = File.join(Dir.pwd, name)
|
|
|
|
Dir[File.join(self.class.source_root, '**/*')].each do |file|
|
|
if File.file?(file)
|
|
filename = file.gsub(self.class.source_root + '/', '')
|
|
|
|
template filename, filename
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Attentive::CLI.start
|