projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make db params and path configurable via quanlib.ini.
[quanlib.git]
/
main.rb
diff --git
a/main.rb
b/main.rb
index 4ea9c7057de2e456b65eecb2fcad0515b3fbc283..7c08cf2b66e90839b14bab5d5f392be2ccbe93f8 100644
(file)
--- a/
main.rb
+++ b/
main.rb
@@
-3,31
+3,38
@@
require 'page'
require 'store'
require 'walkdir'
require 'store'
require 'walkdir'
-outputDir = 'output'
+
@
outputDir = 'output'
book_ids = []
book_ids = []
-imageCount = 0
+@config_file = 'quanlib.ini'
+@skip_class = false
def handleArg(arg)
def handleArg(arg)
- if "--purge" == arg
+ if arg.start_with?("--config=")
+ @config_file = arg[9..-1]
+ puts 'Using config file "' + @config_file + '".'
+ elsif "--purge" == arg
puts 'Purging database...'
@store.dropSchema()
puts 'Purging database...'
@store.dropSchema()
- if File.exists?(
S
tore.unclassified_csv)
- File.delete(
S
tore.unclassified_csv)
+ if File.exists?(
@s
tore.unclassified_csv)
+ File.delete(
@s
tore.unclassified_csv)
end
end
+ elsif "--skip-class" == arg
+ puts 'Skipping load of classification table.'
+ @skip_class = true
elsif arg.start_with?("--")
abort('ERROR: Unrecognized option "' + arg + '".')
end
end
elsif arg.start_with?("--")
abort('ERROR: Unrecognized option "' + arg + '".')
end
end
-@store = Store.new()
+@store = Store.new(
@config_file
)
@store.connect()
for arg in ARGV
handleArg(arg)
end
@store.connect()
for arg in ARGV
handleArg(arg)
end
-@store.init_db()
+@store.init_db(
@skip_class
)
for arg in ARGV
if ! arg.start_with?("--")
for arg in ARGV
if ! arg.start_with?("--")