Class: Quandl::Command::Tasks::Info
- Inherits:
-
Base
- Object
- Base
- Quandl::Command::Tasks::Info
show all
- Defined in:
- lib/quandl/command/tasks/info.rb
Instance Attribute Summary
Attributes inherited from Base
#args, #options, #request_timer
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
Instance Method Details
#execute ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/quandl/command/tasks/info.rb', line 6
def execute
info title "Quandl Toolbelt"
info current_user.info
info toolbelt_info
debug "path: #{Quandl::Command.root}"
debug title "Package Versions"
debug package_info
end
|
#package_info ⇒ Object
36
37
38
|
# File 'lib/quandl/command/tasks/info.rb', line 36
def package_info
quandl_package_versions.sort_by{|p| p[:package].to_s }.collect{|p| "#{ p[:package] } ( #{ p[:version] } )" }.join("\n")
end
|
#quandl_package_versions ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/quandl/command/tasks/info.rb', line 40
def quandl_package_versions
Quandl.constants.collect do |c|
package = "Quandl::#{c}".constantize
version = "Quandl::#{c}::VERSION".constantize rescue nil
{ package: package, version: version } unless version.nil?
end.compact
end
|
#title(name) ⇒ Object
16
17
18
19
|
# File 'lib/quandl/command/tasks/info.rb', line 16
def title(name)
name = name.to_s
"\n#{name}\n" + ( name.length.times.collect{'='}.join )
end
|
28
29
30
31
32
33
34
|
# File 'lib/quandl/command/tasks/info.rb', line 28
def toolbelt_info
[
"host: #{quandl_url}",
"token: #{auth_token}",
"version: #{Quandl::Command::VERSION}",
].join("\n")
end
|
#user_info ⇒ Object
21
22
23
24
25
26
|
# File 'lib/quandl/command/tasks/info.rb', line 21
def user_info
[
"username: #{current_user.username}",
"email: #{current_user.email}",
].join("\n")
end
|