bin/diru in diru-0.0.7 vs bin/diru in diru-0.0.8
- old
+ new
@@ -98,13 +98,17 @@
# Default port.
DIRU_HUB_PORT = ENV['DIRU_HUB_PORT'] || 41114
# Load yaml configuration file (if exists).
def Diru.load_conf( conf_file )
- conf = {}
+ conf = nil
if File.exist?( conf_file )
- conf = YAML.load( File.read( conf_file ) )
+ begin
+ conf = YAML.load( File.read( conf_file ) )
+ rescue
+ STDERR.puts "Diru Error: Broken YAML, please fix: \"#{conf_file}\"..."
+ end
end
conf
end
@@ -364,11 +368,11 @@
# Update options.
def update_conf
if @opts_file
- load_conf( @opts_file )
+ return unless load_conf( @opts_file )
if @conf[:dsync] && @conf[:dsync] >= 0
@dsync = @conf[:dsync]
end
@@ -1011,10 +1015,10 @@
# Create a DRbObject instance that is connected to server. All methods
# executed on this object will be executed to the remote one.
@search = DRbObject.new( nil, "druby://localhost:#{@port}" )
- load_conf( @search.opts_file )
+ raise unless load_conf( @search.opts_file )
@pwd = Dir.pwd
@enable_out = true