Skip to content

Instantly share code, notes, and snippets.

@xaviershay
Last active March 19, 2019 13:18
Show Gist options
  • Save xaviershay/6295889 to your computer and use it in GitHub Desktop.
Save xaviershay/6295889 to your computer and use it in GitHub Desktop.
Sample repro script for bundler.
#!/bin/bash
set -ex
ISSUE=2165
ROOT_DIR=/tmp/repro-$ISSUE
REPO_DIR=$ROOT_DIR/repo
PROJECT_DIR=$ROOT_DIR/project
mkdir -p $ROOT_DIR
rm -rf $REPO_DIR
rm -rf $PROJECT_DIR
mkdir -p $REPO_DIR
mkdir -p $PROJECT_DIR
cd $ROOT_DIR
bundle env
# Bundler 1.3.5
# Ruby 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.4.0]
# Rubygems 2.0.3
# GEM_HOME
# Bundler settings
# disable_local_branch_check
# Set for the current user (/Users/xavier/.bundle/config): "true"
# Set up a gem repository
# ==================================================
cd $REPO_DIR
bundle gem gem1
bundle gem gem2
bundle gem gem3
# BSD/OSX
sed -i '' 's/TODO: //g' */*.gemspec # Remove TODO: from the gemspecs
# LINUX
# sed -i 's/TODO: //g' */*.gemspec # Remove TODO: from the gemspecs
git init
git add .
git commit -m "Initial commit"
# Set up our project that uses bundler
# ==================================================
cd $PROJECT_DIR
bundle init
cat > Gemfile <<RUBY
source "https://rubygems.org"
gem 'gem1',
git: 'file://$REPO_DIR',
branch: 'master'
gem 'gem2',
git: 'file://$REPO_DIR',
branch: 'master'
gem 'gem3',
git: 'file://$REPO_DIR',
branch: 'master'
RUBY
bundle
grep revision Gemfile.lock #--> Make note of revision
cd $REPO_DIR
# BSD/OSX
sed -i '' 's/VERSION = "0.0.1"/VERSION = "0.0.2"/g' */lib/*/version.rb # Bump the versions
# LINUX
# sed -i 's/VERSION = "0.0.1"/VERSION = "0.0.2"/g' */lib/*/version.rb # Bump the versions
git add .
git commit -m "Bumping version numbers"
cd $PROJECT_DIR
bundle update gem1
# Note that it does not say "Updating [my repo name]"
# Fetching gem metadata from https://rubygems.org/..
# Using gem1 (0.0.1) from
# Using gem2 (0.0.1) from
# Using gem3 (0.0.1) from
# Using bundler (1.2.2)
# Expected behaviour: revision for gem1 has been updated
# Observed behaviour: revision is the same as noted earlier
grep revision Gemfile.lock
bundle update
#--- OUT ---
# Updating https://github.com/ronaldmcdollars/git-branch-issue.git
# Username:
# Password:
# Unpacking objects: 100% (14/14), done.
# Fetching gem metadata from https://rubygems.org/..
# Using gem1 (0.0.2) from
# Using gem2 (0.0.2) from
# Using gem3 (0.0.2) from
# Using bundler (1.2.2)
#--- /OUT ---
grep revision Gemfile.lock #--> Revision is updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment