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

Remove global frozen when running install --no-deployment #5009

Closed
trevorturk opened this issue Sep 21, 2016 · 5 comments
Closed

Remove global frozen when running install --no-deployment #5009

trevorturk opened this issue Sep 21, 2016 · 5 comments

Comments

@trevorturk
Copy link

This is a minor issue that I'm happy to work up a pull request for, but I'm wondering if anyone has opinions on how best to proceed.

The issue is that bundle install --no-deployment doesn't remove the global frozen flag if present. This can be worked around easily by using bundle config --delete frozen but Bundler suggests the problem will be solved by running bundle install --no-deployment.

Here's an example of how I ran into this issue:

$ bundle config --global frozen 1

$ bundle env
    Bundler   1.13.1
    Rubygems  2.2.5
    Ruby      2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin15.0]
    Git       2.10.0

Bundler settings

    frozen
      Set for the current user (/Users/trevorturk/.bundle/config): "1"

$ bundle install

You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the /Users/trevorturk/Code/clearbit/company/Gemfile freeze 
by running `bundle install --no-deployment`.

$ bundle install --no-deployment

[...same error...]

$ bundle config --delete frozen
$ bundle install

[...success...]

I believe the best fix would be to delete the local and global setting via: https://github.com/bundler/bundler/blob/master/lib/bundler/cli/install.rb#L48-L52 which might mean adjusting Bundler::Settings#delete to also delete global settings here https://github.com/bundler/bundler/blob/master/lib/bundler/settings.rb#L99-L101 or to introduce a new Bundler::Settings#delete_global or such and delete the global setting when install is called with --no-deployment.

Another possible fix might be adjusting the error message to suggest running bundle config --delete frozen instead of bundle install --no-deployment but that would leave out the options[:system] = true tweak, and I'm not quite sure if that would cause problems.

@segiddins
Copy link
Member

The only thing that should be touching the global config is bundle config --global, in my opinion. I think maybe the solution here is to just check where the frozen setting is coming from, and suggest deleting it if it's not coming from the app config?

@trevorturk
Copy link
Author

You can see from the code snippet I pasted above that I ran bundle config --global frozen 1 -- this was part of my attempt to debug #5006 because that's what the Dockerfile I inherited contained.

Regardless of where the global config came from, however, the problem I'd like to fix is that the suggested fix from the Bundler error message doesn't work as it doesn't remove the global config. WDYT?

(Again, apologies, I must be really annoying by now :)

@segiddins
Copy link
Member

I agree that the right thing to fix is the error message :)

@trevorturk
Copy link
Author

Ok, I'll work up a PR that suggests running bundle config --delete frozen if bundle install --no-deployment doesn't work. Thanks!

@segiddins
Copy link
Member

we can also detect where the settings are set and be smart about it that way

bundlerbot added a commit that referenced this issue Mar 14, 2017
…giddins

Suggest different command depending on where 'frozen' config is set

Fixes: #5009
bundlerbot added a commit that referenced this issue Mar 15, 2017
…giddins

Suggest different command depending on where 'frozen' config is set

Fixes: #5009
philipefarias added a commit to dleemoo/rc-images that referenced this issue Jun 12, 2017
Changes since last version used (1.14.6):

== 1.15.1 (2017-06-02)

