Sha256: b08891d26e046b7b4bda251782edea1e134d2b094e41dba4baee61f1a621cca3

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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 "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

3 entries across 3 versions & 1 rubygems

Version Path
quandl-0.2.27 lib/quandl/command/tasks/info.rb
quandl-0.2.26 lib/quandl/command/tasks/info.rb
quandl-0.2.25 lib/quandl/command/tasks/info.rb