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
|
#!/usr/bin/ruby
|
||||||
|
# vim: set ts=2 sw=2:
|
||||||
|
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
@ -39,16 +40,20 @@ module SshfsMapper
|
||||||
end
|
end
|
||||||
|
|
||||||
def parseFile(&blk)
|
def parseFile(&blk)
|
||||||
puts "Parsing #{@options.config_dir}/config"
|
puts "Parsing config #{@options.config_dir}/config"
|
||||||
puts "Parsing maps..."
|
|
||||||
|
|
||||||
maps = []
|
maps = []
|
||||||
Find.find( @options.config_dir ) do |path|
|
Find.find( @options.config_dir ) do |path|
|
||||||
if File.file?( path )
|
if File.file?( path )
|
||||||
if File.basename( path ) =~ /.map$/
|
if File.basename( path ) =~ /.map$/
|
||||||
puts "* #{File.basename( path )}"
|
puts "* #{File.basename( path )}"
|
||||||
maps.push( path )
|
map = Map.new( path )
|
||||||
if blk then yield path end
|
map.parse()
|
||||||
|
if blk then
|
||||||
|
yield map
|
||||||
|
else
|
||||||
|
maps.push( map )
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Find.prune # Don't look any further into this way
|
Find.prune # Don't look any further into this way
|
||||||
end
|
end
|
||||||
|
|
15
map.rb
15
map.rb
|
@ -8,7 +8,20 @@ module SshfsMapper
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse()
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
|
# vim: set ts=2 sw=2 :
|
||||||
|
|
||||||
require 'config'
|
require 'config'
|
||||||
require 'map'
|
require 'map'
|
||||||
|
@ -19,9 +20,8 @@ module SshfsMapper
|
||||||
if @maps.nil? then
|
if @maps.nil? then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@maps.each do |map_path|
|
@maps.each do |map|
|
||||||
map = Map.new( map_path )
|
map.connect()
|
||||||
map.parse()
|
|
||||||
end
|
end
|
||||||
puts "--run"
|
puts "--run"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue