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 © 2009-2012 University of Cologne, #
Albertus-Magnus-Platz, #
50923 Cologne, Germany #
#
Copyright © 2013-2014 Jens Wille #
#
Authors: #
Jens Wille <jens.wille@gmail.com> #
#
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
- #arguments ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ CurrentPathCommand
constructor
A new instance of CurrentPathCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ CurrentPathCommand
Returns a new instance of CurrentPathCommand.
33 34 35 36 37 38 39 40 |
# 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, | [:resolve] = true } end |
Instance Method Details
#arguments ⇒ Object
42 43 44 |
# File 'lib/rubygems/commands/current_path_command.rb', line 42 def arguments 'GEMNAME name of gem to display' end |
#execute ⇒ Object
50 51 52 53 54 55 56 |
# 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 [:resolve] say path end |
#usage ⇒ Object
46 47 48 |
# File 'lib/rubygems/commands/current_path_command.rb', line 46 def usage "#{program_name} GEMNAME" end |