culturecode_stagehand 0.7.14 → 0.7.16
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/stagehand/staging/commit.rb +9 -5
- data/lib/stagehand/staging/commit_entry.rb +7 -2
- data/lib/stagehand/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: 38286b5f9333c0db58872b75ebb6bbded9cfa4da
|
|
4
|
+
data.tar.gz: 26f901f9f273e6622a866f92da44c7a8f65e8b9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd4a38e8b374c151d42818b77b7403f96917c1730330dd94b767fea1e38aa3d8ff74d1804fbe84c22e5d87cd9eafc0fd65a3e337d19de325cb0fb8a8664c3789
|
|
7
|
+
data.tar.gz: 100c6686c5cdac790b96c60c13f1c56db9814a839f39bc196b5d3da3a53887caff9f559b2f5ca2db054e4031a0fdfdbe433f56e99664c6c7d887b3d03728115a
|
|
@@ -7,7 +7,7 @@ module Stagehand
|
|
|
7
7
|
|
|
8
8
|
def self.capture(subject_record = nil, &block)
|
|
9
9
|
start_operation = start_commit(subject_record)
|
|
10
|
-
block.call
|
|
10
|
+
block.call(start_operation)
|
|
11
11
|
return end_commit(start_operation)
|
|
12
12
|
rescue => e
|
|
13
13
|
end_commit(start_operation)
|
|
@@ -32,12 +32,12 @@ module Stagehand
|
|
|
32
32
|
def self.start_commit(subject_record)
|
|
33
33
|
start_operation = CommitEntry.start_operations.new
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
# Make it easy to set the subject for the duration of the commit block
|
|
36
|
+
def start_operation.subject=(record)
|
|
37
|
+
update_attributes!(:record_id => record.try(:id), :table_name => record.class.try(:table_name))
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
start_operation.
|
|
40
|
+
start_operation.subject = subject_record
|
|
41
41
|
|
|
42
42
|
return start_operation.reload # Reload to ensure session is set
|
|
43
43
|
end
|
|
@@ -91,6 +91,10 @@ module Stagehand
|
|
|
91
91
|
def entries
|
|
92
92
|
CommitEntry.where(:id => @start_id..@end_id).where(:commit_id => id)
|
|
93
93
|
end
|
|
94
|
+
|
|
95
|
+
def subject
|
|
96
|
+
entries.sort_by(&:id).first.record
|
|
97
|
+
end
|
|
94
98
|
end
|
|
95
99
|
end
|
|
96
100
|
|
|
@@ -70,7 +70,7 @@ module Stagehand
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def record
|
|
73
|
-
@record ||= delete_operation? ? build_deleted_record : record_class.find_by_id(record_id) if
|
|
73
|
+
@record ||= delete_operation? ? build_deleted_record : record_class.find_by_id(record_id) if record_id?
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def control_operation?
|
|
@@ -135,11 +135,16 @@ module Stagehand
|
|
|
135
135
|
|
|
136
136
|
def self.build_missing_model(table_name)
|
|
137
137
|
raise MissingTable, "Can't find table specified in entry: #{table_name}" unless Database.staging_connection.tables.include?(table_name)
|
|
138
|
-
|
|
138
|
+
klass = Class.new(ActiveRecord::Base) { self.table_name = table_name }
|
|
139
|
+
DummyClass.const_set(table_name.classify, klass)
|
|
139
140
|
end
|
|
140
141
|
end
|
|
141
142
|
end
|
|
142
143
|
|
|
144
|
+
# DUMMY CLASSES
|
|
145
|
+
|
|
146
|
+
module DummyClass; end
|
|
147
|
+
|
|
143
148
|
# EXCEPTIONS
|
|
144
149
|
class IndeterminateRecordClass < StandardError; end
|
|
145
150
|
class MissingTable < StandardError; end
|
data/lib/stagehand/version.rb
CHANGED
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.7.
|
|
4
|
+
version: 0.7.16
|
|
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-
|
|
12
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|