From 8211f8a51397764642e8413183e56ea278537a2b Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sat, 19 Sep 2009 23:51:18 +0000 Subject: [PATCH] sshfs-mapper: More code for the ruby version. git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1438 eaee96b3-f302-0410-b096-c6cfd47f7835 --- config.rb | 13 +++++++++---- map.rb | 15 ++++++++++++++- sshfs-mapper.rb | 6 +++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/config.rb b/config.rb index 1f62771..b5dfdb9 100644 --- a/config.rb +++ b/config.rb @@ -1,4 +1,5 @@ #!/usr/bin/ruby +# vim: set ts=2 sw=2: require 'optparse' require 'ostruct' @@ -39,16 +40,20 @@ module SshfsMapper end def parseFile(&blk) - puts "Parsing #{@options.config_dir}/config" - puts "Parsing maps..." + puts "Parsing config #{@options.config_dir}/config" maps = [] Find.find( @options.config_dir ) do |path| if File.file?( path ) if File.basename( path ) =~ /.map$/ puts "* #{File.basename( path )}" - maps.push( path ) - if blk then yield path end + map = Map.new( path ) + map.parse() + if blk then + yield map + else + maps.push( map ) + end else Find.prune # Don't look any further into this way end diff --git a/map.rb b/map.rb index fb6a64a..cd9e015 100644 --- a/map.rb +++ b/map.rb @@ -8,7 +8,20 @@ module SshfsMapper end def parse() - puts "Parsing #{@path}" + puts "Parsing map #{@path}" + # + end + + def connect() + puts "Connecting map #{@path}" + # do something + # test server connection + # mount + end + + def disconnect() + puts "Disconnecting map #{@path}" + # umount end end end diff --git a/sshfs-mapper.rb b/sshfs-mapper.rb index 5a52a54..baa603e 100755 --- a/sshfs-mapper.rb +++ b/sshfs-mapper.rb @@ -1,4 +1,5 @@ #!/usr/bin/ruby +# vim: set ts=2 sw=2 : require 'config' require 'map' @@ -19,9 +20,8 @@ module SshfsMapper if @maps.nil? then return end - @maps.each do |map_path| - map = Map.new( map_path ) - map.parse() + @maps.each do |map| + map.connect() end puts "--run" end