Sha256: c9ae525b027c15e6e50e0f28d1d5ebc1e4a125b8c2b3f9e3d188664cee2cd41c

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

#!/usr/bin/env ruby

$stdout.sync = true

require "bundler/setup"
require "superscript"

if ARGV.length == 0
  puts "USAGE: superscript dsl.rb [script.rb]"
  exit 1
end

best_guess_path = if ARGV[0].start_with? "/"
  ARGV[0]
else
  File.join(".", ARGV[0])
end

require best_guess_path

ctx_classname = File.basename(ARGV[0]).split(".").first.capitalize
ctx = (eval "#{ctx_classname}").new

if ARGV[1]
  runner = Superscript::Runner.new ARGV[1]
  runner.run! ctx
else
  runner = Superscript::Runner.new
  loop do
    print "> "
    contents = STDIN.gets
    value = runner.run! ctx, contents: contents
    puts " => #{value.inspect}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
superscript-0.5.0 exe/superscript
superscript-0.4.2 exe/superscript
superscript-0.4.1 exe/superscript
superscript-0.3.3 exe/superscript