bin/legion in legionio-0.2.0 vs bin/legion in legionio-0.3.0
- old
+ new
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-# rubocop:disable all
+
require 'optparse'
options = { action: :run }
daemonize_help = 'run daemonized in the background (default: false)'
@@ -26,15 +26,15 @@
op.on('-l', '--log LOGFILE', logfile_help) { |value| options[:logfile] = value }
op.on('-t', '--time 10', time_help) { |value| options[:time_limit] = value }
op.separator ''
op.separator 'Ruby options:'
-op.on('-I', '--include PATH', include_help) {
- |value| $LOAD_PATH.unshift(*value.split(':').map {
- |v| File.expand_path(v)
- })
-}
+op.on('-I', '--include PATH', include_help) do |value|
+ $LOAD_PATH.unshift(*value.split(':').map do |v|
+ File.expand_path(v)
+ end)
+end
op.on('--debug', debug_help) { $DEBUG = true }
op.on('--warn', warn_help) { $-w = true }
op.separator ''
op.separator 'Common options:'
@@ -42,20 +42,9 @@
op.on('-v', '--version') { options[:action] = :version }
op.separator ''
op.parse!(ARGV)
-#==============================================================================
-# EXECUTE script
-#==============================================================================
-
require File.expand_path('lib/legion.rb') unless options[:action] == :help
Legion.start
require File.expand_path('lib/legion/process.rb') unless options[:action] == :help
-# case options[:action]
-# when :help then puts op.to_s
-# when :version then puts Legion::VERSION
-# else
-# Legion::Process.run!(options)
-# end
-
Legion::Process.new(options).run!