Sha256: 062ac4a9e15b4d1a99e76b0a849205be28c39cef58769baa8b8b27a9d26c8efc

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

#!/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

unless File.exist? File.join(dest, 'jquery-1.11.1.min.js')
  FileUtils.cp(File.join(tpl, 'jquery-1.11.1.min.js'), dest)
end

unless File.exist? File.join(dest, 'shellplay.js')
  FileUtils.cp(File.join(tpl, 'shellplay.js'), dest)
end

unless File.exist? File.join(dest, 'shellplay.css')
  FileUtils.cp(File.join(tpl, 'shellplay.css'), dest)
end

unless File.exist? File.join(dest, 'colors.css')
  File.open(File.join(dest, "colors.css"), 'w') do |f|
    f.puts Shell2html.css
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shellplay-0.1.9 bin/shellexport
shellplay-0.1.8 bin/shellexport
shellplay-0.1.7 bin/shellexport
shellplay-0.1.6 bin/shellexport
shellplay-0.1.5 bin/shellexport
shellplay-0.1.4 bin/shellexport