Sha256: cf7ca4bbefc11232f33f850a3969d2f8394299b11b755b14a1c4c1ad6f3d4a7d

Contents?: true

Size: 1.1 KB

Versions: 55

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Bundler
  class CLI::Cache
    attr_reader :options

    def initialize(options)
      @options = options
    end

    def run
      Bundler.ui.level = "warn" if options[:quiet]
      Bundler.settings.set_command_option_if_given :path, options[:path]
      Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]

      setup_cache_all
      install

      # TODO: move cache contents here now that all bundles are locked
      custom_path = Bundler.settings[:path] if options[:path]

      Bundler.settings.temporary(cache_all_platforms: options["all-platforms"]) do
        Bundler.load.cache(custom_path)
      end
    end

    private

    def install
      require_relative "install"
      options = self.options.dup
      options["local"] = false if Bundler.settings[:cache_all_platforms]
      options["no-cache"] = true
      Bundler::CLI::Install.new(options).run
    end

    def setup_cache_all
      all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil)

      Bundler.settings.set_command_option_if_given :cache_all, all
    end
  end
end

Version data entries

55 entries across 55 versions & 3 rubygems

Version Path
rubygems-update-3.6.3 bundler/lib/bundler/cli/cache.rb
bundler-2.6.3 lib/bundler/cli/cache.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/bundler-2.5.5/lib/bundler/cli/cache.rb
rubygems-update-3.6.2 bundler/lib/bundler/cli/cache.rb
bundler-2.6.2 lib/bundler/cli/cache.rb
rubygems-update-3.6.1 bundler/lib/bundler/cli/cache.rb
bundler-2.6.1 lib/bundler/cli/cache.rb
rubygems-update-3.6.0 bundler/lib/bundler/cli/cache.rb
bundler-2.6.0 lib/bundler/cli/cache.rb
rubygems-update-3.5.23 bundler/lib/bundler/cli/cache.rb
bundler-2.5.23 lib/bundler/cli/cache.rb
rubygems-update-3.5.22 bundler/lib/bundler/cli/cache.rb
bundler-2.5.22 lib/bundler/cli/cache.rb
rubygems-update-3.5.21 bundler/lib/bundler/cli/cache.rb
bundler-2.5.21 lib/bundler/cli/cache.rb
rubygems-update-3.5.20 bundler/lib/bundler/cli/cache.rb
bundler-2.5.20 lib/bundler/cli/cache.rb
rubygems-update-3.5.19 bundler/lib/bundler/cli/cache.rb
bundler-2.5.19 lib/bundler/cli/cache.rb
rubygems-update-3.5.18 bundler/lib/bundler/cli/cache.rb