Class: FlareUp::Boot
- Inherits:
-
Object
- Object
- FlareUp::Boot
- Defined in:
- lib/flare_up/boot.rb
Class Method Summary collapse
-
.boot(options) ⇒ Object
TODO: This control flow is untested.
- .create_connection(options) ⇒ Object
- .create_copy_command(options) ⇒ Object
-
.handle_load_errors(stl_load_errors) ⇒ Object
TODO: How can we test this?.
Class Method Details
.boot(options) ⇒ Object
TODO: This control flow is untested
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/flare_up/boot.rb', line 6 def self.boot() conn = create_connection() copy = create_copy_command() begin Emitter.info("Executing command: #{copy.get_command}") handle_load_errors(copy.execute(conn)) rescue CopyCommandError => e Emitter.error(e.) CLI.bailout(1) end end |
.create_connection(options) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/flare_up/boot.rb', line 20 def self.create_connection() FlareUp::Connection.new( [:redshift_endpoint], [:database], [:redshift_username], [:redshift_password] ) end |
.create_copy_command(options) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/flare_up/boot.rb', line 29 def self.create_copy_command() copy = FlareUp::CopyCommand.new( [:table], [:data_source], [:aws_access_key], [:aws_secret_key] ) copy.columns = [:column_list] if [:column_list] copy. = [:copy_options] if [:copy_options] copy end |
.handle_load_errors(stl_load_errors) ⇒ Object
TODO: How can we test this?
42 43 44 45 46 47 48 49 |
# File 'lib/flare_up/boot.rb', line 42 def self.handle_load_errors(stl_load_errors) return if stl_load_errors.empty? Emitter.error("There was an error processing the COPY command. Displaying the last (#{stl_load_errors.length}) errors.") stl_load_errors.each do |e| Emitter.error(e.pretty_print) end CLI.bailout(1) end |