class Gem::Commands::CurrentPathCommand

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/rubygems/commands/current_path_command.rb, line 33
def initialize
  super 'current_path', "Display the location of a gem's current symlink",
    resolve: false

  add_option('-r', '--resolve', 'Display value of symbolic link') { |value, options|
    options[:resolve] = true
  }
end

Public Instance Methods

arguments() click to toggle source
# File lib/rubygems/commands/current_path_command.rb, line 42
def arguments
  'GEMNAME       name of gem to display'
end
execute() click to toggle source
# File lib/rubygems/commands/current_path_command.rb, line 50
def execute
  path = CurrentGem.path_for(get_one_gem_name)
  return unless path && File.exist?(path)

  path = File.readlink(path) if options[:resolve]
  say path
end
usage() click to toggle source
# File lib/rubygems/commands/current_path_command.rb, line 46
def usage
  "#{program_name} GEMNAME"
end