fulmar 1.7.3 → 1.7.4
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 +4 -4
- data/lib/fulmar/domain/task/database_sync.rake +32 -10
- data/lib/fulmar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b224365b805643b2d4196803ff91f98391a7d09
|
4
|
+
data.tar.gz: 44926cb57c59dac055bdb5be8071ec01546c860a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49fdb7b07030110486fca5d08555b5a357ecb1216ec29db361da21a2d3dee55a4863fc87d15a20473381904791efc29c7474beb158f0bc5d07864991ef7faf2c
|
7
|
+
data.tar.gz: 39318f26ffed3ab373de64ec1f6fb9dadef6abce1e430d0c3de1b93d8e360ea72e57ffe2d7c7ae14e5b83fd4ab17f0b2c10bab1d3d4e43a1736bbb3e8694c79f
|
@@ -3,19 +3,20 @@ configuration.each do |env, target, data|
|
|
3
3
|
db_configs << [env, target] if data[:type] == 'maria'
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
configuration.
|
6
|
+
# Expects two hashes as parameters each with { :environment, :target, :name } set
|
7
|
+
# :name is either environment:target or just the environment, if the is only one target
|
8
|
+
def create_update_task(from, to)
|
9
|
+
namespace to[:name] do
|
10
|
+
task "from_#{from[:name]}" do
|
11
|
+
configuration.environment = from[:environment]
|
12
|
+
configuration.target = from[:target]
|
12
13
|
puts 'Getting dump...'
|
13
14
|
sql_dump = database.download_dump
|
14
15
|
if sql_dump == ''
|
15
16
|
puts 'Cannot create sql dump'
|
16
17
|
else
|
17
|
-
configuration.environment =
|
18
|
-
configuration.target =
|
18
|
+
configuration.environment = to[:environment]
|
19
|
+
configuration.target = to[:target]
|
19
20
|
puts 'Sending dump...'
|
20
21
|
remote_sql_dump = upload(sql_dump)
|
21
22
|
database.load_dump(remote_sql_dump)
|
@@ -24,12 +25,33 @@ def create_update_task(from_db, to_db)
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def name(env, target, counts)
|
29
|
+
counts[env] > 1 ? "#{env}:#{target}" : env
|
30
|
+
end
|
31
|
+
|
27
32
|
def create_update_tasks(db_configs)
|
33
|
+
counts = {}
|
34
|
+
db_configs.each do |config|
|
35
|
+
counts[config.first] = 0 unless counts[config.first]
|
36
|
+
counts[config.first] += 1
|
37
|
+
end
|
38
|
+
|
28
39
|
namespace :update do
|
29
40
|
db_configs.each do |from_db|
|
30
41
|
db_configs.each do |to_db|
|
31
|
-
next if from_db == to_db
|
32
|
-
|
42
|
+
next if from_db == to_db # no need to sync a database to itself
|
43
|
+
next if from_db.last != to_db.last # sync only matching target names
|
44
|
+
from = {
|
45
|
+
environment: from_db.first,
|
46
|
+
target: from_db.last,
|
47
|
+
name: name(from_db.first, from_db.last, counts)
|
48
|
+
}
|
49
|
+
to = {
|
50
|
+
environment: to_db.first,
|
51
|
+
target: to_db.last,
|
52
|
+
name: name(to_db.first, to_db.last, counts)
|
53
|
+
}
|
54
|
+
create_update_task(from, to)
|
33
55
|
end
|
34
56
|
end
|
35
57
|
end
|
data/lib/fulmar/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulmar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Siegl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|