#!/usr/bin/env ruby require 'paint' require 'erb' require "shell2html" lib = File.expand_path('../../lib', __FILE__) tpl = File.expand_path('../../tpl', __FILE__) basedir = File.join(ENV['HOME'], '.shellplay') $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'shellplay/session' @session = Shellplay::Session.new @session.import(ARGV[0]) dest = File.join(basedir, @session.name) FileUtils.mkdir_p(dest) unless Dir.exist? dest erb = ERB.new(File.read(File.join(tpl, 'index.html'))) File.open(File.join(dest, "index.html"), 'w') do |f| f.puts erb.result(binding) end FileUtils.cp(File.join(tpl, 'jquery-1.11.1.min.js'), dest) FileUtils.cp(File.join(tpl, 'shellplay.js'), dest) FileUtils.cp(File.join(tpl, 'shellplay.css'), dest) File.open(File.join(dest, "colors.css"), 'w') do |f| f.puts Shell2html.css end