flexite 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/flexite/diffs_controller.rb +1 -1
- data/app/services/flexite/diff/apply_service.rb +6 -1
- data/app/services/flexite/diff/async_show_service.rb +4 -4
- data/app/services/flexite/diff/push_service.rb +1 -1
- data/app/services/flexite/diff/sync_show_service.rb +4 -3
- data/lib/flexite/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +2933 -0
- metadata +1 -3
- data/test/dummy/tmp/pids/server.pid +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93abeafc1fb15b62e131eead8ee95aa2c947ae1f
|
4
|
+
data.tar.gz: b9d52aa9cf10452949e3c0b79f9313ced090e2a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1603f09285642a4c41a5bacc996374fcf88eaa74a81b9aeaabd995623c536fd3794eccfc4d5a9c5639e61b4cc0ec412f291eb7ead7b6977006b34ffbb739052
|
7
|
+
data.tar.gz: de6215c0a7c55e1ca1dabb5472528d3e7711e64b5c1f2b606a9e1e3ea8782830f5dde0248a38390869fbfa1f4c46588f95654d805349393ff1f9f69c778d2bb7
|
@@ -8,7 +8,7 @@ module Flexite
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def apply
|
11
|
-
render json: ServiceFactory.instance.get(:apply_diff, params[:stage], params[:checksum]).call
|
11
|
+
render json: ServiceFactory.instance.get(:apply_diff, params[:token], params[:stage], params[:checksum]).call
|
12
12
|
end
|
13
13
|
|
14
14
|
def push
|
@@ -1,12 +1,17 @@
|
|
1
1
|
module Flexite
|
2
2
|
class Diff
|
3
3
|
class ApplyService
|
4
|
-
def initialize(stage, checksum)
|
4
|
+
def initialize(token, stage, checksum)
|
5
5
|
@stage = stage
|
6
|
+
@token = Token.new(token)
|
6
7
|
@checksum = checksum
|
7
8
|
end
|
8
9
|
|
9
10
|
def call
|
11
|
+
if @token.invalid?
|
12
|
+
return { error: 'Invalid token', code: 401 }
|
13
|
+
end
|
14
|
+
|
10
15
|
diffs = Flexite.cache.read("#{Flexite.state_digest}-#{@checksum}-#{@stage}-diffs")
|
11
16
|
|
12
17
|
if diffs.blank?
|
@@ -9,11 +9,11 @@ module Flexite
|
|
9
9
|
end
|
10
10
|
|
11
11
|
expire_old
|
12
|
-
nodes =
|
13
|
-
checksum = Digest::MD5.hexdigest(nodes)
|
12
|
+
nodes = Config.t_nodes
|
13
|
+
checksum = Digest::MD5.hexdigest(nodes.to_json)
|
14
14
|
Flexite.cache.write("#{Flexite.state_digest}-#{@stage}-diff-checksum", checksum)
|
15
|
-
@remote_diff.check({ token:
|
16
|
-
ActionService::Result.new(flash: { type: :warning, message: "You will be notified via #{Flexite.config.async_diff_handler
|
15
|
+
@remote_diff.check({ token: Flexite.config.migration_token, tree: nodes, stage: Flexite.config.stagename, checksum: checksum })
|
16
|
+
ActionService::Result.new(flash: { type: :warning, message: "You will be notified via #{Flexite.config.async_diff_handler&.notifier} when difference check will be completed" },
|
17
17
|
endpoint: { partial: 'flexite/shared/show_flash' })
|
18
18
|
end
|
19
19
|
end
|
@@ -17,7 +17,7 @@ module Flexite
|
|
17
17
|
return ActionService::Result.new(flash: { type: :warning, message: 'Settings were changed and difference should be revalidated' })
|
18
18
|
end
|
19
19
|
|
20
|
-
response = @remote_diff.apply({ stage: Flexite.config.stagename, checksum: checksum })
|
20
|
+
response = @remote_diff.apply({ token: Flexite.config.migration_token, stage: Flexite.config.stagename, checksum: checksum })
|
21
21
|
|
22
22
|
if response[:error].blank?
|
23
23
|
ActionService::Result.new(flash: { type: :success, message: response[:message] })
|
@@ -12,10 +12,10 @@ module Flexite
|
|
12
12
|
|
13
13
|
if response.nil?
|
14
14
|
expire_old
|
15
|
-
nodes = Config.t_nodes
|
16
|
-
checksum = Digest::MD5.hexdigest(nodes)
|
15
|
+
nodes = Config.t_nodes
|
16
|
+
checksum = Digest::MD5.hexdigest(nodes.to_json)
|
17
17
|
Flexite.cache.write("#{@state_digest}-#{@stage}-diff-checksum", checksum)
|
18
|
-
response = @remote_diff.check({ token: Flexite.config.migration_token, tree:
|
18
|
+
response = @remote_diff.check({ token: Flexite.config.migration_token, tree: nodes, stage: Flexite.config.stagename, checksum: checksum })
|
19
19
|
Flexite.cache.write("#{@state_digest}-#{@stage}-show-diff", response)
|
20
20
|
end
|
21
21
|
|
@@ -31,6 +31,7 @@ module Flexite
|
|
31
31
|
|
32
32
|
def result(response)
|
33
33
|
if response[:error].present?
|
34
|
+
expire_old
|
34
35
|
ActionService::Result.new(success: false, flash: { type: :danger, message: response[:error] }, endpoint: { partial: 'flexite/shared/show_flash' })
|
35
36
|
else
|
36
37
|
ActionService::Result.new(data: response[:diffs], endpoint: { action: :sync_show })
|
data/lib/flexite/version.rb
CHANGED
Binary file
|