culturecode_stagehand 0.11.1 → 0.12.0
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/checklist.rb +11 -6
- 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: c893dda09123a4ae10bf48b2ee8baccd9810faa3
|
|
4
|
+
data.tar.gz: e036f39b6df9eab7580afdeee075f43f6b32b621
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9946912b9989f00cd65c2de61439942d0f1bc09bc45b9e920914f01eb0cb34d21ed24add2596b3c9841ea2fb3261a84165cd46d1c8d3131d6cdfd40a9bd997df
|
|
7
|
+
data.tar.gz: d19d3a122766096414acc98c7c20ec4f3f404a214e9fe0fdf87ca449e6decb3c0b6c483392e40eec5c73528f44b5a50bdc83afcf46bb405c482732868f015887
|
|
@@ -12,13 +12,15 @@ module Stagehand
|
|
|
12
12
|
related_entries(commit.entries).collect(&:commit_id).select(&:present?).uniq
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def self.related_entries(entries)
|
|
15
|
+
def self.related_entries(entries, relation_filter = nil)
|
|
16
16
|
entries = Array.wrap(entries)
|
|
17
17
|
related_entries = []
|
|
18
18
|
|
|
19
19
|
entries_to_spider = Array.wrap(entries)
|
|
20
20
|
while entries_to_spider.present?
|
|
21
21
|
contained_matching = CommitEntry.contained.matching(entries_to_spider)
|
|
22
|
+
contained_matching = contained_matching.where(id: contained_matching.select(&relation_filter)) if relation_filter
|
|
23
|
+
|
|
22
24
|
matching_commit_entries = CommitEntry.where(:commit_id => contained_matching.select(:commit_id))
|
|
23
25
|
|
|
24
26
|
# Spider using content operations. Don't spider control operations to avoid extending the list of results unnecessarily
|
|
@@ -37,7 +39,7 @@ module Stagehand
|
|
|
37
39
|
return related_entries
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
def self.associated_records(entries)
|
|
42
|
+
def self.associated_records(entries, association_filter = nil)
|
|
41
43
|
records = preload_records(compact_entries(entries)).select(&:record).flat_map do |entry|
|
|
42
44
|
associated_associations(entry.record_class).flat_map do |association|
|
|
43
45
|
entry.record.send(association)
|
|
@@ -47,6 +49,7 @@ module Stagehand
|
|
|
47
49
|
records.uniq!
|
|
48
50
|
records.compact!
|
|
49
51
|
records.select! {|record| stagehand_class?(record.class) }
|
|
52
|
+
records.select!(&association_filter) if association_filter
|
|
50
53
|
|
|
51
54
|
return records
|
|
52
55
|
end
|
|
@@ -95,9 +98,11 @@ module Stagehand
|
|
|
95
98
|
|
|
96
99
|
public
|
|
97
100
|
|
|
98
|
-
def initialize(subject,
|
|
101
|
+
def initialize(subject, confirmation_filter: nil, association_filter: nil, relation_filter: nil)
|
|
99
102
|
@subject = subject
|
|
100
103
|
@confirmation_filter = confirmation_filter
|
|
104
|
+
@association_filter = association_filter
|
|
105
|
+
@relation_filter = relation_filter
|
|
101
106
|
affected_entries # Init the affected_entries changes can be rolled back without affecting the checklist
|
|
102
107
|
end
|
|
103
108
|
|
|
@@ -133,9 +138,9 @@ module Stagehand
|
|
|
133
138
|
|
|
134
139
|
def affected_entries
|
|
135
140
|
cache(:affected_entries) do
|
|
136
|
-
related = self.class.related_entries(@subject)
|
|
137
|
-
associated = self.class.associated_records(related)
|
|
138
|
-
associated_related = self.class.related_entries(associated)
|
|
141
|
+
related = self.class.related_entries(@subject, @relation_filter)
|
|
142
|
+
associated = self.class.associated_records(related, @association_filter)
|
|
143
|
+
associated_related = self.class.related_entries(associated, @relation_filter)
|
|
139
144
|
|
|
140
145
|
(related + associated_related).uniq
|
|
141
146
|
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.
|
|
4
|
+
version: 0.12.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-11-
|
|
12
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|