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!, call, #call, command_name, configure, #current_user, #debug, description, disable!, disabled?, #error, #fatal, #force_yes?, #info, #initialize, #logger, options, #summarize, #summarize_hash, syntax, #table, #verbose?, warn_unauthenticated_users
Class Method Details
.package_url(revision = nil) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/quandl/command/tasks/update.rb', line 21
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
82
83
84
|
# File 'lib/quandl/command/tasks/update.rb', line 82
def backup_path
@backup_path ||= File.join( root_path, 'backup' )
end
|
#execute ⇒ Object
31
32
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
|
# File 'lib/quandl/command/tasks/update.rb', line 31
def execute
require_dependencies
return unless assert_update_requirements!
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
|
#installer_url ⇒ Object
61
62
63
64
|
# File 'lib/quandl/command/tasks/update.rb', line 61
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
|
#package_path ⇒ Object
66
67
68
|
# File 'lib/quandl/command/tasks/update.rb', line 66
def package_path
@package_path ||= File.join(update_path, "quandl-command")
end
|
#package_url ⇒ Object
74
75
76
|
# File 'lib/quandl/command/tasks/update.rb', line 74
def package_url
@package_url ||= self.class.package_url(args.first)
end
|
#root_path ⇒ Object
86
87
88
|
# File 'lib/quandl/command/tasks/update.rb', line 86
def root_path
Quandl::Command::Tasks.root
end
|
#tarball_path ⇒ Object
70
71
72
|
# File 'lib/quandl/command/tasks/update.rb', line 70
def tarball_path
@tarball_path ||= File.join(update_path, "update.tar.gz")
end
|
#update_path ⇒ Object
78
79
80
|
# File 'lib/quandl/command/tasks/update.rb', line 78
def update_path
@update_path ||= File.join( root_path, 'update' )
end
|