lib/beerdb/cli/main.rb in beerdb-0.9.4 vs lib/beerdb/cli/main.rb in beerdb-0.9.5
- old
+ new
@@ -77,10 +77,12 @@
BeerDb::CreateDbExtrasBookmarks.new.up
BeerDb::CreateDbExtrasNotes.new.up
BeerDb::CreateDbExtrasDrinks.new.up
else
LogDb.create
+ ConfDb.create
+ TagDb.create
WorldDb.create
BeerDb.create
end
puts 'Done.'
end # action
@@ -106,13 +108,15 @@
## todo: document optional setup profile arg (defaults to all)
setup = args[0] || 'all'
LogDb.create
+ ConfDb.create
+ TagDb.create
WorldDb.create
BeerDb.create
-
+
WorldDb.read_all( opts.world_data_path )
BeerDb.read_setup( "setups/#{setup}", opts.data_path )
puts 'Done.'
end # action
end # command setup
@@ -180,32 +184,32 @@
c.action do |g,o,args|
connect_to_db( opts )
# NB: server (HTTP service) not included in standard default require
- require 'beerdb/server'
+ require 'beerdb/service'
# make sure connections get closed after every request e.g.
#
# after do
# ActiveRecord::Base.connection.close
# end
#
puts 'before add middleware ConnectionManagement'
- BeerDb::Server.use ActiveRecord::ConnectionAdapters::ConnectionManagement
+ BeerDb::Service.use ActiveRecord::ConnectionAdapters::ConnectionManagement
puts 'after add middleware ConnectionManagement'
## todo: check if we can check on/dump middleware stack
## rack middleware might not work with multi-threaded thin web server; close it ourselfs
- BeerDb::Server.after do
+ BeerDb::Service.after do
puts " #{Thread.current.object_id} -- make sure db connections gets closed after request"
# todo: check if connection is open - how?
ActiveRecord::Base.connection.close
end
- BeerDb::Server.run!
+ BeerDb::Service.run!
puts 'Done.'
end
end # command serve
@@ -227,14 +231,16 @@
command :props do |c|
c.action do |g,o,args|
connect_to_db( opts )
- BeerDb.props
+ ### fix: use ConfDb.props or similar !!!
+ ### BeerDb.props
puts 'Done.'
end
end
+
desc 'Show logs'
command :logs do |c|
c.action do |g,o,args|
\ No newline at end of file