Sha256: d49179ca2288302cee29a97615aaa5df84f7383847eba51b2d3d884e86327228

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 KB

Contents

class Quandl::Command::Tasks::Info < Quandl::Command::Task
  autoload_quandl_client
  
  description "Display information about the Quandl Toolbelt."
  
  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
  
  def title(name)
    name = name.to_s
    "\n#{name}\n" + ( name.length.times.collect{'='}.join )
  end
  
  def user_info
    [
      "username:   #{current_user.username}",
      "email:      #{current_user.email}",
     ].join("\n")
  end
  
  def toolbelt_info
    [
      "host:       #{quandl_url}",
      "token:      #{auth_token}",
      "version:    #{Quandl::Command::VERSION}",
     ].join("\n")
  end
  
  def package_info
    quandl_package_versions.sort_by{|p| p[:package].to_s }.collect{|p| "#{ p[:package] } ( #{ p[:version] } )" }.join("\n")
  end
  
  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
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
quandl-0.4.4 lib/quandl/command/tasks/info.rb
quandl-0.4.3 lib/quandl/command/tasks/info.rb
quandl-0.4.2 lib/quandl/command/tasks/info.rb
quandl-0.4.1 lib/quandl/command/tasks/info.rb
quandl-0.4.0 lib/quandl/command/tasks/info.rb
quandl-0.3.7 lib/quandl/command/tasks/info.rb
quandl-0.3.6 lib/quandl/command/tasks/info.rb
quandl-0.3.4 lib/quandl/command/tasks/info.rb
quandl-0.3.3 lib/quandl/command/tasks/info.rb
quandl-0.3.0 lib/quandl/command/tasks/info.rb