Sha256: eb9c23c66ff65e6224b5788ea8e3391c1f05aa74a7cc7b789bd3f2bbe4aa6a2d

Contents?: true

Size: 761 Bytes

Versions: 46

Compression:

Stored size: 761 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, true) 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)
  end

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
rbbt-util-5.5.32 bin/rbbt_exec.rb
rbbt-util-5.5.31 bin/rbbt_exec.rb
rbbt-util-5.5.30 bin/rbbt_exec.rb
rbbt-util-5.5.29 bin/rbbt_exec.rb
rbbt-util-5.5.28 bin/rbbt_exec.rb
rbbt-util-5.5.27 bin/rbbt_exec.rb
rbbt-util-5.5.26 bin/rbbt_exec.rb
rbbt-util-5.5.25 bin/rbbt_exec.rb
rbbt-util-5.5.24 bin/rbbt_exec.rb
rbbt-util-5.5.23 bin/rbbt_exec.rb
rbbt-util-5.5.22 bin/rbbt_exec.rb
rbbt-util-5.5.21 bin/rbbt_exec.rb
rbbt-util-5.5.20 bin/rbbt_exec.rb
rbbt-util-5.5.19 bin/rbbt_exec.rb
rbbt-util-5.5.18 bin/rbbt_exec.rb
rbbt-util-5.5.17 bin/rbbt_exec.rb
rbbt-util-5.5.16 bin/rbbt_exec.rb
rbbt-util-5.5.15 bin/rbbt_exec.rb
rbbt-util-5.5.14 bin/rbbt_exec.rb
rbbt-util-5.5.13 bin/rbbt_exec.rb