Sha256: 91a79081a9d4c4879680aaa7bb5d663a833c10eec015f60fc754cc00f3953b89
Contents?: true
Size: 990 Bytes
Versions: 21
Compression:
Stored size: 990 Bytes
Contents
#!/usr/bin/env ruby # encoding: UTF-8 # resolve bin path, ignoring symlinks require "pathname" bin_file = Pathname.new(__FILE__).realpath # add self to libpath $:.unshift File.expand_path("../../lib", bin_file) # Fixes https://github.com/rubygems/rubygems/issues/1420 require "rubygems/specification" module Gem class Specification def this; self; end end end # start up the CLI require "metanorma/cli" metanorma_cli = proc { Metanorma::Cli.start(ARGV) } if ENV["SOCKS_PROXY"] require "socksify" require "uri" begin proxy = URI.parse(ENV["SOCKS_PROXY"]) if proxy.userinfo user, pass = proxy.userinfo.split(":") TCPSocket::socks_username = user TCPSocket::socks_password = pass end Socksify::proxy(proxy.host, proxy.port, &metanorma_cli) rescue URI::InvalidURIError warn "Value of ENV.SOCKS_PROXY=#{ENV['SOCKS_PROXY']} is invalid! Droping it" ENV.delete("SOCKS_PROXY") metanorma_cli.call end else metanorma_cli.call end
Version data entries
21 entries across 21 versions & 1 rubygems