culturecode_stagehand 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e34f8b1144de550fdbf2d4cf1395b1ac0596d6a
4
- data.tar.gz: 49ce2b899b0a202e7dae920ee831d7b0f43502a0
3
+ metadata.gz: 1e0d71aea5e44ca70fad78270ed8af32b1fc6398
4
+ data.tar.gz: 9292fede12b2a78bce1add811e39177405235b36
5
5
  SHA512:
6
- metadata.gz: 4b5f80d47ab450ce86ff6a0d4e0e31c517486a7dd67a2cda007e2da64631f90d4e30113ecd2462a212716cbb992bfc7882de830bc239006b0a94afd7aaba64fc
7
- data.tar.gz: a045c77ac6cdb29ff73c86f789bc0dafd43722c056911259af48351ee8d14f80f1a35c800af935349d2c51733efcca348e9643e626a1785b0177141a49e0fd3c
6
+ metadata.gz: 105bd37363ad900027f4375c90918b22805c107493f4bbdbf5c8428c6d42d83415c82ab7a8cfb1889f7dab49a741f474317c959ba164018aab5b1391ea442df4
7
+ data.tar.gz: 1f44eea4a58a90b0eed14b1434bc967c4329646ec03e81765653e53e1ae1591074e4071d5ed4ab7ec4f5c4868cc019e5e3722f1afd8c2e024a85a06b51515008
@@ -0,0 +1,28 @@
1
+ ActiveRecord::Base.class_eval do
2
+ # SYNC CALLBACKS
3
+ define_callbacks :sync
4
+
5
+ def self.before_sync(method, options = {})
6
+ set_callback :sync, :before, method, options
7
+ end
8
+
9
+ def self.after_sync(method, options = {})
10
+ set_callback :sync, :after, method, options
11
+ end
12
+
13
+ # SYNC STATUS
14
+ def self.inherited(subclass)
15
+ super
16
+
17
+ subclass.class_eval do
18
+ has_many :stagehand_commit_entries,
19
+ lambda { where(:stagehand_commit_entries => {:table_name => subclass.table_name}) },
20
+ :class_name => Stagehand::Staging::CommitEntry,
21
+ :foreign_key => :record_id
22
+
23
+ def stagehand_synced?
24
+ stagehand_commit_entries.blank?
25
+ end
26
+ end
27
+ end
28
+ end
@@ -13,6 +13,7 @@ module Stagehand
13
13
  require "stagehand/key"
14
14
  require "stagehand/database"
15
15
  require "stagehand/controller_extensions"
16
+ require "stagehand/active_record_extensions"
16
17
  require "stagehand/staging"
17
18
  require "stagehand/production"
18
19
  require "stagehand/schema"
@@ -15,7 +15,9 @@ 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
- Stagehand::Staging::Synchronizer.sync_record(record)
18
+ record.run_callbacks :sync do
19
+ Stagehand::Staging::Synchronizer.sync_record(record)
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
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.4.1
4
+ version: 0.5.0
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-20 00:00:00.000000000 Z
12
+ date: 2016-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -67,6 +67,7 @@ files:
67
67
  - Rakefile
68
68
  - lib/culturecode_stagehand.rb
69
69
  - lib/stagehand.rb
70
+ - lib/stagehand/active_record_extensions.rb
70
71
  - lib/stagehand/auditor.rb
71
72
  - lib/stagehand/cache.rb
72
73
  - lib/stagehand/configuration.rb
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.4.6
111
+ rubygems_version: 2.4.5.1
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Simplify the management of a sandbox database that can sync content to a