lib/flare_up/cli.rb in flare-up-0.3 vs lib/flare_up/cli.rb in flare-up-0.4

- old
+ new

@@ -14,10 +14,11 @@ option :aws_secret_key, :type => :string, :desc => "Required unless ENV['AWS_SECRET_ACCESS_KEY'] is set." option :redshift_username, :type => :string, :desc => "Required unless ENV['REDSHIFT_USERNAME'] is set." option :redshift_password, :type => :string, :desc => "Required unless ENV['REDSHIFT_PASSWORD'] is set." option :column_list, :type => :array, :desc => 'A space-separated list of columns, should your DATA_SOURCE require it' option :copy_options, :type => :string, :desc => "Appended to the end of the COPY command; enclose \"IN QUOTES\"" + option :colorize_output, :type => :boolean, :desc => 'Should Flare-up colorize its output?', :default => true def copy(data_source, endpoint, database_name, table_name) boot_options = { :data_source => data_source, :redshift_endpoint => endpoint, @@ -30,14 +31,15 @@ CLI.env_validator(boot_options, :aws_access_key, 'AWS_ACCESS_KEY_ID') CLI.env_validator(boot_options, :aws_secret_key, 'AWS_SECRET_ACCESS_KEY') CLI.env_validator(boot_options, :redshift_username, 'REDSHIFT_USERNAME') CLI.env_validator(boot_options, :redshift_password, 'REDSHIFT_PASSWORD') rescue ArgumentError => e - CLI.output_error(e.message) + Emitter.error(e.message) CLI.bailout(1) end + Emitter.store_options(boot_options) Boot.boot(boot_options) end def self.env_validator(options, option_name, env_variable_name) options[option_name] ||= ENVWrap.get(env_variable_name) @@ -46,14 +48,9 @@ end # TODO: Extract def self.bailout(exit_code) exit(1) - end - - # TODO: Extract - def self.output_error(message) - puts "\x1b[31m#{message}" unless ENV['TESTING'] end end end \ No newline at end of file