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

Version Path
metanorma-cli-1.5.3 exe/metanorma
metanorma-cli-1.5.3pre1 exe/metanorma
metanorma-cli-1.5.3pre exe/metanorma
metanorma-cli-1.5.2 exe/metanorma
metanorma-cli-1.5.2pre exe/metanorma
metanorma-cli-1.5.1 exe/metanorma
metanorma-cli-1.5.1pre exe/metanorma
metanorma-cli-1.5.0 exe/metanorma
metanorma-cli-1.5.0pre exe/metanorma
metanorma-cli-1.4.18 exe/metanorma
metanorma-cli-1.4.18pre exe/metanorma
metanorma-cli-1.4.17 exe/metanorma
metanorma-cli-1.4.17pre exe/metanorma
metanorma-cli-1.4.16 exe/metanorma
metanorma-cli-1.4.16pre exe/metanorma
metanorma-cli-1.4.15 exe/metanorma
metanorma-cli-1.4.15pre exe/metanorma
metanorma-cli-1.4.14 exe/metanorma
metanorma-cli-1.4.14pre exe/metanorma
metanorma-cli-1.4.13 exe/metanorma