bin/rflow in rflow-1.0.0a1 vs bin/rflow in rflow-1.0.0a2
- old
+ new
@@ -95,25 +95,22 @@
if options[:config_file_path] && command != 'load'
startup_logger.fatal "Config file only valid for 'load' command"
exit 1
end
-
unless options[:config_database_path]
startup_logger.warn "Config database not specified, using default 'config.sqlite'"
options[:config_database_path] = File.expand_path(File.join(Dir.getwd, 'config.sqlite'))
end
-
# Set the standard logger to the startup one in the case that we need
# to call into RFlow to check on or setup things, like the config
# database. We want those log messages to go to the startup log when
# setting up. The running log will transition to what is specified in
# the config database
RFlow.logger = startup_logger
-
case command
when 'load'
# Load the database with the config file, if it exists. Will
# otherwise default values (not very useful)
if options[:config_file_path]
@@ -144,11 +141,10 @@
startup_logger.warn "Successfully initialized database '#{options[:config_database_path]}' with '#{options[:config_file_path]}'"
startup_logger.debug config.to_s
exit 0
end
-
# Load the database config and start setting up environment
begin
config = RFlow::Configuration.new(options[:config_database_path])
rescue Exception => e
startup_logger.fatal "Error loading config database: #{e.class} - #{e.message}"
@@ -157,11 +153,10 @@
Dir.chdir(File.dirname(options[:config_database_path]))
Dir.chdir(config['rflow.application_directory_path'])
pid_file = RFlow::PIDFile.new(config['rflow.pid_file_path'])
-
case command
when 'stop'
if pid_file.running?
startup_logger.info "#{config['rflow.application_name']} running, process #{pid_file.read} found in #{pid_file.to_s}, terminating"
# TODO: check if it actually shut down
@@ -185,34 +180,32 @@
startup_logger.error "#{config['rflow.application_name']} already running, process #{pid_file.read} found in #{pid_file.to_s}"
exit 1
end
end
-
# We should have eliminated all commands but 'start' at this point
# require all the gem extensions
options[:gems].each do |extension_gem|
startup_logger.info "Requiring #{extension_gem}"
require extension_gem
end
-
# load all the file extensions
options[:extensions_file_paths].each do |extensions_file_path|
startup_logger.info "Loading #{extensions_file_path}"
unless File.readable? extensions_file_path
startup_logger.fatal "Extensions file ('#{Dir.getwd}') '#{extensions_file_path}' not reabable\n#{option_parser.help}"
exit 1
end
load extensions_file_path
end
-
# Start the flow
begin
- RFlow.run options[:config_database_path], options[:daemonize]
+ RFlow.run! options[:config_database_path], options[:daemonize]
rescue Exception => e
startup_logger.fatal "Error running rflow: #{e.class}: #{e.message}"
+ exit(1)
end
__END__