synchronised_migration 1.0.2 → 2.0.0

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
  SHA1:
3
- metadata.gz: 43c8eeec8dc9d137fa28a3a9bb87814c037d7c90
4
- data.tar.gz: 4871ae55efa6ff785ce3abd82b10791ebc36c999
3
+ metadata.gz: 00db2582bb879e1481b044bbc394f3da0b84cfcc
4
+ data.tar.gz: 3afb675d990294a656eec86f7bd539c7c5d82625
5
5
  SHA512:
6
- metadata.gz: a9c10741ab43ea1a58413fb131041b304d2d4f4da46c22211eca01b7346dca225711f6768afabf8c1f5cd1600e43ebb1ebe51cfe1fa68498064a99e83c3dbcf4
7
- data.tar.gz: 20676d206a60b67c9aaa92a56dd567941dd6021d00e7639cde2db60f6656114e7f3321d4ba2f983530e1df79c65c7e80067cfa8028a911f87dc9fc0385c74067
6
+ metadata.gz: 0b50bb56d5ef420e3fd398f867659eed45ef72e0ff2058b15276c4da58f2068232222b860ea726126d628d5e71a0221065624e667476345841588b1ebad54e79
7
+ data.tar.gz: 56d9d17730bf54bea7d9c4ba99584ce1dc0a582a046c494d03f44e283ba1ad435d00b3a9caacc53065af2ec9948ed252c4de3c80702d40c49f51b33b7160a215
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Synchronised Migration
2
2
 
3
+ ## 2.0.0
4
+
5
+ * [DO-168] Removed requirement for defining RedisConfig, now set on
6
+ SynchronisedMigration module
7
+
3
8
  ## 1.0.2
4
9
 
5
10
  * [DO-105] Use the `original` environment instead
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synchronised_migration (1.0.2)
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 (3.3.5)
24
- redlock (0.2.0)
25
- redis (~> 3, >= 3.0.0)
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.0
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
- Class `RedisConfig` needs to be provided as follow.
18
+ Module `SynchronisedMigration` needs to be configured as below.
19
19
 
20
20
  ```
21
- RedisConfig.get[:host] # example.com
22
- RedisConfig.get[:port] # 6379
23
- RedisConfig.get[:db] # 0
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
- RedisConfig.get[:host],
87
- RedisConfig.get[:port],
88
- RedisConfig.get[:db]
86
+ SynchronisedMigration.redis_config.host,
87
+ SynchronisedMigration.redis_config.port,
88
+ SynchronisedMigration.redis_config.db
89
89
  )
90
90
  end
91
91
 
@@ -1,3 +1,3 @@
1
1
  module SynchronisedMigration
2
- VERSION = '1.0.2'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -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
- stub_const(
33
- 'RedisConfig', double(
34
- get: {
35
- host: 'example.com',
36
- port: 6379,
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: 1.0.2
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: 2017-11-06 00:00:00.000000000 Z
12
+ date: 2018-04-17 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: redlock