maintenance_tasks 1.1.1 → 1.1.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7d654d153de66a16dc940efdafe3c15e0f151383829b1cb331a67a86c6532c
|
4
|
+
data.tar.gz: 375fde5efda30bd597d9609f08ee2edada28d336e97991b05e9357f5edca17cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec5d5108af6fecdcfa4a8fd7a37640f48f3e5dc39c918a8a0bf52bd9792474f465cfc495491caad22337da8bba6446726e0f58114e1b22a44e2b30a10168d3c
|
7
|
+
data.tar.gz: 07c9fc9e6e5779fe9180081c5b8306acb43ab6d30dd500b2c2184ab24e8e901e1221f88c29294eaba51cf38f81e054f4ce2575fcd02f897d22238f0fe04c08df
|
@@ -41,6 +41,11 @@ module MaintenanceTasks
|
|
41
41
|
|
42
42
|
scope :active, -> { where(status: ACTIVE_STATUSES) }
|
43
43
|
|
44
|
+
# Ensure ActiveStorage is in use before preloading the attachments
|
45
|
+
scope :with_attached_csv, -> do
|
46
|
+
with_attached_csv_file if ActiveStorage::Attachment.table_exists?
|
47
|
+
end
|
48
|
+
|
44
49
|
validates_with RunStatusValidator, on: :update
|
45
50
|
|
46
51
|
has_one_attached :csv_file
|
@@ -188,11 +193,21 @@ module MaintenanceTasks
|
|
188
193
|
def csv_attachment_presence
|
189
194
|
if Task.named(task_name) < CsvCollection && !csv_file.attached?
|
190
195
|
errors.add(:csv_file, 'must be attached to CSV Task.')
|
191
|
-
elsif !(Task.named(task_name) < CsvCollection) && csv_file.
|
196
|
+
elsif !(Task.named(task_name) < CsvCollection) && csv_file.present?
|
192
197
|
errors.add(:csv_file, 'should not be attached to non-CSV Task.')
|
193
198
|
end
|
194
199
|
rescue Task::NotFoundError
|
195
200
|
nil
|
196
201
|
end
|
202
|
+
|
203
|
+
# Fetches the attached ActiveStorage CSV file for the run. Checks first
|
204
|
+
# whether the ActiveStorage::Attachment table exists so that we are
|
205
|
+
# compatible with apps that are not using ActiveStorage.
|
206
|
+
#
|
207
|
+
# @return [ActiveStorage::Attached::One] the attached CSV file
|
208
|
+
def csv_file
|
209
|
+
return unless ActiveStorage::Attachment.table_exists?
|
210
|
+
super
|
211
|
+
end
|
197
212
|
end
|
198
213
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maintenance_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -151,10 +151,10 @@ files:
|
|
151
151
|
homepage: https://github.com/Shopify/maintenance_tasks
|
152
152
|
licenses: []
|
153
153
|
metadata:
|
154
|
-
source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v1.1.
|
154
|
+
source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v1.1.2
|
155
155
|
allowed_push_host: https://rubygems.org
|
156
156
|
post_install_message: |-
|
157
|
-
Thank you for installing Maintenance Tasks 1.1.
|
157
|
+
Thank you for installing Maintenance Tasks 1.1.2. To complete, please run:
|
158
158
|
|
159
159
|
rails generate maintenance_tasks:install
|
160
160
|
rdoc_options: []
|