culturecode_stagehand 0.6.0 → 0.6.1

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: 5e91dd277b783c94d24bf509ad622a80808ddda5
4
- data.tar.gz: ae306ca3b38465518165b77b33ba4b854c7e4fa9
3
+ metadata.gz: f7cfa0cf1edbaaa76472515b1b86e4c103b8aacf
4
+ data.tar.gz: aaf2c9b7a696a688a6a8759963fcb3a0d2f94691
5
5
  SHA512:
6
- metadata.gz: 5b09a31d1d7bcae5a7b8bccc035b5a98ea3471a25d6693eac1920de169b4ad10aaf05028efe7a1e750c95aa3fc9380401288c720c1c5a82a58ef3f7cfd6ae0a2
7
- data.tar.gz: 638ca26673979e847d72e89510d71fd4ee4cc979a7f3ae13c24efa6c29a587b7baf423f9a5e743741c650ff621986bcea26ce4e52017cd1271fa3169ee79a41c
6
+ metadata.gz: 8529f24f971523eabab56a7a65d98305710af009560eb25ece7723b0b810a71c285214a3797a664651aee7fc064feb00a251dd41f4754be773104bb24aac4703
7
+ data.tar.gz: 18b388a57b53be01172c87e048898c5541bfd831a3bdce61a5b4114b350a9a8d086fe2975275d49804b141f67119c4a301ed3880e87c522daae16a258e9f5a22
@@ -15,9 +15,7 @@ module Stagehand
15
15
 
16
16
  # Syncs the given record and all affected records to the production database
17
17
  def sync_record(record)
18
- record.run_callbacks :sync do
19
- Stagehand::Staging::Synchronizer.sync_record(record)
20
- end
18
+ Stagehand::Staging::Synchronizer.sync_record(record)
21
19
  end
22
20
  end
23
21
  end
@@ -108,17 +108,20 @@ module Stagehand
108
108
  end
109
109
 
110
110
  def sync_entries(entries)
111
- return 0 if Configuration.single_connection? # Avoid deadlocking if the databases are the same
112
111
  raise SchemaMismatch unless schemas_match?
113
112
 
114
113
  entries = Array.wrap(entries)
115
114
 
116
115
  entries.each do |entry|
117
- Rails.logger.info "Synchronizing #{entry.table_name} #{entry.record_id}" if entry.content_operation?
118
- if entry.delete_operation?
119
- Stagehand::Production.delete(entry)
120
- elsif entry.save_operation?
121
- Stagehand::Production.save(entry)
116
+ run_sync_callbacks(entry) do
117
+ Rails.logger.info "Synchronizing #{entry.table_name} #{entry.record_id}" if entry.content_operation?
118
+ if Configuration.single_connection?
119
+ next # Avoid deadlocking if the databases are the same
120
+ elsif entry.delete_operation?
121
+ Stagehand::Production.delete(entry)
122
+ elsif entry.save_operation?
123
+ Stagehand::Production.save(entry)
124
+ end
122
125
  end
123
126
  end
124
127
 
@@ -135,6 +138,10 @@ module Stagehand
135
138
 
136
139
  return schemas_match
137
140
  end
141
+
142
+ def run_sync_callbacks(entry, &block)
143
+ entry.record.run_callbacks(:sync, &block) if entry.record
144
+ end
138
145
  end
139
146
  end
140
147
 
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: culturecode_stagehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Jakobsen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-25 00:00:00.000000000 Z
12
+ date: 2016-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.4.5.1
111
+ rubygems_version: 2.4.6
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Simplify the management of a sandbox database that can sync content to a