stefan-kolb/nucleus

View on GitHub
lib/nucleus_api/scripts/shutdown_api.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Implement API shutdown actions, tidy up the DB
at_exit do
  puts '-----------------------------------------------', ''
  puts 'Cleaning up the API...'

  if !nucleus_config.db.key?(:delete_on_shutdown) || nucleus_config.db.delete_on_shutdown
    FileUtils.rm_rf(nucleus_config.db.path) if File.exist?(nucleus_config.db.path) && File.directory?(nucleus_config.db.path)
    puts '... DB store successfully deleted' unless File.exist?(nucleus_config.db.path)
  end
  puts '... done!'
end