shipit-engine 0.42.1 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c95a2e049279a481503f3ed07a634d3926c1533ddd3b228cde55c3b324df1af1
4
- data.tar.gz: b33f1940ee6d4f3909fca272a439604740899a37caa5f11f875ffe543d4332df
3
+ metadata.gz: a115bf18d2ceef6d9174c41bf746c8c0e7481b9967f546ee26ff9dfad8cde608
4
+ data.tar.gz: 5e3856d83fdd58ec6f169ce4a01e2782606cddeda43b24705075e62237c79709
5
5
  SHA512:
6
- metadata.gz: d89afad83961d8ef42c6011116451e2025719345d4aa753a62dae3dac0f59370d33ed71261e812f6bd16bf20583cd29c300023d833db4dda8e851ff5ac068f3e
7
- data.tar.gz: f3c90b17a66f5a14e2489869c636206cd5f5a55465d2bd58ab4a947cb82d4fe99cbd1cb057d4d1f8a195417d8964b2d3c66a65c1a115f381cb63b20f4b6aa298
6
+ metadata.gz: b1763e4292845af68b81ff1e60dc34377a962834a797975293429726371b9a8868be7a47193a777e3e10bcfb171dc429d09b86aaf83f202e065716245c650214
7
+ data.tar.gz: 9a6f799a3d538f45c781443798f7076a52e98499d6e56cc477b250ca5a390759b3344c6d5a1809cc894bb88ad456d64b6d3910ab3322b371b88ed314dd83b538
@@ -26,9 +26,18 @@ module Shipit
26
26
  end
27
27
 
28
28
  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 --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
+ bundle_config_path,
35
+ install_command
36
+ ].compact
37
+ end
38
+
39
+ def bundle_config_path
40
+ "bundle config set --local path #{bundle_path}"
32
41
  end
33
42
 
34
43
  def remove_ruby_version_from_gemfile
@@ -41,11 +50,14 @@ module Shipit
41
50
  end
42
51
  end
43
52
 
44
- def frozen_flag
45
- return unless gemfile_lock_exists?
46
- return if config('dependencies', 'bundler', 'frozen') == false
53
+ def bundle_config_frozen
54
+ 'bundle config set --local frozen true'
55
+ end
56
+
57
+ def frozen_mode?
58
+ return false unless gemfile_lock_exists?
47
59
 
48
- '--frozen'
60
+ config('dependencies', 'bundler', 'frozen') != false
49
61
  end
50
62
 
51
63
  def bundler_without
@@ -41,7 +41,7 @@ module Shipit
41
41
  'GITHUB_TOKEN' => github.token
42
42
  )
43
43
 
44
- unless Rails.env.development? || Rails.env.test?
44
+ if Shipit.use_git_askpass?
45
45
  env['GIT_ASKPASS'] = Shipit::Engine.root.join('lib', 'snippets', 'git-askpass').realpath.to_s
46
46
  end
47
47
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shipit
4
- VERSION = '0.42.1'
4
+ VERSION = '0.43.1'
5
5
  end
data/lib/shipit.rb CHANGED
@@ -71,7 +71,8 @@ module Shipit
71
71
  :internal_hook_receivers,
72
72
  :preferred_org_emails,
73
73
  :task_execution_strategy,
74
- :task_logger
74
+ :task_logger,
75
+ :use_git_askpass
75
76
  )
76
77
 
77
78
  def task_execution_strategy
@@ -297,6 +298,10 @@ module Shipit
297
298
  @task_logger ||= Logger.new(nil)
298
299
  end
299
300
 
301
+ def use_git_askpass?
302
+ @use_git_askpass.nil? ? true : @use_git_askpass
303
+ end
304
+
300
305
  protected
301
306
 
302
307
  def revision_file
@@ -48,6 +48,9 @@ Rails.application.configure do
48
48
  # Raises helpful error messages.
49
49
  config.assets.raise_runtime_errors = true
50
50
 
51
+ # Disable git askpass in development
52
+ Shipit.use_git_askpass = false
53
+
51
54
  # Raises error for missing translations
