Class: Quandl::Command::Tasks::Update
- Inherits:
-
Quandl::Command::Task
- Object
- Quandl::Command::Task
- Quandl::Command::Tasks::Update
- Defined in:
- lib/quandl/command/tasks/update.rb
Defined Under Namespace
Classes: QuandlUtils
Constant Summary collapse
- PACKAGE_URL =
'http://s3.amazonaws.com/quandl-command/'
Constants included from Quandl::Command::Task::Updatable
Quandl::Command::Task::Updatable::VERSION_URL
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Quandl::Command::Task::Inputable
#args_or_stdin, #each_line_in_background, #file_or_stdin
Methods included from Quandl::Command::Task::Reportable
#ask_to_send_crash_reports, #call
Methods included from Quandl::Command::Task::Clientable
Methods included from Quandl::Command::Task::Updatable
#check_for_update, #check_for_update_once_daily
Methods included from Quandl::Command::Task::Threading
#await_thread_pool_lock!, #background_job, #exiting?, #mutex, #obtain_thread_pool_lock, #release_thread_pool_lock, #shutdown_thread_pool_on_sigint, #thread_pool, #thread_pool_locked?, #thread_pool_locks, #threads, #threads?
Methods included from Quandl::Command::Task::Presentation
Methods included from Quandl::Command::Task::Logging
#configure_logger, #debug, #error, #fatal, #info, #initialize_logger, #log_request_time, #logger, #start_request_timer, #stderr_logger, #summarize, #summarize_hash, #table
Methods included from Quandl::Command::Task::Commandable
Methods included from Quandl::Command::Task::Validations
Methods included from Quandl::Command::Task::Callbacks
Methods included from Quandl::Command::Task::Configurable
#ask_for_confirmation!, #config, #confirmed?, #declared_params, #force_yes?, #page, #trace?, #verbose?
Class Method Details
.package_url(revision = nil) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/quandl/command/tasks/update.rb', line 23 def package_url(revision=nil) # are we on windows? platform = Quandl::Utility::Config.windows? ? 'windows' : nil # build filename filename = ['quandl-command', platform, revision, 'tar.gz'].compact.join(".") # append s3 url File.join(PACKAGE_URL, filename) end |
Instance Method Details
#execute ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/quandl/command/tasks/update.rb', line 33 def execute if args[0] == 'rollback' execute_rollback else execute_update end rescue => err # log error error(err) debug(err.backtrace.join("\n")) # report failure and rollback error("----\nAn error has occured! Rolling back to previous version ... ") error("If the problem persists reinstall with: #{installer_url}") rollback_update end |
#execute_rollback ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/quandl/command/tasks/update.rb', line 67 def execute_rollback info "Rolling back from #{} ... " = () if .blank? info("nothing to rollback to!") return false end info "to: #{}" ( ) version = %x{quandl -v}.to_s.strip.rstrip info "You have rolled back! ( #{version} )" end |
#execute_update ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/quandl/command/tasks/update.rb', line 49 def execute_update info "Updating from #{Quandl::Command::VERSION} ... " # wipe update/ and backup/ folders prepare_for_update download_tarball # ensure package was downloaded return error("'#{package_url}' not found") unless File.exists?(tarball_path) # install extract_tarball install_update install_executable # success version = %x{quandl -v}.to_s.strip.rstrip cleanup_releases info "You are up to date! ( #{version} )" end |
#installer_url ⇒ Object
80 81 82 83 |
# File 'lib/quandl/command/tasks/update.rb', line 80 def installer_url return File.join(PACKAGE_URL, "Quandl Setup.exe") if Quandl::Utility::Config.windows? return File.join(PACKAGE_URL, "quandl-toolbelt.pkg") if Quandl::Utility::Config.macosx? end |