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.26.84 bin/rbbt_exec.rb
rbbt-util-5.26.83 bin/rbbt_exec.rb
rbbt-util-5.26.82 bin/rbbt_exec.rb
rbbt-util-5.26.81 bin/rbbt_exec.rb
rbbt-util-5.26.80 bin/rbbt_exec.rb
rbbt-util-5.26.79 bin/rbbt_exec.rb
rbbt-util-5.26.78 bin/rbbt_exec.rb
rbbt-util-5.26.77 bin/rbbt_exec.rb
rbbt-util-5.26.76 bin/rbbt_exec.rb
rbbt-util-5.26.75 bin/rbbt_exec.rb
rbbt-util-5.26.74 bin/rbbt_exec.rb
rbbt-util-5.26.73 bin/rbbt_exec.rb
rbbt-util-5.26.72 bin/rbbt_exec.rb
rbbt-util-5.26.71 bin/rbbt_exec.rb
rbbt-util-5.26.70 bin/rbbt_exec.rb
rbbt-util-5.26.69 bin/rbbt_exec.rb
rbbt-util-5.26.68 bin/rbbt_exec.rb
rbbt-util-5.26.67 bin/rbbt_exec.rb
rbbt-util-5.26.66 bin/rbbt_exec.rb
rbbt-util-5.26.65 bin/rbbt_exec.rb