Class: Bundler::CLI::Info
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/cli/info.rb |
Class Method Summary
- .new(options, gem_name) ⇒ Info constructor
Instance Attribute Summary
Instance Method Summary
- #run
- #default_gem_spec(gem_name) private
- #print_gem_info(spec) private
- #print_gem_path(spec) private
- #spec_for_gem(gem_name) private
- #spec_not_found(gem_name) private
Constructor Details
.new(options, gem_name) ⇒ Info
Instance Attribute Details
#gem_name (readonly)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 5
attr_reader :gem_name, :
#options (readonly)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 5
attr_reader :gem_name, :
Instance Method Details
#default_gem_spec(gem_name) (private)
[ GitHub ]#print_gem_info(spec) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 52
def print_gem_info(spec) gem_info = String.new gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n" gem_info << "\tSummary: #{spec.summary}\n" if spec.summary gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage gem_info << "\tPath: #{spec.full_gem_path}\n" gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem? Bundler.ui.info gem_info end
#print_gem_path(spec) (private)
[ GitHub ]#run
[ GitHub ]# 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] print_gem_info(spec) end end
#spec_for_gem(gem_name) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 27
def spec_for_gem(gem_name) spec = Bundler.definition.specs.find {|s| s.name == gem_name } spec || default_gem_spec(gem_name) || Bundler::CLI::Common.select_spec(gem_name, :regex_match) end
#spec_not_found(gem_name) (private)
# File 'lib/bundler/cli/info.rb', line 38
def spec_not_found(gem_name) raise GemNotFound, Bundler::CLI::Common. (gem_name, Bundler.definition.dependencies) end