Class: Bundler::CLI::List

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ List

Returns a new instance of List.



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

def initialize(options)
  @options = options
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bundler/cli/list.rb', line 9

def run
  specs = Bundler.load.specs.reject {|s| s.name == "bundler" }.sort_by(&:name)
  return specs.each {|s| Bundler.ui.info s.name } if @options["name-only"]

  return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
  Bundler.ui.info "Gems included by the bundle:"
  specs.each do |s|
    Bundler.ui.info "  * #{s.name} (#{s.version}#{s.git_version})"
  end

  Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
end