diff options
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r-- | lib/bundler/cli/add.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/cache.rb | 8 | ||||
-rw-r--r-- | lib/bundler/cli/clean.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/common.rb | 14 | ||||
-rw-r--r-- | lib/bundler/cli/doctor.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/exec.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/fund.rb | 36 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/info.rb | 3 | ||||
-rw-r--r-- | lib/bundler/cli/init.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/inject.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 6 | ||||
-rw-r--r-- | lib/bundler/cli/list.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/outdated.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/show.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/update.rb | 2 |
16 files changed, 69 insertions, 20 deletions
diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb index 07b951f1ef..5bcf30d82d 100644 --- a/lib/bundler/cli/add.rb +++ b/lib/bundler/cli/add.rb @@ -17,7 +17,7 @@ module Bundler perform_bundle_install unless options["skip-install"] end - private + private def perform_bundle_install Installer.install(Bundler.root, Bundler.definition) diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb index 5e8420990f..c14c8877f0 100644 --- a/lib/bundler/cli/cache.rb +++ b/lib/bundler/cli/cache.rb @@ -24,7 +24,7 @@ module Bundler end end - private + private def install require_relative "install" @@ -37,12 +37,6 @@ module Bundler all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil) Bundler.settings.set_command_option_if_given :cache_all, all - - if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all? - Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \ - "to cache them as well, please pass the --all flag. This will be the default " \ - "on Bundler 3.0." - end end end end diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb index 4a407fbae7..c6b0968e3e 100644 --- a/lib/bundler/cli/clean.rb +++ b/lib/bundler/cli/clean.rb @@ -13,7 +13,7 @@ module Bundler Bundler.load.clean(options[:"dry-run"]) end - protected + protected def require_path_or_force return unless Bundler.use_system_gems? && !options[:force] diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index cec7bcadb4..23ac78a103 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -14,6 +14,20 @@ module Bundler Bundler.ui.info msg end + def self.output_fund_metadata_summary + definition = Bundler.definition + current_dependencies = definition.requested_dependencies + current_specs = definition.specs + + count = current_dependencies.count {|dep| current_specs[dep.name].first.metadata.key?("funding_uri") } + + return if count.zero? + + intro = count > 1 ? "#{count} installed gems you directly depend on are" : "#{count} installed gem you directly depend on is" + message = "#{intro} looking for funding.\n Run `bundle fund` for details" + Bundler.ui.info message + end + def self.output_without_groups_message(command) return if Bundler.settings[:without].empty? Bundler.ui.confirm without_groups_message(command) diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb index fcf139ed1e..2986ddbc99 100644 --- a/lib/bundler/cli/doctor.rb +++ b/lib/bundler/cli/doctor.rb @@ -93,7 +93,7 @@ module Bundler end end - private + private def check_home_permissions require "find" diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 0a1edbdbbd..0412d3adb0 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -34,7 +34,7 @@ module Bundler end end - private + private def validate_cmd! return unless cmd.nil? diff --git a/lib/bundler/cli/fund.rb b/lib/bundler/cli/fund.rb new file mode 100644 index 0000000000..52db5aef68 --- /dev/null +++ b/lib/bundler/cli/fund.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Bundler + class CLI::Fund + attr_reader :options + + def initialize(options) + @options = options + end + + def run + Bundler.definition.validate_runtime! + + groups = Array(options[:group]).map(&:to_sym) + + deps = if groups.any? + Bundler.definition.dependencies_for(groups) + else + Bundler.definition.current_dependencies + end + + fund_info = deps.each_with_object([]) do |dep, arr| + spec = Bundler.definition.specs[dep.name].first + if spec.metadata.key?("funding_uri") + arr << "* #{spec.name} (#{spec.version})\n Funding: #{spec.metadata["funding_uri"]}" + end + end + + if fund_info.empty? + Bundler.ui.info "None of the installed gems you directly depend on are looking for funding." + else + Bundler.ui.info fund_info.join("\n") + end + end + end +end diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 5b4e436d99..8d26e4c1f4 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -192,7 +192,7 @@ module Bundler raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.") end - private + private def resolve_name(name) SharedHelpers.pwd.join(name).basename.to_s diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb index 7f4ef0d03a..3111b64a33 100644 --- a/lib/bundler/cli/info.rb +++ b/lib/bundler/cli/info.rb @@ -22,7 +22,7 @@ module Bundler end end - private + private def spec_for_gem(gem_name) spec = Bundler.definition.specs.find {|s| s.name == gem_name } @@ -60,6 +60,7 @@ module Bundler gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri") gem_info << "\tSource Code: #{metadata["source_code_uri"]}\n" if metadata.key?("source_code_uri") + gem_info << "\tFunding: #{metadata["funding_uri"]}\n" if metadata.key?("funding_uri") gem_info << "\tWiki: #{metadata["wiki_uri"]}\n" if metadata.key?("wiki_uri") gem_info << "\tChangelog: #{metadata["changelog_uri"]}\n" if metadata.key?("changelog_uri") gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri") diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index f45871ce9c..d851d02d42 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -38,7 +38,7 @@ module Bundler puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}" end - private + private def gemfile @gemfile ||= Bundler.preferred_gemfile_name diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index b00675d348..8093a85283 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -44,7 +44,7 @@ module Bundler end end - private + private def last_version_number definition = Bundler.definition(true) diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 893ed59cdf..edf86fe1ba 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -53,7 +53,7 @@ module Bundler if options["binstubs"] Bundler::SharedHelpers.major_deprecation 2, - "The --binstubs option will be removed in favor of `bundle binstubs`" + "The --binstubs option will be removed in favor of `bundle binstubs --all`" end Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? @@ -82,6 +82,8 @@ module Bundler require_relative "clean" Bundler::CLI::Clean.new(options).run end + + Bundler::CLI::Common.output_fund_metadata_summary rescue GemNotFound, VersionConflict => e if options[:local] && Bundler.app_cache.exist? Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory." @@ -100,7 +102,7 @@ module Bundler raise e end - private + private def warn_if_root return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero? diff --git a/lib/bundler/cli/list.rb b/lib/bundler/cli/list.rb index c172e8d182..66abd32650 100644 --- a/lib/bundler/cli/list.rb +++ b/lib/bundler/cli/list.rb @@ -31,7 +31,7 @@ module Bundler Bundler.ui.info "Use `bundle info` to print more detailed information about a gem" end - private + private def verify_group_exists(groups) (@without_group + @only_group).each do |group| diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 892c29c4d2..109c5f417f 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -127,7 +127,7 @@ module Bundler end end - private + private def groups_text(group_text, groups) "#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\"" diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb index 3748c25b89..5eaaba1ef7 100644 --- a/lib/bundler/cli/show.rb +++ b/lib/bundler/cli/show.rb @@ -53,7 +53,7 @@ module Bundler end end - private + private def fetch_latest_specs definition = Bundler.definition(true) diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 529dd9c94d..ae908be65e 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -106,6 +106,8 @@ module Bundler Bundler.ui.confirm "Bundle updated!" Bundler::CLI::Common.output_without_groups_message(:update) Bundler::CLI::Common.output_post_install_messages installer.post_install_messages + + Bundler::CLI::Common.output_fund_metadata_summary end end end |