projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Housekeeping: remove commented-out code.
[quanlib.git]
/
main.rb
diff --git
a/main.rb
b/main.rb
index 6e7a44184ff4b94357e960ef6e5f4c3d6b07a4d1..564ba8b8159d523775146ca9324b3e96a1f0f83d 100644
(file)
--- a/
main.rb
+++ b/
main.rb
@@
-1,30
+1,40
@@
-require 'navigator'
-require 'page'
-require 'store'
-require 'walkdir'
+require
_relative
'navigator'
+require
_relative
'page'
+require
_relative
'store'
+require
_relative
'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?(@store.unclassified_csv)
+ File.delete(@store.unclassified_csv)
+ 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?("--")