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
This commit is contained in:
Glenn Y. Rolland 2009-09-19 23:51:18 +00:00
parent ba04d7fb17
commit 8211f8a513
3 changed files with 26 additions and 8 deletions

View file

@ -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

15
map.rb
View file

@ -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

View file

@ -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