attentive/bin/attentive

54 lines
1.0 KiB
Plaintext
Raw Normal View History

2012-02-09 22:05:12 +00:00
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default)
rescue Bundler::GemfileNotFound
$: << File.expand_path('../../lib', __FILE__)
end
2012-02-10 22:02:20 +00:00
require 'thor'
2012-02-09 22:05:12 +00:00
require 'attentive'
begin
load 'presentation.rb'
rescue LoadError => e
end
2012-02-09 22:05:12 +00:00
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?
2012-02-13 17:10:05 +00:00
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
2012-02-09 22:05:12 +00:00
end
Attentive::CLI.start