Class: FlareUp::Boot
- Inherits:
-
Object
- Object
- FlareUp::Boot
- Defined in:
- lib/flare_up/boot.rb
Class Method Summary collapse
-
.boot ⇒ Object
TODO: This control flow is untested and too procedural.
Class Method Details
.boot ⇒ Object
TODO: This control flow is untested and too procedural
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/flare_up/boot.rb', line 6 def self.boot conn = create_connection copy = create_copy_command begin trap('SIGINT') do Emitter.warn("\nCTRL-C received; cancelling COPY command...") = conn.cancel_current_command if Emitter.error("Error cancelling COPY: #{}") else Emitter.success('COPY command cancelled.') end CLI.bailout(1) end Emitter.info("Executing command: #{copy.get_command}") handle_load_errors(copy.execute(conn)) rescue ConnectionError => e Emitter.error(e.) CLI.bailout(1) rescue CopyCommandError => e Emitter.error(e.) CLI.bailout(1) end end |