lib/methadone/main.rb in methadone-1.9.5 vs lib/methadone/main.rb in methadone-2.0.0
- old
+ new
@@ -323,10 +323,12 @@
normalize_defaults
set_defaults_from_env_var
end
def add_defaults_to_docs
+ @env_var = nil unless defined? @env_var
+ @rc_file = nil unless defined? @rc_file
if @env_var && @rc_file
opts.separator ''
opts.separator 'Default values can be placed in:'
opts.separator ''
opts.separator " #{@env_var} environment variable, as a String of options"
@@ -349,11 +351,11 @@
end
end
end
def set_defaults_from_rc_file
- if @rc_file && File.exists?(@rc_file)
+ if @rc_file && File.exist?(@rc_file)
File.open(@rc_file) do |file|
parsed = begin
YAML::load(file)
rescue => ex
logger.error ex.message unless no_message? ex
@@ -390,9 +392,10 @@
options.merge!(new_options)
end
# Handle calling main and trapping any exceptions thrown
def call_main
+ @leak_exceptions = nil unless defined? @leak_exceptions
@main_block.call(*ARGV)
rescue Methadone::Error => ex
raise ex if ENV['DEBUG']
logger.error ex.message unless no_message? ex
ex.exit_code