Sha256: 268e21246d4bb2ce6aa2799166dbf2e8e0f8f8281494456753bd2b56390e82d6
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'slop' require 'ring/sqa' module Ring class SQA class CLI attr_reader :opts def run pid = $$ puts "Running as pid: #{pid}" Process.daemon if @opts.daemonize? SQA.new rescue => error crash error raise end private def initialize _args, @opts = opts_parse CFG.debug = @opts.debug? CFG.afi = @opts.ipv6? ? "ipv6" : "ipv4" CFG.fake = @opts.fake? require_relative 'log' Log.level = Logger::DEBUG if @opts.debug? run end def opts_parse slop = Slop.new(:help=>true) do banner 'Usage: ring-sqad [options]' on 'd', '--debug', 'turn on debugging' on '6', '--ipv6', 'use ipv6 instead of ipv4' on '--fake', 'initialize analyzebuffer with 0 nodes' on '--daemonize', 'run in background' end [slop.parse!, slop] end def crash error file = File.join '/tmp', "crash.txt.#{$$}" open file, 'w' do |file| file.puts error.class.to_s + ' => ' + error.message file.puts '-' * 70 file.puts error.backtrace file.puts '-' * 70 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ring-sqa-0.1.4 | lib/ring/sqa/cli.rb |
ring-sqa-0.1.3 | lib/ring/sqa/cli.rb |