rrrene/sparkr

View on GitHub
bin/sparkr

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

# @return [String] the path of sparkr's lib directory
def find_lib_path
  path = __FILE__
  while File.symlink?(path)
    path = File.expand_path(File.readlink(path), File.dirname(path))
  end
  File.join(File.dirname(File.expand_path(path)), '..', 'lib')
end

# @return [Array<String>] the arguments passed or piped via the command-line
def cli_arguments
  STDIN.tty? ? ARGV : STDIN.read.split(/\s+/)
end

$LOAD_PATH.unshift(find_lib_path)

require 'sparkr'
Sparkr::CLI.run(*cli_arguments)