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
This commit is contained in:
Glenn Y. Rolland 2011-03-07 23:51:29 +00:00
parent 9bd9c6f490
commit 177953244b

View file

@ -6,6 +6,9 @@ require 'ostruct'
require 'pp' require 'pp'
require 'find' require 'find'
require 'rubygems'
require 'rdebug/base'
module SshfsMapper module SshfsMapper
class Config class Config
attr_reader :maps_active attr_reader :maps_active
@ -37,10 +40,11 @@ module SshfsMapper
@umount_enable = false @umount_enable = false
@target = nil @target = nil
@verbose_enable = false @verbose_enable = false
@debug = false
end end
def parse_file &blk def parse_file &blk
puts "Config: #{@config_dir}/config" rdebug "Config: #{@config_dir}/config"
maps = [] maps = []
Find.find( @config_dir ) do |path| Find.find( @config_dir ) do |path|
@ -48,12 +52,8 @@ module SshfsMapper
if File.basename( path ) =~ /.map$/ if File.basename( path ) =~ /.map$/
begin begin
map = Map.new path map = Map.new path
map.parse() yield map if block_given?
if blk then
yield map
else
maps.push map maps.push map
end
rescue rescue
# error while parsing map # error while parsing map
end end
@ -96,7 +96,7 @@ module SshfsMapper
end end
begin begin
opts.parse!( args ) opts.parse! args
rescue OptionParser::ParseError => e rescue OptionParser::ParseError => e
puts opts.to_s puts opts.to_s
puts "" puts ""
@ -109,7 +109,7 @@ module SshfsMapper
s = [] s = []
s << "config_file = #{@config_file}" s << "config_file = #{@config_file}"
s << "verbose_enable = #{@verbose_enable}" s << "verbose_enable = #{@verbose_enable}"
s.join("\n") s.join "\n"
end end
end end
end end