synchronised_migration 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ef871349cf34d118ae3cdcc03dd6560ea479000
4
- data.tar.gz: 18c52c61ba632ed6fc4dec7140ee164c499ff025
3
+ metadata.gz: 212072787b988c9bbf519fcbc300f47c43b369d0
4
+ data.tar.gz: 6c11fc29b21f4b21997ce99d9ac487417d975260
5
5
  SHA512:
6
- metadata.gz: 3deed9eafa27fbc5262fb6a52969dcd374c06805b93010783346d8e00e0507ddd3f61452e163154d0a222c209704d12f22967167dd1e4c38ae0d7d2a4e216a34
7
- data.tar.gz: 24b5c0160ba71b687806e40bc48ecd6d4e281801110d7a6c975565443cfe95307253f54d3640590d3b867ed81eb21e92cc8e51fb45c9f916ea4171d3a1172f50
6
+ metadata.gz: eb93c86309e617ee74f2bf28129310028fe6eaa29836b80eb9b41b7ac6ad5a9a4c17ae58f00a95921d114f8ffefbee7c6ed007cdd255778d785b7baff66f49fc
7
+ data.tar.gz: b390df5675f5ba096e4be05ce0b12aa9151eccfd45b9f5cc2259ed4c14025152a15c343333a37e1fa9c302de894802ce9568963df1a2d766a0cdfa8f0eb20a9c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Synchronised Migration
2
2
 
3
+ ## 1.0.0
4
+
5
+ * [DO-100] Allow nesting bundler exec
6
+
3
7
  ## 0.1.0
4
8
 
5
9
  * [DO-70] Use Redis to synchronise migrations across multiple deployments
data/README.md CHANGED
@@ -27,6 +27,7 @@ You may override these settings through environment variables.
27
27
 
28
28
  ```
29
29
  SYNCHRONISED_COMMAND=bin/launch/migrate
30
+ WITH_CLEAN_BUNDLER_ENV=1 # Non-empty for true
30
31
  REDLOCK_TIMEOUT_MS=3600000
31
32
  REDLOCK_RETRY_DELAY_MS=200
32
33
  REDLOCK_LOCK_KEY=migration-in-progress
@@ -49,7 +49,14 @@ class SynchronisedMigration::Main
49
49
  end
50
50
 
51
51
  def migrate
52
- Kernel.system target_command
52
+ return Kernel.system target_command unless with_clean_env?
53
+ Bundler.with_clean_env do
54
+ Kernel.system target_command
55
+ end
56
+ end
57
+
58
+ def with_clean_env?
59
+ not ENV.fetch('WITH_CLEAN_BUNDLER_ENV', '').empty?
53
60
  end
54
61
 
55
62
  def migration_failed?
@@ -1,3 +1,3 @@
1
1
  module SynchronisedMigration
2
- VERSION = '0.1.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -27,6 +27,8 @@ describe SynchronisedMigration::Main do
27
27
  method.call *args
28
28
  }
29
29
 
30
+ allow(Bundler).to receive(:with_clean_env).and_call_original
31
+
30
32
  stub_const(
31
33
  'RedisConfig', double(
32
34
  get: {
@@ -45,10 +47,24 @@ describe SynchronisedMigration::Main do
45
47
  expect(redis).to have_received(:get).with('migration-failed')
46
48
  expect(redis).to have_received(:set).with('migration-failed', 1)
47
49
  expect(Kernel).to have_received(:system)
50
+ expect(Bundler).not_to have_received(:with_clean_env)
48
51
  expect(redis).to have_received(:del).with('migration-failed')
49
52
  end
50
53
  end
51
54
 
55
+ context 'when require a clean Bundler environment' do
56
+ before do
57
+ allow(ENV).to receive(:fetch).and_call_original
58
+ allow(ENV).to receive(:fetch).with('WITH_CLEAN_BUNDLER_ENV', '').and_return('1')
59
+ end
60
+
61
+ it 'executes it with a clean Bundler environment' do
62
+ expect(result).to be_success
63
+ expect(Kernel).to have_received(:system)
64
+ expect(Bundler).to have_received(:with_clean_env)
65
+ end
66
+ end
67
+
52
68
  context 'after a deployment failed previously' do
53
69
  let(:fail_marker_value) { '1' }
54
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synchronised_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvin Yim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-12 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redlock