bridge_cache 0.0.13 → 0.0.14
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec85e8d9190a1f04068b83e61e8ff1f89c62f73f
|
4
|
+
data.tar.gz: 08d8ed00a2b7780051359995510b6ab4ea9b37cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32e16bac569d101fb386d8590961564bc79dc62b130795cfa35f5fee6165aed4df01b29eeec2abab16b63a95235263714a58c75ddc5e60c74c8e193c08a614b0
|
7
|
+
data.tar.gz: 8ef8c95858d5957766f53731e2b887dc2cd7badce0232ef26533e12369c1ac7c3b0ee8d72a2a53b8036ad22e27801a1ec4a543a99be7141304db35f22c561cfb
|
@@ -7,5 +7,10 @@ module BridgeCache::Data
|
|
7
7
|
def create_from_csv_row(row)
|
8
8
|
BridgeCache::Plugins::CSVDump::dump_row(self, row)
|
9
9
|
end
|
10
|
+
|
11
|
+
def cleanup(row_ids)
|
12
|
+
# Implement this method in your model if you want to do any sort of post creation cleanup.
|
13
|
+
# See tagging.rb for an example.
|
14
|
+
end
|
10
15
|
end
|
11
16
|
end
|
@@ -10,9 +10,14 @@ module BridgeCache::Jobs
|
|
10
10
|
remote_data.store_file(path)
|
11
11
|
import = BridgeBlueprint::DataDump.new(path)
|
12
12
|
models.each do |model|
|
13
|
+
row_ids = []
|
14
|
+
|
13
15
|
import.each_row(model.pluralize) do |row|
|
14
16
|
BridgeCache::Jobs::ImportRow.set(queue: self.queue_name).perform_later(model, row.to_h)
|
17
|
+
row_ids << row['id'].to_i
|
15
18
|
end
|
19
|
+
|
20
|
+
BridgeCache::Jobs::CleanupJob.set(queue: self.queue_name).perform_later(model, row_ids)
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
@@ -5,5 +5,8 @@ module BridgeCache
|
|
5
5
|
belongs_to :tag, foreign_key: :tag_id, primary_key: :bridge_id, class_name: 'BridgeCache::Tag', optional: true
|
6
6
|
belongs_to :user, foreign_key: :tagger_id, primary_key: :bridge_id, class_name: 'BridgeCache::User', optional: true
|
7
7
|
|
8
|
+
def self.cleanup(current_row_ids)
|
9
|
+
BridgeCache::Tagging.where.not(bridge_id: current_row_ids).destroy_all
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
data/lib/bridge_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridge_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jshaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- app/controllers/bridge_cache/application_controller.rb
|
180
180
|
- app/helpers/bridge_cache/application_helper.rb
|
181
181
|
- app/lib/bridge_cache/data/bridge_model.rb
|
182
|
+
- app/lib/bridge_cache/jobs/cleanup_job.rb
|
182
183
|
- app/lib/bridge_cache/jobs/import_check.rb
|
183
184
|
- app/lib/bridge_cache/jobs/import_data.rb
|
184
185
|
- app/lib/bridge_cache/jobs/import_row.rb
|