Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6257 - bundler:seg-rename-bundler-frozen, r=segiddins
Browse files Browse the repository at this point in the history
Rename Bundler.frozen? to avoid Object method conflict

### What was the end-user problem that led to this PR?

The problem was `Bundler` overrode the `Object#frozen?` method to mean something else, breaking anything that checks that method to determine if an object is frozen.

Closes #6252.

### What was your diagnosis of the problem?

My diagnosis was the method name had to be changed.
  • Loading branch information
bundlerbot committed Jan 16, 2018
2 parents bddb2e8 + 59d21d5 commit 2c05914
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/bundler.rb
Expand Up @@ -136,7 +136,7 @@ def definition(unlock = nil)
end
end

def frozen?
def frozen_bundle?
frozen = settings[:deployment]
frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen?
frozen
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/check.rb
Expand Up @@ -26,7 +26,7 @@ def run
not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" }
Bundler.ui.warn "Install missing gems with `bundle install`"
exit 1
elsif !Bundler.default_lockfile.file? && Bundler.frozen?
elsif !Bundler.default_lockfile.file? && Bundler.frozen_bundle?
Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present"
exit 1
else
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/cli/install.rb
Expand Up @@ -23,7 +23,7 @@ def run

check_trust_policy

if options[:deployment] || options[:frozen] || Bundler.frozen?
if options[:deployment] || options[:frozen] || Bundler.frozen_bundle?
unless Bundler.default_lockfile.exist?
flag = "--deployment flag" if options[:deployment]
flag ||= "--frozen flag" if options[:frozen]
Expand Down Expand Up @@ -63,7 +63,7 @@ def run
definition.validate_runtime!

installer = Installer.install(Bundler.root, definition, options)
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen?
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?

Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
Bundler::CLI::Common.output_without_groups_message
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/cli/outdated.rb
Expand Up @@ -213,7 +213,7 @@ def print_gem(current_spec, active_spec, dependency, groups, options_include_gro
end

def check_for_deployment_mode
return unless Bundler.frozen?
return unless Bundler.frozen_bundle?
suggested_command = if Bundler.settings.locations("frozen")[:global]
"bundle config --delete frozen"
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
Expand Down
10 changes: 5 additions & 5 deletions lib/bundler/definition.rb
Expand Up @@ -112,7 +112,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
end
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)

add_current_platform unless Bundler.frozen?
add_current_platform unless Bundler.frozen_bundle?

converge_path_sources_to_gemspec_sources
@path_changes = converge_paths
Expand Down Expand Up @@ -244,7 +244,7 @@ def specs_for(groups)
def resolve
@resolve ||= begin
last_resolve = converge_locked_specs
if Bundler.frozen?
if Bundler.frozen_bundle?
Bundler.ui.debug "Frozen, using resolution from the lockfile"
last_resolve
elsif !unlocking? && nothing_changed?
Expand Down Expand Up @@ -335,10 +335,10 @@ def lock(file, preserve_unknown_sections = false)
end
end

preserve_unknown_sections ||= !updating_major && (Bundler.frozen? || !(unlocking? || @unlocking_bundler))
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
return if lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections)

if Bundler.frozen?
if Bundler.frozen_bundle?
Bundler.ui.error "Cannot write a changed lockfile while frozen."
return
end
Expand Down Expand Up @@ -681,7 +681,7 @@ def converge_sources
end

def converge_dependencies
frozen = Bundler.frozen?
frozen = Bundler.frozen_bundle?
(@dependencies + @locked_deps.values).each do |dep|
locked_source = @locked_deps[dep.name]
# This is to make sure that if bundler is installing in deployment mode and
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/injector.rb
Expand Up @@ -13,7 +13,7 @@ def initialize(new_deps, options = {})
end

def inject(gemfile_path, lockfile_path)
if Bundler.frozen?
if Bundler.frozen_bundle?
# ensure the lock and Gemfile are synced
Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/installer.rb
Expand Up @@ -70,7 +70,7 @@ def run(options)
create_bundle_path

ProcessLock.lock do
if Bundler.frozen?
if Bundler.frozen_bundle?
@definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
end

Expand All @@ -90,7 +90,7 @@ def run(options)
end
install(options)

lock unless Bundler.frozen?
lock unless Bundler.frozen_bundle?
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/runtime.rb
Expand Up @@ -10,7 +10,7 @@ def initialize(root, definition)
end

def setup(*groups)
@definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen?
@definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle?

groups.map!(&:to_sym)

Expand Down

0 comments on commit 2c05914

Please sign in to comment.