Skip to content

Commit

Permalink
Vastly simplify this calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Sep 17, 2020
1 parent cb3fe13 commit 3bd3fa2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bundler/lib/bundler/cli/common.rb
Expand Up @@ -15,12 +15,11 @@ def self.print_post_install_message(name, msg)
end

def self.output_fund_metadata_summary(gems_seeking_funding)
gem_names = gems_seeking_funding.keys
current_dependencies = Bundler.definition.current_dependencies.map(&:name)
direct_gems_seeking_funding = gem_names.reject {|g| !current_dependencies.include?(g) }
return if direct_gems_seeking_funding.empty?
current_specs = Bundler.definition.specs
count = current_dependencies.count{|dep| current_specs[dep].first.metadata.key?("funding_uri") }
return if count.zero?

count = direct_gems_seeking_funding.length
intro = count > 1 ? "#{count} gems you directly depend on are" : "#{count} gem you directly depend on is"
message = "#{intro} looking for funding.\n Run `bundle fund` for details"
Bundler.ui.info message
Expand Down

0 comments on commit 3bd3fa2

Please sign in to comment.