Skip to content

Commit fb4f6b2

Browse files
committed
removes frozen flag and opts for bundle config set frozen true instead
1 parent 34cd888 commit fb4f6b2

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

app/models/shipit/deploy_spec/bundler_discovery.rb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ def discover_machine_env
2626
end
2727

2828
def bundle_install
29-
bundle = %(bundle install #{frozen_flag} --jobs 4 --path #{bundle_path} --retry 2)
30-
bundle += " --without=#{bundler_without.join(':')}" unless bundler_without.empty?
31-
[remove_ruby_version_from_gemfile, bundle]
29+
install_command = %(bundle install --jobs 4 --path #{bundle_path} --retry 2)
30+
install_command += " --without=#{bundler_without.join(':')}" unless bundler_without.empty?
31+
[
32+
remove_ruby_version_from_gemfile,
33+
(bundle_config_frozen if frozen_mode?),
34+
install_command
35+
].compact
3236
end
3337

3438
def remove_ruby_version_from_gemfile
@@ -41,11 +45,14 @@ def remove_ruby_version_from_gemfile
4145
end
4246
end
4347

44-
def frozen_flag
45-
return unless gemfile_lock_exists?
46-
return if config('dependencies', 'bundler', 'frozen') == false
48+
def bundle_config_frozen
49+
'bundle config set --local frozen true'
50+
end
51+
52+
def frozen_mode?
53+
return false unless gemfile_lock_exists?
4754

48-
'--frozen'
55+
config('dependencies', 'bundler', 'frozen') != false
4956
end
5057

5158
def bundler_without

test/models/deploy_spec_test.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class DeploySpecTest < ActiveSupport::TestCase
6767
@spec.stubs(:gemfile_lock_exists?).returns(true)
6868
command = %(
6969
bundle install
70-
--frozen
7170
--jobs 4
7271
--path #{DeploySpec.bundle_path}
7372
--retry 2
@@ -81,7 +80,6 @@ class DeploySpecTest < ActiveSupport::TestCase
8180
@spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
8281
command = %(
8382
bundle install
84-
--frozen
8583
--jobs 4
8684
--path #{DeploySpec.bundle_path}
8785
--retry 2
@@ -90,22 +88,22 @@ class DeploySpecTest < ActiveSupport::TestCase
9088
assert_equal command, @spec.bundle_install.last
9189
end
9290

93-
test '#bundle_install has --frozen option if Gemfile.lock is present' do
91+
test '#bundle_install configures frozen mode if Gemfile.lock is present' do
9492
@spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
9593
@spec.stubs(:gemfile_lock_exists?).returns(true)
96-
assert @spec.bundle_install.last.include?('--frozen')
94+
assert @spec.bundle_install.include?('bundle config set --local frozen true')
9795
end
9896

99-
test '#bundle_install does not have --frozen option if Gemfile.lock is not present' do
97+
test '#bundle_install does not configure frozen mode if Gemfile.lock is not present' do
10098
@spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
10199
@spec.stubs(:gemfile_lock_exists?).returns(false)
102-
refute @spec.bundle_install.last.include?('--frozen')
100+
refute @spec.bundle_install.include?('bundle config set --local frozen true')
103101
end
104102

105-
test '#bundle_install does not have --frozen if overridden in shipit.yml' do
103+
test '#bundle_install does not configure frozen mode if overridden in shipit.yml' do
106104
@spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'frozen' => false } })
107105
@spec.stubs(:gemfile_lock_exists?).returns(true)
108-
refute @spec.bundle_install.last.include?('--frozen')
106+
refute @spec.bundle_install.include?('bundle config set --local frozen true')
109107
end
110108

111109
test "#provisioning_handler returns `provision.handler` if present" do

0 commit comments

Comments
 (0)