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
- #print_gem_version(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 61
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" if spec.respond_to?(:default_gem?) && spec.default_gem? 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 47
def print_gem_path(spec) name = spec.name if name == "bundler" path = File. ("../../../..", __FILE__) 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(gem_name) (private)
[ GitHub ]# File 'lib/bundler/cli/info.rb', line 28
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 39
def spec_not_found(gem_name) raise GemNotFound, Bundler::CLI::Common. (gem_name, Bundler.definition.dependencies) end