Sha256: 769e1d89c04d4dfeffc6e6e40693bc2fb31db13b77957f9364891dfaba800f4c

Contents?: true

Size: 765 Bytes

Versions: 264

Compression:

Stored size: 765 Bytes

Contents

#!/usr/bin/env ruby

code_file = ARGV[0]
output = ARGV[1]

require 'rbbt-util'

code = case 
       when (code_file.nil? or code_file == '-')
         STDIN.read
       else
         Open.read(code_file)
       end

begin
  if code_file.nil?
    data = instance_eval code
  else
    data = instance_eval code, code_file
  end
rescue Exception
  puts "#:rbbt_exec Error"
  puts $!.message
  puts $!.backtrace * "\n"
  exit(-1)
end

#data = data.to_s(:sort) if TSV === data
data = data * "\n" if Array === data

case
when (output.nil? or output == '-')
  puts data
when output == "file"
  if Misc.filename? data
    tmpfile = data
  else
    tmpfile = TmpFile.tmp_file
    Open.write(tmpfile, data.to_s)
  end

  puts tmpfile
else
  Open.write(output, data.to_s)
end

Version data entries

264 entries across 264 versions & 1 rubygems

Version Path
rbbt-util-5.32.26 bin/rbbt_exec.rb
rbbt-util-5.32.25 bin/rbbt_exec.rb
rbbt-util-5.32.24 bin/rbbt_exec.rb
rbbt-util-5.32.23 bin/rbbt_exec.rb
rbbt-util-5.32.22 bin/rbbt_exec.rb
rbbt-util-5.32.21 bin/rbbt_exec.rb
rbbt-util-5.32.20 bin/rbbt_exec.rb
rbbt-util-5.32.18 bin/rbbt_exec.rb
rbbt-util-5.32.17 bin/rbbt_exec.rb
rbbt-util-5.32.16 bin/rbbt_exec.rb
rbbt-util-5.32.15 bin/rbbt_exec.rb
rbbt-util-5.32.13 bin/rbbt_exec.rb
rbbt-util-5.32.12 bin/rbbt_exec.rb
rbbt-util-5.32.11 bin/rbbt_exec.rb
rbbt-util-5.32.10 bin/rbbt_exec.rb
rbbt-util-5.32.9 bin/rbbt_exec.rb
rbbt-util-5.32.7 bin/rbbt_exec.rb
rbbt-util-5.32.6 bin/rbbt_exec.rb
rbbt-util-5.32.5 bin/rbbt_exec.rb
rbbt-util-5.32.4 bin/rbbt_exec.rb