Created
July 16, 2017 22:45
-
-
Save cbaenziger/fd7f953feac1cf679ced6bdb82232022 to your computer and use it in GitHub Desktop.
Work around bundler deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@dob2-bach-r4an07:~/chef-bach$ git show 8ce3830c8624a179662d71d1abf74ed320fddd9f | |
commit 8ce3830c8624a179662d71d1abf74ed320fddd9f | |
Author: Clay Baenziger <cbaenziger@bloomberg.net> | |
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 = Mixlib::ShellOut.new('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" | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment