synchronised_migration 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +5 -5
- data/README.md +9 -4
- data/lib/synchronised_migration/main.rb +3 -3
- data/lib/synchronised_migration/version.rb +1 -1
- data/lib/synchronised_migration.rb +18 -0
- data/spec/synchronised_migration/main_spec.rb +5 -9
- data/synchronised_migration.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00db2582bb879e1481b044bbc394f3da0b84cfcc
|
4
|
+
data.tar.gz: 3afb675d990294a656eec86f7bd539c7c5d82625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b50bb56d5ef420e3fd398f867659eed45ef72e0ff2058b15276c4da58f2068232222b860ea726126d628d5e71a0221065624e667476345841588b1ebad54e79
|
7
|
+
data.tar.gz: 56d9d17730bf54bea7d9c4ba99584ce1dc0a582a046c494d03f44e283ba1ad435d00b3a9caacc53065af2ec9948ed252c4de3c80702d40c49f51b33b7160a215
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synchronised_migration (
|
4
|
+
synchronised_migration (2.0.0)
|
5
5
|
redlock (~> 0.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -20,9 +20,9 @@ GEM
|
|
20
20
|
pry-byebug (3.5.0)
|
21
21
|
byebug (~> 9.1)
|
22
22
|
pry (~> 0.10)
|
23
|
-
redis (
|
24
|
-
redlock (0.2.
|
25
|
-
redis (
|
23
|
+
redis (4.0.1)
|
24
|
+
redlock (0.2.2)
|
25
|
+
redis (>= 3.0.0, < 5.0)
|
26
26
|
rspec (3.6.0)
|
27
27
|
rspec-core (~> 3.6.0)
|
28
28
|
rspec-expectations (~> 3.6.0)
|
@@ -55,4 +55,4 @@ DEPENDENCIES
|
|
55
55
|
synchronised_migration!
|
56
56
|
|
57
57
|
BUNDLED WITH
|
58
|
-
1.16.
|
58
|
+
1.16.1
|
data/README.md
CHANGED
@@ -15,14 +15,19 @@ Docker](https://github.com/sealink/craft-docker) project.
|
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
18
|
-
|
18
|
+
Module `SynchronisedMigration` needs to be configured as below.
|
19
19
|
|
20
20
|
```
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
SynchronisedMigration.configure do |config|
|
22
|
+
config.host = 'example.com'
|
23
|
+
config.port = 6379
|
24
|
+
config.db = 0
|
25
|
+
end
|
24
26
|
```
|
25
27
|
|
28
|
+
Configuration can be called by using
|
29
|
+
```SynchronisedMigration.redis_config.host``` or similar.
|
30
|
+
|
26
31
|
You may override these settings through environment variables.
|
27
32
|
|
28
33
|
```
|
@@ -83,9 +83,9 @@ class SynchronisedMigration::Main
|
|
83
83
|
def redis_url
|
84
84
|
sprintf(
|
85
85
|
'redis://%s:%s/%s',
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
SynchronisedMigration.redis_config.host,
|
87
|
+
SynchronisedMigration.redis_config.port,
|
88
|
+
SynchronisedMigration.redis_config.db
|
89
89
|
)
|
90
90
|
end
|
91
91
|
|
@@ -1,4 +1,22 @@
|
|
1
1
|
module SynchronisedMigration
|
2
|
+
class << self
|
3
|
+
attr_accessor :redis_config
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.configure
|
7
|
+
self.redis_config ||= Configuration.new
|
8
|
+
yield(redis_config)
|
9
|
+
end
|
10
|
+
|
11
|
+
class Configuration
|
12
|
+
attr_accessor :host, :port, :db
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@host = ''
|
16
|
+
@port = 0
|
17
|
+
@db = 0
|
18
|
+
end
|
19
|
+
end
|
2
20
|
end
|
3
21
|
|
4
22
|
require 'synchronised_migration/railtie' if defined?(Rails)
|
@@ -29,15 +29,11 @@ describe SynchronisedMigration::Main do
|
|
29
29
|
|
30
30
|
allow(Bundler).to receive(:with_original_env).and_call_original
|
31
31
|
|
32
|
-
|
33
|
-
'
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
db: 0
|
38
|
-
}
|
39
|
-
)
|
40
|
-
)
|
32
|
+
SynchronisedMigration.configure do |config|
|
33
|
+
config.host = 'example.com'
|
34
|
+
config.port = 6379
|
35
|
+
config.db = 0
|
36
|
+
end
|
41
37
|
end
|
42
38
|
|
43
39
|
context 'in the happy path' do
|
@@ -5,7 +5,7 @@ require 'synchronised_migration/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'synchronised_migration'
|
7
7
|
spec.version = SynchronisedMigration::VERSION
|
8
|
-
spec.authors = ['Alvin Yim']
|
8
|
+
spec.authors = ['Alvin Yim', 'Stefan Cooper']
|
9
9
|
spec.email = 'support@travellink.com.au'
|
10
10
|
spec.description = 'Use Redis to record the data migration status'
|
11
11
|
spec.summary = 'For deploying to multiple instances simultaneously'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synchronised_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alvin Yim
|
8
|
+
- Stefan Cooper
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: redlock
|