Class: Quandl::Command::Tasks::Update
- Inherits:
-
Base
- Object
- Base
- Quandl::Command::Tasks::Update
show all
- Defined in:
- lib/quandl/command/tasks/update.rb
Constant Summary
collapse
- PACKAGE_URL =
'http://s3.amazonaws.com/quandl-command/'
Instance Attribute Summary
Attributes inherited from Base
#args, #options, #request_timer
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#ask_yes_or_no, authenticated_users_only!, autoload_client_library, call, #call, command_name, configure, #current_user, #debug, description, disable!, disable_in_gem!, disabled?, #error, #fatal, #force_yes?, #info, inherited, #initialize, lang, language, #logger, options, #summarize, #summarize_hash, syntax, t, #table, #verbose?, warn_unauthenticated_users
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)
platform = Quandl::Utility::Config.windows? ? 'windows' : nil
filename = ['quandl-command', platform, revision, 'tar.gz'].compact.join(".")
File.join(PACKAGE_URL, filename)
end
|
Instance Method Details
#backup_path ⇒ Object
83
84
85
|
# File 'lib/quandl/command/tasks/update.rb', line 83
def backup_path
@backup_path ||= File.join( root_path, 'backup' )
end
|
#execute ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/quandl/command/tasks/update.rb', line 33
def execute
require_dependencies
info "Updating from #{Quandl::Command::VERSION} ... "
prepare_for_update
download_tarball
return error("'#{package_url}' not found") unless File.exists?(tarball_path)
copy_windows_specific_files if Quandl::Utility::Config.windows?
install_update
configure_update
ensure_correct_permissions
version = %x{quandl -v}.to_s.strip.rstrip
info "You are up to date! ( #{version} )"
rescue => err
error(err)
debug(err.backtrace.join("\n"))
info("----\nAn error has occured! Rolling back to previous version ... ")
info("If the problem persists reinstall with: #{installer_url}")
rollback_update
end
|
#package_path ⇒ Object
67
68
69
|
# File 'lib/quandl/command/tasks/update.rb', line 67
def package_path
@package_path ||= File.join(update_path, "quandl-command")
end
|
#package_url ⇒ Object
75
76
77
|
# File 'lib/quandl/command/tasks/update.rb', line 75
def package_url
@package_url ||= self.class.package_url(args.first)
end
|
#tarball_path ⇒ Object
71
72
73
|
# File 'lib/quandl/command/tasks/update.rb', line 71
def tarball_path
@tarball_path ||= File.join(update_path, "update.tar.gz")
end
|
#update_path ⇒ Object
79
80
81
|
# File 'lib/quandl/command/tasks/update.rb', line 79
def update_path
@update_path ||= File.join( root_path, 'update' )
end
|