lib/sifttter_redux/dbu.rb in sifttter-redux-0.3.5 vs lib/sifttter_redux/dbu.rb in sifttter-redux-0.3.6

- old
+ new

@@ -15,19 +15,21 @@ # to a filepath on the local filesystem. # @return Void # ---------------------------------------------------- def self.download if !@local_path.nil? && !@remote_path.nil? - CliMessage.info_block(@message ||= DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do + CLIMessage.info_block(@message ||= DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do if SifttterRedux.verbose system "#{ @dbu } download #{ @remote_path } #{ @local_path }" else exec = `#{ @dbu } download #{ @remote_path } #{ @local_path }` end end else - fail ArgumentError, 'Local and remote DBU targets cannot be nil' + error = 'Local and remote DBU targets cannot be nil' + Methadone::CLILogging.error(error) + fail ArgumentError, error end end # ---------------------------------------------------- # install_wizard method @@ -37,32 +39,32 @@ # @return Void # ---------------------------------------------------- def self.install_wizard valid_directory_chosen = false - CliMessage.section_block('CONFIGURING DROPBOX UPLOADER...') do + CLIMessage.section_block('CONFIGURING DROPBOX UPLOADER...') do until valid_directory_chosen # Prompt the user for a location to save Dropbox Uploader. ' - path = CliMessage.prompt('Location for Dropbox-Uploader', DBU_LOCAL_FILEPATH) + path = CLIMessage.prompt('Location for Dropbox-Uploader', DBU_LOCAL_FILEPATH) path.chop! if path.end_with?('/') path = '/usr/local/opt' if path.empty? # If the entered directory exists, clone the repository. if File.directory?(path) valid_directory_chosen = true path << '/Dropbox-Uploader' if File.directory?(path) - CliMessage.warning("Using pre-existing Dropbox Uploader at #{ path }...") + CLIMessage.warning("Using pre-existing Dropbox Uploader at #{ path }...") else - CliMessage.info_block("Downloading Dropbox Uploader to #{ path }...", 'Done.', true) do + CLIMessage.info_block("Downloading Dropbox Uploader to #{ path }...", 'Done.', true) do system "git clone https://github.com/andreafabrizi/Dropbox-Uploader.git #{ path }" end end # If the user has never configured Dropbox Uploader, have them do it here. - system "#{ @dbu }" unless File.exists?(CONFIG_FILEPATH) + CLIMessage.info_block('Initializing Dropbox Uploader...') { system "#{ @dbu }" } unless File.exists?(CONFIG_FILEPATH) Configuration.add_section('db_uploader') Configuration['db_uploader'].merge!('local_filepath' => path) else puts "Sorry, but #{ path } isn't a valid directory." @@ -125,18 +127,20 @@ # the remote Dropbox path. # @return Void # ---------------------------------------------------- def self.upload if !@local_path.nil? && !@remote_path.nil? - CliMessage.info_block(@message ||= DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do + CLIMessage.info_block(@message ||= DEFAULT_MESSAGE, 'Done.', SifttterRedux.verbose) do if SifttterRedux.verbose system "#{ @dbu } upload #{ @local_path } #{ @remote_path }" else exec = `#{ @dbu } upload #{ @local_path } #{ @remote_path }` end end else - fail ArgumentError, 'Local and remote DBU targets cannot be nil' + error = 'Local and remote DBU targets cannot be nil' + Methadone::CLILogging.error(error) + fail ArgumentError, error end end end end