Requirements: remove circular references.
This commit is contained in:
parent
d3309f0344
commit
222cc7c23b
8 changed files with 36 additions and 29 deletions
21
lib/qasim.rb
21
lib/qasim.rb
|
@ -5,11 +5,18 @@ def _ str
|
|||
Qt::Object.tr(str)
|
||||
end
|
||||
|
||||
module Qasim
|
||||
autoload :Config, 'qasim/config'
|
||||
autoload :Map, 'qasim/map'
|
||||
autoload :Ui, 'qasim/ui'
|
||||
autoload :Cli, 'qasim/cli'
|
||||
autoload :MapManager, 'qasim/map_manager'
|
||||
end
|
||||
|
||||
## Core libs
|
||||
require 'qasim/constants'
|
||||
require 'qasim/config'
|
||||
require 'qasim/map'
|
||||
require 'qasim/map_manager'
|
||||
|
||||
## Plugins for maps
|
||||
require 'qasim/map/generic'
|
||||
require 'qasim/map/smb'
|
||||
require 'qasim/map/ssh'
|
||||
require 'qasim/map/webdav'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'qasim/qasim_qrc'
|
||||
require 'qasim/ui'
|
||||
|
||||
module Qasim
|
||||
class QasimApp
|
||||
|
|
|
@ -68,8 +68,6 @@ module Qasim ; module Map
|
|||
line = env_substitute(line)
|
||||
params[:filename] = filename
|
||||
case line
|
||||
when /^\s*TYPE\s*=\s*(.*)\s*$/ then
|
||||
params[:type] = $1
|
||||
when /^\s*REMOTE_USER\s*=\s*(.*)\s*$/ then
|
||||
params[:ssh_user] = $1
|
||||
when /^\s*REMOTE_PORT\s*=\s*(.*)\s*$/ then
|
||||
|
@ -83,13 +81,20 @@ module Qasim ; module Map
|
|||
when /^\s*MAP\s*=\s*(.*)\s+(.*)\s*$/ then
|
||||
params[:links] ||= {}
|
||||
params[:links][$1] = $2
|
||||
when /^\s*([A-Z_]+)\s*=\s*(.*)\s*$/ then
|
||||
key = $1.downcase.to_sym
|
||||
params[key] = $2
|
||||
when /^\s*$/,/^\s*#/ then
|
||||
else
|
||||
raise MapParseError, "parse error at #{@filename}:#{linect}"
|
||||
STDERR.puts line
|
||||
raise ParseError, "parse error at #{filename}:#{linect}"
|
||||
end
|
||||
end
|
||||
f.close
|
||||
map_class = class_for params[:type]
|
||||
if map_class.nil? then
|
||||
raise ParseError, "no plugin found for type « #{params[:type]} »"
|
||||
end
|
||||
map = map_class.new appcfg, params
|
||||
return map
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require 'fileutils'
|
||||
require 'pp'
|
||||
|
||||
module Qasim ; class Map; class Generic
|
||||
module Qasim ; module Map; class Generic
|
||||
attr_reader :links
|
||||
attr_reader :filename
|
||||
attr_reader :name
|
||||
|
|
|
@ -3,22 +3,20 @@
|
|||
require 'fileutils'
|
||||
require 'qasim/map/generic'
|
||||
|
||||
class Qasim::Map::Webdav < Qasim::Map::Generic
|
||||
module Qasim; module Map; class Webdav < Qasim::Map::Generic
|
||||
def initialize *opts
|
||||
super
|
||||
end
|
||||
|
||||
def self.parameters
|
||||
super.merge({
|
||||
webdav_user: { required: true}, # ex : foo
|
||||
webdav_password: { required: true}, # ex : bar
|
||||
webdav_port: { default: 80}, # ex : 80, 8080, 443
|
||||
webdav_protocol: { default: :http} # ex : http, https
|
||||
smb_user: { required: true}, # ex : foo
|
||||
smb_password: { required: true}, # ex : bar
|
||||
})
|
||||
end
|
||||
|
||||
def self.handles
|
||||
[ :webdav, :webdavs ]
|
||||
[ :samba, :cifs, :smb ]
|
||||
end
|
||||
end
|
||||
end ; end ; end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
require 'fileutils'
|
||||
require 'qasim/map/generic'
|
||||
|
||||
module Qasim ; class Map ; class Ssh < Qasim::Map::Generic
|
||||
module Qasim ; module Map ; class Ssh < Qasim::Map::Generic
|
||||
attr_reader :path,
|
||||
:host,
|
||||
:port,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
require 'fileutils'
|
||||
require 'qasim/map/generic'
|
||||
|
||||
class Qasim::Map::Webdav < Qasim::Map::Generic
|
||||
module Qasim; module Map; class Webdav < Qasim::Map::Generic
|
||||
def initialize *opts
|
||||
super
|
||||
end
|
||||
|
@ -20,5 +20,6 @@ class Qasim::Map::Webdav < Qasim::Map::Generic
|
|||
def self.handles
|
||||
[ :webdav, :webdavs ]
|
||||
end
|
||||
end
|
||||
end ; end ; end
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
|
||||
require 'qasim/constants'
|
||||
|
||||
module Qasim ; module Ui
|
||||
autoload :About, 'qasim/ui/about'
|
||||
autoload :Preferences, 'qasim/ui/preferences'
|
||||
|
||||
end ; end
|
||||
require 'qasim/ui/about'
|
||||
require 'qasim/ui/preferences'
|
||||
|
|
Loading…
Reference in a new issue