lib/sportdb/cli/main.rb in sportdb-1.9.5 vs lib/sportdb/cli/main.rb in sportdb-1.9.6
- old
+ new
@@ -200,10 +200,12 @@
puts 'Done.'
end
end # command load
+if defined?( SportDb::Updater ) ## add only if Updater class loaded/defined
+
desc 'Pull - Auto-update event fixtures from upstream online sources'
command :pull do |c|
c.action do |g,o,args|
connect_to_db( opts )
@@ -212,21 +214,24 @@
puts 'Done.'
end # action
end # command pull
+end ## if defined?( SportDb::Updater )
+
desc 'Start web service (HTTP JSON API)'
command [:serve,:server] do |c|
c.action do |g,o,args|
connect_to_db( opts )
- # NB: server (HTTP service) not included in standard default require
- require 'sportdb/service'
+ # note: server (HTTP service) not included in standard default require
+ ## -- note - now included!!!
+ ## require 'sportdb/service'
# make sure connections get closed after every request e.g.
#
# after do
# ActiveRecord::Base.connection.close
@@ -304,14 +309,15 @@
pp args
puts "o (#{o.class.name}):"
pp o
puts "g (#{g.class.name}):"
pp g
-
- LogUtils::Logger.root.debug 'test debug msg'
- LogUtils::Logger.root.info 'test info msg'
- LogUtils::Logger.root.warn 'test warn msg'
-
+
+ logger = LogUtils::Logger.root
+ logger.debug 'test debug msg'
+ logger.info 'test info msg'
+ logger.warn 'test warn msg'
+
puts 'Done.'
end
end
\ No newline at end of file