lib/quandl/command/tasks/update.rb in quandl-0.3.4 vs lib/quandl/command/tasks/update.rb in quandl-0.3.6

- old
+ new

@@ -1,7 +1,9 @@ class Quandl::Command::Tasks::Update < Quandl::Command::Task - + + depends 'uri', 'net/http', 'quandl/utility/config', 'zlib', 'archive/tar/minitar' + # curl -s https://s3.amazonaws.com/quandl-command/install.sh | bash description "Update Quandl Toolbelt to the latest version." syntax %Q{quandl update [revision] @@ -29,12 +31,10 @@ File.join(PACKAGE_URL, filename) end end def execute - # load libraries needed by this action - require_dependencies info "Updating from #{Quandl::Command::VERSION} ... " # wipe update/ and backup/ folders prepare_for_update download_tarball # ensure package was downloaded @@ -49,11 +49,11 @@ version = %x{quandl -v}.to_s.strip.rstrip info "You are up to date! ( #{version} )" rescue => err # log error - error(err) + info(err) debug(err.backtrace.join("\n")) # report failure and rollback info("----\nAn error has occured! Rolling back to previous version ... ") info("If the problem persists reinstall with: #{installer_url}") rollback_update @@ -88,18 +88,10 @@ Quandl::Command::Tasks.root end private - - def require_dependencies - require 'uri' - require 'net/http' - require 'quandl/utility/config' - require 'zlib' - require 'archive/tar/minitar' - end - + def prepare_for_update [backup_path, update_path].each do |path| # remove previous directory if present rm_rf(path) if Dir.exists?(path) # create new directory \ No newline at end of file