From eafd71ecdf0f04a7f6775c06759cb32c539d45ec Mon Sep 17 00:00:00 2001 From: glenux Date: Mon, 7 Mar 2011 23:51:29 +0000 Subject: [PATCH] sshfs-mapper config: * Added on-debug verbosity & disabled debug. * Fixed on-block-given error. git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1658 eaee96b3-f302-0410-b096-c6cfd47f7835 --- sshfs-mapper/config.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sshfs-mapper/config.rb b/sshfs-mapper/config.rb index 97a780e..207cb80 100644 --- a/sshfs-mapper/config.rb +++ b/sshfs-mapper/config.rb @@ -6,6 +6,9 @@ require 'ostruct' require 'pp' require 'find' +require 'rubygems' +require 'rdebug/base' + module SshfsMapper class Config attr_reader :maps_active @@ -37,10 +40,11 @@ module SshfsMapper @umount_enable = false @target = nil @verbose_enable = false + @debug = false end def parse_file &blk - puts "Config: #{@config_dir}/config" + rdebug "Config: #{@config_dir}/config" maps = [] Find.find( @config_dir ) do |path| @@ -48,12 +52,8 @@ module SshfsMapper if File.basename( path ) =~ /.map$/ begin map = Map.new path - map.parse() - if blk then - yield map - else - maps.push map - end + yield map if block_given? + maps.push map rescue # error while parsing map end @@ -96,7 +96,7 @@ module SshfsMapper end begin - opts.parse!( args ) + opts.parse! args rescue OptionParser::ParseError => e puts opts.to_s puts "" @@ -109,7 +109,7 @@ module SshfsMapper s = [] s << "config_file = #{@config_file}" s << "verbose_enable = #{@verbose_enable}" - s.join("\n") + s.join "\n" end end end