52
55
  # config.action_view.raise_on_missing_translations = true
53
56
  if Rails.application.config_for(:database)&.dig('adapter') == 'sqlite3'
@@ -76,4 +76,7 @@ Rails.application.configure do
76
76
 
77
77
  # Do not dump schema after migrations.
78
78
  config.active_record.dump_schema_after_migration = false
79
+
80
+ # Make sure git askpass is enabled in production
81
+ Shipit.use_git_askpass = true
79
82
  end
@@ -32,6 +32,9 @@ Rails.application.configure do
32
32
  # Print deprecation notices to the stderr.
33
33
  config.active_support.deprecation = :stderr
34
34
 
35
+ # Disable git askpass in test
36
+ Shipit.use_git_askpass = false
37
+
35
38
  # Raises error for missing translations
36
39
  # config.action_view.raise_on_missing_translations = true
37
40
 
@@ -53,7 +53,7 @@ module Shipit
53
53
  ]
54
54
  },
55
55
  "override": [
56
- "bundle check --path=/tmp/bundler || bundle install --frozen --path=/tmp/bundler --retry=2 --without=default:production:development:test:staging:benchmark:debug"
56
+ "bundle config set path /tmp/bundler && (bundle check || bundle install --frozen --retry=2 --without=default:production:development:test:staging:benchmark:debug)"
57
57
  ]
58
58
  },
59
59
  "fetch": [
@@ -67,13 +67,14 @@ module Shipit
67
67
  @spec.stubs(:gemfile_lock_exists?).returns(true)
68
68
  command = %(
69
69
  bundle install
70
- --frozen
71
70
  --jobs 4
72
- --path #{DeploySpec.bundle_path}
73
71
  --retry 2
74
72
  --without=default:production:development:test:staging:benchmark:debug
75
73
  ).gsub(/\s+/, ' ').strip
74
+ config_command = "bundle config set --local path #{@spec.bundle_path}"
75
+
76
76
  assert_equal command, @spec.bundle_install.last
77
+ assert @spec.bundle_install.include?(config_command)
77
78
  end
78
79
 
79
80
  test '#bundle_install use `dependencies.bundler.without` if present to build the --without argument' do
@@ -81,31 +82,29 @@ module Shipit
81
82
  @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
82
83
  command = %(
83
84
  bundle install
84
- --frozen
85
85
  --jobs 4
86
- --path #{DeploySpec.bundle_path}
87
86
  --retry 2
88
87
  --without=some:custom:groups
89
88
  ).gsub(/\s+/, ' ').strip
90
89
  assert_equal command, @spec.bundle_install.last
91
90
  end
92
91
 
93
- test '#bundle_install has --frozen option if Gemfile.lock is present' do
92
+ test '#bundle_install configures frozen mode if Gemfile.lock is present' do
94
93
  @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
95
94
  @spec.stubs(:gemfile_lock_exists?).returns(true)
96
- assert @spec.bundle_install.last.include?('--frozen')
95
+ assert @spec.bundle_install.include?('bundle config set --local frozen true')
97
96
  end
98
97
 
99
- test '#bundle_install does not have --frozen option if Gemfile.lock is not present' do
98
+ test '#bundle_install does not configure frozen mode if Gemfile.lock is not present' do
100
99
  @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } })
101
100
  @spec.stubs(:gemfile_lock_exists?).returns(false)
102
- refute @spec.bundle_install.last.include?('--frozen')
101
+ refute @spec.bundle_install.include?('bundle config set --local frozen true')
103
102
  end
104
103
 
105
- test '#bundle_install does not have --frozen if overridden in shipit.yml' do
104
+ test '#bundle_install does not configure frozen mode if overridden in shipit.yml' do
106
105
  @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'frozen' => false } })
107
106
  @spec.stubs(:gemfile_lock_exists?).returns(true)
108
- refute @spec.bundle_install.last.include?('--frozen')
107
+ refute @spec.bundle_install.include?('bundle config set --local frozen true')
109
108
  end
110
109
 
111
110
  test "#provisioning_handler returns `provision.handler` if present" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipit-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.1
4
+ version: 0.43.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier