fix argv parsing and close PG connection

This commit is contained in:
Lars Kanis 2011-05-24 11:24:32 +02:00
parent 56534e4f93
commit 4ed42eeb2c

View File

@ -310,6 +310,8 @@ class Application
sync_roles_to_pg(mroles) sync_roles_to_pg(mroles)
# apply changes on memberships # apply changes on memberships
sync_membership_to_pg(mmemberships) sync_membership_to_pg(mmemberships)
@pgconn.close
end end
def self.run(argv) def self.run(argv)
@ -318,13 +320,13 @@ class Application
s.log = Logger.new(STDOUT) s.log = Logger.new(STDOUT)
s.log.level = Logger::ERROR s.log.level = Logger::ERROR
OptionParser.new(argv) do |opts| OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]" opts.banner = "Usage: #{$0} [options]"
opts.on("-v", "--[no-]verbose", "Be more verbose"){ s.log.level-=1 } opts.on("-v", "--[no-]verbose", "Be more verbose"){ s.log.level-=1 }
opts.on("-c", "--config FILE", "Config file [#{s.config_fname}]", &s.method(:config_fname=)) opts.on("-c", "--config FILE", "Config file [#{s.config_fname}]", &s.method(:config_fname=))
opts.on("-t", "--[no-]test", "Don't do any change in the database", &s.method(:test=)) opts.on("-t", "--[no-]test", "Don't do any change in the database", &s.method(:test=))
opts.parse! opts.parse!(argv)
end end
s.start! s.start!