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
- #gem_dependencies private
- #print_gem_info(spec) private
- #print_gem_path(spec) private
- #print_gem_version(spec) private
- #spec_for_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
#gem_dependencies (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 75
def gem_dependencies @gem_dependencies ||= Bundler.definition.specs.map do |spec| dependency = spec.dependencies.find {|dep| dep.name == gem_name } next unless dependency "#{spec.name} (#{spec.version}) depends on #{gem_name} (#{dependency.requirements_list.join(", ")})" end.compact.sort end
#print_gem_info(spec) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 50
def print_gem_info(spec) = spec. name = spec.name gem_info = String.new gem_info << " * #{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 << "\tDocumentation: #{ ["documentation_uri"]}\n" if .key?("documentation_uri") gem_info << "\tSource Code: #{ ["source_code_uri"]}\n" if .key?("source_code_uri") gem_info << "\tFunding: #{ ["funding_uri"]}\n" if .key?("funding_uri") gem_info << "\tWiki: #{ ["wiki_uri"]}\n" if .key?("wiki_uri") gem_info << "\tChangelog: #{ ["changelog_uri"]}\n" if .key?("changelog_uri") gem_info << "\tBug Tracker: #{ ["bug_tracker_uri"]}\n" if .key?("bug_tracker_uri") gem_info << "\tMailing List: #{ ["mailing_list_uri"]}\n" if .key?("mailing_list_uri") gem_info << "\tPath: #{spec.full_gem_path}\n" gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem? gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any? if name != "bundler" && spec.deleted_gem? return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}" end Bundler.ui.info gem_info end
#print_gem_path(spec) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 36
def print_gem_path(spec) name = spec.name if name == "bundler" path = File. ("../../..", __dir__) else path = spec.full_gem_path if spec.deleted_gem? return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}" end end Bundler.ui.info path end
#print_gem_version(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] return print_gem_version(spec) if @options[:version] print_gem_info(spec) end end
#spec_for_gem(name) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 28
def spec_for_gem(name) Bundler::CLI::Common.select_spec(name, :regex_match) end