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.34.16 bin/rbbt_exec.rb
rbbt-util-5.34.15 bin/rbbt_exec.rb
rbbt-util-5.34.14 bin/rbbt_exec.rb
rbbt-util-5.34.13 bin/rbbt_exec.rb
rbbt-util-5.34.12 bin/rbbt_exec.rb
rbbt-util-5.34.11 bin/rbbt_exec.rb
rbbt-util-5.34.10 bin/rbbt_exec.rb
rbbt-util-5.34.9 bin/rbbt_exec.rb
rbbt-util-5.34.8 bin/rbbt_exec.rb
rbbt-util-5.34.7 bin/rbbt_exec.rb
rbbt-util-5.34.5 bin/rbbt_exec.rb
rbbt-util-5.34.4 bin/rbbt_exec.rb
rbbt-util-5.34.3 bin/rbbt_exec.rb
rbbt-util-5.34.2 bin/rbbt_exec.rb
rbbt-util-5.34.1 bin/rbbt_exec.rb
rbbt-util-5.34.0 bin/rbbt_exec.rb
rbbt-util-5.33.21 bin/rbbt_exec.rb
rbbt-util-5.33.20 bin/rbbt_exec.rb
rbbt-util-5.33.19 bin/rbbt_exec.rb
rbbt-util-5.33.18 bin/rbbt_exec.rb