active_tools 0.0.25 → 0.0.26

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: f2dcc05c30ee3fbc858b68fe489c4c217a85231a
4
- data.tar.gz: f182069e6df8604eeebc27f515d36a1f26ad4950
3
+ metadata.gz: 3824ea1af640825d0cc6f8a5d8aef6ca37f880ac
4
+ data.tar.gz: 89ec8e6abf1a389f3f61ac45c9fe5afca098a8b9
5
5
  SHA512:
6
- metadata.gz: 2140f2895ff1324f6c118434fd541ab54815df4986284661dc17803829f3e1eeb6a8b38f15847de876837e1f213147f15a42830b8f9c0fe6afcff00a58eb6fc7
7
- data.tar.gz: 3c01d62b41c620ac591e823905d789851b408e95ae76eb70d815d4e40a9a7baa463b03ef012c868640fac5bb56b236c394cb93071292c7f54e12c26854b04fe0
6
+ metadata.gz: b3b9874adda78011d372dea14cceba9594e13c9f4782a17853e7a0e32b78a80c46a2e9e86138707e29cf1aa9453ce46bb70ca893b0776b240e3c25860c0a26c9
7
+ data.tar.gz: cbe909d4a4fc9cfdce1d21aacbcccc271c1dd91016f384b819d5381af66a2cb93cc15f83f6a8a5a016a335250882a5efb331de24de7eac8cef9709835cb7a6b7
@@ -71,6 +71,7 @@ module ActiveTools
71
71
 
72
72
  def try_update
73
73
  if updateable_backup?
74
+ warn "Adaptive updating: <#{@backup.class.name}: #{@backup.class.primary_key}: #{@backup.send(@backup.class.primary_key)}>"
74
75
  begin
75
76
  @backup.update(template_attributes)
76
77
  rescue ::ActiveRecord::StaleObjectError
@@ -80,12 +81,14 @@ module ActiveTools
80
81
  @backup.reload
81
82
  try_update
82
83
  end
83
- self.target = @backup
84
+ restore_backup!
85
+ true
84
86
  end
85
87
  end
86
88
 
87
- def try_commit_existed
89
+ def try_commit_existed
88
90
  if @template.present? && @uniq_by.any? && (existed = detect_existed)
91
+ warn "Adaptive fetching existed <#{existed.class.name}: #{existed.class.primary_key}: #{existed.send(existed.class.primary_key)}>"
89
92
  self.target = existed
90
93
  if updateable_backup?
91
94
  @backup.mark_for_destruction
@@ -94,8 +97,9 @@ module ActiveTools
94
97
  end
95
98
  end
96
99
 
97
- def try_destroy_backup
100
+ def try_destroy_backup
98
101
  if destroyable_backup?
102
+ warn "Adaptive destroying backed up: <#{@backup.class.name}: #{@backup.class.primary_key}: #{@backup.send(@backup.class.primary_key)}>"
99
103
  begin
100
104
  @backup.destroy
101
105
  rescue ::ActiveRecord::StaleObjectError
@@ -108,8 +112,9 @@ module ActiveTools
108
112
  end
109
113
  end
110
114
 
111
- def try_destroy_target
115
+ def try_destroy_target
112
116
  if destroyable_target?
117
+ warn "Adaptive destroying target: <#{target.class.name}: #{target.class.primary_key}: #{target.send(target.class.primary_key)}>"
113
118
  begin
114
119
  target.destroy
115
120
  rescue ::ActiveRecord::StaleObjectError
@@ -1,3 +1,3 @@
1
1
  module ActiveTools
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valery Kvon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails