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:
parent
ba04d7fb17
commit
8211f8a513
3 changed files with 26 additions and 8 deletions
13
config.rb
13
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
|
||||
|
|
15
map.rb
15
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue