lib/qooxview/qooxview.rb in qooxview-1.9.10 vs lib/qooxview/qooxview.rb in qooxview-1.9.11
- old
+ new
@@ -10,11 +10,10 @@
# Unknown debug-level for recognition in ConfigBase
DEBUG_LVL = 0.5
end
require 'yaml'
-require 'active_record'
require 'json'
require 'gettext'
require 'qooxview/rpcqooxdoo'
require 'qooxview/entity'
require 'qooxview/view'
@@ -30,10 +29,15 @@
}
$qooxview_cmds = []
module QooxView
+ # Reads options from the command-line:
+ # * -h[elp] shows the help screen
+ # * -(t|i18n) scans for translation-variables and writes .po
+ # * -p[o] converts .po to .mo
+ # * -a[rchive] call Accounts.archive (should be moved to Africompta)
def self.do_opts(dir_entities, dir_views)
opts = GetoptLong.new(
['--help', '-h', GetoptLong::NO_ARGUMENT],
['--i18n', '-t', GetoptLong::OPTIONAL_ARGUMENT],
['--po', '-p', GetoptLong::NO_ARGUMENT],
@@ -85,10 +89,27 @@
$qooxview_cmds.push [:archive, a]
end
}
end
+ # require all files in the directories
+ # _dirs_ - one or more arguments to scan for .rb-files
+ def self.load_dirs( *dirs )
+ #dputs_func
+ dirs.flatten.each{|dir|
+ if dir
+ dputs(2) { "Initializing directory #{dir}" }
+ Dir[File.join(dir, '**', '*.rb')].each { |f|
+ dputs(3) { "Requiring file #{f}" }
+ require(f)
+ }
+ end
+ }
+ end
+
+ # Read in all entities and vies, load data of entities, but don't start
+ # web-server yet
def self.init(dir_entities = nil, dir_views = nil)
#dputs_func
# If we're in test-mode, don't interpret arguments
if !Module.constants.index(:Test)
dputs(2) { 'Doing options' }
@@ -96,29 +117,21 @@
end
# Include all modules in the dir_entities and dir_views
# directories
dputs(2) { "Starting init with entities:views = #{[dir_entities, dir_views].join(':')}" }
- [dir_entities, dir_views].each { |d|
- if d
- dputs(2) { "Initializing directory #{d}" }
- Dir[d+'/**/*.rb'].each { |f|
- dputs(3) { "Requiring file #{f}" }
- require(f)
- }
- end
- }
+ QooxView.load_dirs( dir_entities, dir_views )
if not Permission.list.index('default')
Permission.add('default', '.*')
end
dputs(2) { 'Starting RPCQooxdooServices' }
# We want to load an eventual ConfigBase first, so that other modules can
# read the configuration
rpcqooxdoo = RPCQooxdooService.new('Entities.ConfigBase')
if true
- ConfigBases.init
+ ConfigBases.init_load
else
Entities.ConfigBases.load
ConfigBases.singleton
Entities.ConfigBases.migrate
end