Sha256: cd98c724d4df598d238c42cdef60b40789dbfbd48cd29fa332b06b65366eb18d

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib]))
require "eye/loader"
require "optparse"
require "eye/patch"

options = { debug: false }

OptionParser.new do |opts|
  opts.on("-h", "--help", "Display this screen") do
    puts opts
    exit
  end

  opts.on("-c", "--config CONFIG", "load with config") do |config_path|
    options[:config] = config_path
  end

  opts.on("-s", "--socket SOCKET", "start listen on socket") do |socket_path|
    options[:socket_path] = socket_path
  end

  opts.on("-l", "--logger LOGGER", "custom logger") do |logger|
    options[:logger] = logger
  end

  opts.on("-d", "--debug", "debug info to logger") do
    options[:debug] = true
  end
end.parse!

Eye::Local.ensure_eye_dir

socket_path = options[:socket_path] || Eye::Local.socket_path
server = Eye::Server.new(socket_path)

Eye::Logger.log_level = options[:debug] ? Logger::DEBUG : Logger::INFO
Eye::Logger.link_logger(options[:logger]) if options[:logger]

config = options[:config]
config = File.expand_path(config) if config && !config.empty?

if config
  res = server.command("load", config)
  exit if res.values.any? { |r| r[:error] }
end

Eye::Control.set_proc_line

server.async.run

trap("INT") { exit }
trap("USR1") { Eye::Logger.reopen }
trap("USR2") { GC.start }

sleep

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eye-patch-1.1.0 bin/eye-patch-loader
eye-patch-1.0.1 bin/eye-patch-loader
eye-patch-1.0.0 bin/eye-patch-loader