Module: Gempath

Defined in:
lib/gempath.rb,
lib/gempath/version.rb

Defined Under Namespace

Classes: NoTargetSpecifiedError

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.find(target, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gempath.rb', line 7

def self.find(target, options = {})
  raise NoTargetSpecifiedError unless target

  begin
    args = [ target ]
    args << options[:v] if options[:v]
    gem *args

    puts Gem::Specification.find_by_name(target).gem_dir
    exit 0

  rescue LoadError
    puts "'#{target}' not found in #{Gem.path.join(' or ')}"
    exit 1
  end
end