Bugfixes:

  - `bundle lock --update GEM` will fail gracefully when the gem is not in the lockfile (rubygems/bundler#5693, @segiddins)
  - `bundle init --gemspec` will fail gracefully when the gemspec is invalid (@colby-swandale)
  - `bundle install --force` works when the gemfile contains git gems (rubygems/bundler#5678, @segiddins)
  - `bundle env` will print well-formed markdown when there are no settings (rubygems/bundler#5677, @segiddins)

== 1.15.0 (2017-05-19)

This space intentionally left blank.

== 1.15.0.pre.4 (2017-05-10)

Bugfixes:

  - avoid conflicts when `Gem.finish_resolve` is called after the bundle has been set up (@segiddins)
  - ensure that `Gem::Specification.find_by_name` always returns an object that can have `#to_spec` called on it (rubygems/bundler#5592, @jules2689)

== 1.15.0.pre.3 (2017-04-30)

Bugfixes:

  - avoid redundant blank lines in the readme generated by `bundle gem` (@koic)
  - ensure that `open-uri` is not loaded after `bundle exec` (@segiddins)
  - print a helpful error message when an activated default gem conflicts with
    a gem in the gemfile (@segiddins)
  - only shorten `ref` option for git gems when it is a SHA (rubygems/bundler#5620, @segiddins)

== 1.15.0.pre.2 (2017-04-23)

Bugfixes:

  - ensure pre-existing fit caches are updated from remote sources (rubygems/bundler#5423, @alextaylor000)
  - avoid duplicating specs in the lockfile after updating with the gem uninstalled (rubygems/bundler#5599, @segiddins)
  - ensure git gems have their extensions available at runtime (rubygems/bundler#5594, @jules2689, @segiddins)

== 1.15.0.pre.1 (2017-04-16)

Features:

  - print a notification when a newer version of bundler is available (rubygems/bundler#4683, @segiddins)
  - add man pages for all bundler commands (rubygems/bundler#4988, @feministy)
  - add the `bundle info` command (@fredrb, @colby-swandale)
  - all files created with `bundle gem` comply with the bundler style guide (@zachahn)
  - if installing a gem fails, print out the reason the gem needed to be installed (rubygems/bundler#5078, @segiddins)
  - allow setting `gem.push_key` to set the key used when running `rake release` (@DTrierweiler)
  - print gem versions that are regressing during `bundle update` in yellow (rubygems/bundler#5506, @brchristian)
  - avoid printing extraneous dependencies when the resolver encounters a conflict (@segiddins)
  - add the `bundle issue` command that prints instructions for reporting issues (rubygems/bundler#4871, @jonathanpike)
  - add `--source` and `--group` options to the `bundle inject` command (rubygems/bundler#5452, @Shekharrajak)
  - add the `bundle add` command to add a gem to the gemfile (@denniss)
  - add the `bundle pristine` command to re-install gems from cached `.gem` files (rubygems/bundler#4509, @denniss)
  - add a `--parseable` option for `bundle config` (@JuanitoFatas, @colby-swandale)

Performance:

  - speed up gemfile initialization by storing locked dependencies as a hash (@jules2689)
  - speed up gemfile initialization by making locked dependency comparison lazy, avoiding object allocation (@jules2689)
  - only validate git gems when they are downloaded, instead of every time `Bundler.setup` is run (@segiddins)
  - avoid regenerating the lockfile when nothing has changed (@segiddins)
  - avoid diffing large arrays when no sources in the gemfile have changed (@segiddins)
  - avoid evaluating full gemspecs when running with RubyGems 2.5+ (@segiddins)

Bugfixes:

  - fix cases where `bundle update` would print a resolver conflict instead of updating the selected gems (rubygems/bundler#5031, rubygems/bundler#5095, @segiddins)
  - print out a stack trace after an interrupt when running in debug mode (@segiddins)
  - print out when bundler starts fetching a gem from a remote server (@segiddins)
  - fix `bundle gem` failing when `git` is unavailable (rubygems/bundler#5458, @Shekharrajak, @colby-swandale)
  - suggest the appropriate command to unfreeze a bundle (rubygems/bundler#5009, @denniss)
  - ensure nested calls to `bundle exec` resolve default gems correctly (rubygems/bundler#5500, @segiddins)
  - ensure that a plugin failing to install doesn't uninstall other plugins (@kerrizor, @roseaboveit)
  - ensure `socket` is required before being referenced (rubygems/bundler#5533, @rafaelfranca)
  - allow running `bundle outdated` when gems aren't installed locally (rubygems/bundler#5553, @segiddins)
  - print a helpful error when `bundle exec`ing to a gem that isn't included in the bundle (rubygems/bundler#5487, @segiddins)
  - print an error message when a non-git gem is given a `branch` option (rubygems/bundler#5530, @colby-swandale)
  - allow interrupts to exit the process after gems have been installed (@segiddins)
  - print the underlying error when downloading gem metadata fails (rubygems/bundler#5579, @segiddins)
  - avoid deadlocking when installing with a lockfile that is missing dependencies (rubygems/bundler#5378, rubygems/bundler#5480, rubygems/bundler#5519, rubygems/bundler#5526, rubygems/bundler#5529, rubygems/bundler#5549, rubygems/bundler#5572, @segiddins)
hsbt pushed a commit to rubygems/bundler-graph that referenced this issue Oct 19, 2021
…giddins

Suggest different command depending on where 'frozen' config is set

Fixes: rubygems/bundler#5009
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants