Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Work around bundler deploy
ubuntu@dob2-bach-r4an07:~/chef-bach$ git show 8ce3830c8624a179662d71d1abf74ed320fddd9f
commit 8ce3830c8624a179662d71d1abf74ed320fddd9f
Author: Clay Baenziger <>
Date: Sun Jul 16 18:44:01 2017 -0400
Check if bach_repo Gemfile.lock is committed
diff --git a/cookbooks/bach_repository/recipes/gems.rb b/cookbooks/bach_reposito
index e1ca4b6..7ebbcc2 100644
--- a/cookbooks/bach_repository/recipes/gems.rb
+++ b/cookbooks/bach_repository/recipes/gems.rb
@@ -46,14 +46,19 @@ end
# it is run on an internet-disconnected host only to verify the
# extracted package is complete.
-# This ruby_block checks for the presence of a Gemfile.lock in order
+# This ruby_block checks for the presence of a Gemfile.lock on the file
+# system and in the Git repo (as required by Bundler) in order
# to determine which scenario applies, then append a --deployment
# switch in the latter case.
ruby_block 'determine-bundler-command' do
block do
- if File.exists?(File.join(node['bach']['repository']['repo_directory'],
- 'Gemfile.lock'))
+ gemfile_lock_path = File.join(node['bach']['repository']['repo_directory'],
+ 'Gemfile.lock')
+ gemfile_lock_cmd ='git', 'diff', '--name-status',
+ gemfile_lock_path)
+ gemfile_lock_cmd.run_command
+ if File.exists?(gemfile_lock_path) && !gemfile_lock_cmd.error?
node.run_state[:bcpc_bootstrap_bundler_command] =
"#{bundler_bin} install --deployment"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment