#!/usr/bin/env ruby require 'gli' require 'trickster' require 'erb' require 'fileutils' include GLI::App BASE_DIR = File.expand_path(File.join(File.dirname(__FILE__),'..')) THEMES = Dir[File.join(BASE_DIR,'css','themes') + "/*.css", File.join(BASE_DIR,'css','themes') + "/*.scss"].map { |file| File.basename(file).gsub(/\.css$/,'').gsub(/\.scss/,'') }.sort program_desc 'Bootstrap, generate, and manage your trickster presentation' version Trickster::VERSION def add_theme_flag(command) command.desc "Specify the syntax highlighting theme to use. One of #{THEMES.join(', ')}. Use 'custom' to get an scss file you can easily customize." command.default_value 'default' command.flag [:t,:theme], :must_match => THEMES end desc 'Create a new trickster presentation' long_desc < "custom.js") copier.copy_files('js/lib','js') copier.copy_files('css','css', :except => "styles.css") end end c.desc 'Update the syntax-highlighting theme for your presentation' c.long_desc <<-EOS A normal 'trickster update' will leave your theme.css alone, since you can customize it. This will overwrite your existing theme.css with the theme from trickster that you specify. You should check your presentation into source control to avoid the destructive nature of this command. EOS c.arg_name 'slide_dir' c.command :theme do |theme_command| add_theme_flag(theme_command) theme_command.action do |global_options,options,args| dir = args.shift dir = '.' if dir.nil? theme_copier = Trickster::ThemeCopier.new(BASE_DIR,dir) theme_copier.copy_theme(options[:theme]) end end c.default_command :files end desc 'Generate the presentation from your slides' arg_name '[slides_file]' long_desc <