Class: Gem::Commands::CurrentPathCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::CurrentPathCommand
- Defined in:
- lib/rubygems/commands/current_path_command.rb
Overview
-- #############################################################################
#
A component of current_gem. #
#
Copyright (C) 2009-2011 University of Cologne, #
Albertus-Magnus-Platz, #
50923 Cologne, Germany #
#
Authors: #
Jens Wille <jens.wille@uni-koeln.de> #
#
current_gem is free software; you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at your # option) any later version. #
#
current_gem is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License # for more details. #
#
You should have received a copy of the GNU Affero General Public License # along with current_gem. If not, see <www.gnu.org/licenses/>. #
#
############################################################################# ++
Instance Method Summary (collapse)
- - (Object) arguments
- - (Object) execute
-
- (CurrentPathCommand) initialize
constructor
A new instance of CurrentPathCommand.
- - (Object) usage
Constructor Details
- (CurrentPathCommand) initialize
A new instance of CurrentPathCommand
31 32 33 34 35 36 37 38 |
# File 'lib/rubygems/commands/current_path_command.rb', line 31 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, | [:resolve] = true } end |
Instance Method Details
- (Object) arguments
40 41 42 |
# File 'lib/rubygems/commands/current_path_command.rb', line 40 def arguments 'GEMNAME name of gem to display' end |
- (Object) execute
48 49 50 51 52 53 54 |
# File 'lib/rubygems/commands/current_path_command.rb', line 48 def execute path = CurrentGem.path_for(get_one_gem_name) return unless path && File.exists?(path) path = File.readlink(path) if [:resolve] say path end |
- (Object) usage
44 45 46 |
# File 'lib/rubygems/commands/current_path_command.rb', line 44 def usage "#{program_name} GEMNAME" end |