Skip to content

Instantly share code, notes, and snippets.

@wconrad
Last active December 28, 2015 03:29
Show Gist options
  • Save wconrad/7435134 to your computer and use it in GitHub Desktop.
Save wconrad/7435134 to your computer and use it in GitHub Desktop.
Script to demonstrate [an alleged bug in bundler, in that requiring bundler/setup can modify the Gemfile.lock. See: https://github.com/bundler/bundler/issues/2710
Note: This is the output of "bundle env" _after_ the test script has run. The Gemfile and Gemfile.lock therefore show the modified state of those two file, not their original state.
Bundler 1.3.5
Ruby 1.9.3 (2013-06-27 patchlevel 448) [i686-linux]
Rubygems 2.0.7
rvm 1.22.9 (stable)
GEM_HOME /home/wayne/.rvm/gems/ruby-1.9.3-p448
GEM_PATH /home/wayne/.rvm/gems/ruby-1.9.3-p448:/home/wayne/.rvm/gems/ruby-1.9.3-p448@global
Bundler settings
bin_path
Set via BUNDLE_BIN_PATH: "/home/wayne/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/bin/bundle"
gemfile
Set via BUNDLE_GEMFILE: "/tmp/d20131112-16493-d4xcy2/Gemfile"
Gemfile
source "http://rubygems.org"
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
PLATFORMS
ruby
DEPENDENCIES
require 'fileutils'
require 'tmpdir'
Dir.mktmpdir do |temp_dir|
Dir.chdir(temp_dir) do
File.open('Gemfile', 'w') do |file|
file.puts 'source "http://rubygems.org"'
file.puts 'gem "zip"'
end
system 'bundle install'
FileUtils.cp 'Gemfile.lock', 'Gemfile.lock.orig'
File.open('Gemfile', 'w') do |file|
file.puts 'source "http://rubygems.org"'
end
require 'bundler/setup'
system 'diff -u Gemfile.lock.orig Gemfile.lock'
end
end
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Using zip (2.0.2)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
--- Gemfile.lock.orig 2013-11-12 10:42:21.000000000 -0700
+++ Gemfile.lock 2013-11-12 10:42:21.000000000 -0700
@@ -1,10 +1,8 @@
GEM
remote: http://rubygems.org/
specs:
- zip (2.0.2)
PLATFORMS
ruby
DEPENDENCIES
- zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment