Sha256: de9f3c0fa4afd18514a12b7a10c3f3cabaf898991e17c7079dadccfe9555350f

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

class Quandl::Command::Tasks::Info < Quandl::Command::Tasks::Base
  autoload_client_library
  
  description "Display information about the Quandl Toolbelt."
  
  def execute
    info title "Quandl Toolbelt"
    info current_user.info
    info toolbelt_info
    
    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

1 entries across 1 versions & 1 rubygems

Version Path
quandl-0.2.24 lib/quandl/command/tasks/info.rb