Class: Bundler::CLI::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/cli/info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, gem_name) ⇒ Info

Returns a new instance of Info.



6
7
8
9
# File 'lib/bundler/cli/info.rb', line 6

def initialize(options, gem_name)
  @options = options
  @gem_name = gem_name
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



5
6
7
# File 'lib/bundler/cli/info.rb', line 5

def gem_name
  @gem_name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/bundler/cli/info.rb', line 5

def options
  @options
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bundler/cli/info.rb', line 11

def run
  Bundler.ui.silence do
    Bundler.definition.validate_runtime!
    Bundler.load.lock
  end

  spec = spec_for_gem(gem_name)

  if spec
    return print_gem_path(spec) if @options[:path]
    return print_gem_version(spec) if @options[:version]
    print_gem_info(spec)
  end
end