card-mod-carrierwave 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/abstract/attachment/01_storage_type.rb +43 -32
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba199fce5967f2189a0557f6bdec4eb84bc8f13afc275686e08cb3deba4c69cb
|
4
|
+
data.tar.gz: dd4765366027d1bca28d7f9fc648e143d5da2d2422eff2df91e1f055db34e922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ac1f9e1200c825c9604ad8edead3010e552e20ae64cabf1e4752f2e0a5043bdaaaca6f2dac446c0b30ce41f28095c646aec6e8a0e88eba565bf89b5a82da747
|
7
|
+
data.tar.gz: 354e99adfc7e7d3b6d96d2d65880d5c607a8560439b7b6affb8c11ffb57c9a0c0de63941d4aed3e6c0b9cdaf50461dc24d9a25be93fab6ce94f72c3feef11916
|
@@ -46,24 +46,59 @@ def storage_type
|
|
46
46
|
@storage_type ||= new_card? ? storage_type_from_config : storage_type_from_content
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
|
49
|
+
def storage_changed?
|
50
|
+
(storage_type != current.storage_type) ||
|
51
|
+
(bucket != current.bucket) ||
|
52
|
+
(mod != current.mod)
|
51
53
|
end
|
52
54
|
|
53
|
-
def
|
54
|
-
storage_type.
|
55
|
-
|
55
|
+
def known_storage_type?
|
56
|
+
storage_type.in? CarrierWave::FileCardUploader::STORAGE_TYPES
|
57
|
+
end
|
58
|
+
|
59
|
+
def unknown_storage_type
|
60
|
+
t :carrierwave_unknown_storage_type, new_storage_type: storage_type
|
61
|
+
end
|
62
|
+
|
63
|
+
def file_updated_at
|
64
|
+
if coded?
|
65
|
+
File.mtime file.path
|
66
|
+
else
|
67
|
+
updated_at
|
56
68
|
end
|
69
|
+
rescue Errno::ENOENT # no file at path
|
70
|
+
nil
|
57
71
|
end
|
58
72
|
|
59
|
-
|
60
|
-
|
73
|
+
private
|
74
|
+
|
75
|
+
def storage_type_from_config
|
76
|
+
storage = Cardio.config.file_storage
|
77
|
+
# valid_storage_type(storage) && configured_storage_type(storage) && storage
|
78
|
+
valid_storage_type(storage) && storage
|
61
79
|
end
|
62
80
|
|
63
|
-
|
81
|
+
# FIXME: storage type should really be validated at load time:
|
82
|
+
|
83
|
+
def valid_storage_type storage_type
|
84
|
+
return true if storage_type.in? CarrierWave::FileCardUploader::STORAGE_TYPES
|
85
|
+
|
64
86
|
raise Card::Error, t(:carrierwave_error_invalid_storage_type, type: type)
|
65
87
|
end
|
66
88
|
|
89
|
+
# TODO: finish this idea:
|
90
|
+
# def configured_storage_type storage_type
|
91
|
+
# case storage_type
|
92
|
+
# when :local
|
93
|
+
# # require existent files directory with write permissions
|
94
|
+
# when :cloud
|
95
|
+
# unless Cardio.config.deck_host
|
96
|
+
# raise Card::Error, t(:carrierwave_error_host_required)
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
# storage_type
|
100
|
+
# end
|
101
|
+
|
67
102
|
def storage_type_from_content
|
68
103
|
@storage_type_from_content ||=
|
69
104
|
case content
|
@@ -79,27 +114,3 @@ def storage_type_from_content
|
|
79
114
|
end
|
80
115
|
end
|
81
116
|
end
|
82
|
-
|
83
|
-
def storage_changed?
|
84
|
-
(storage_type != current.storage_type) ||
|
85
|
-
(bucket != current.bucket) ||
|
86
|
-
(mod != current.mod)
|
87
|
-
end
|
88
|
-
|
89
|
-
def known_storage_type?
|
90
|
-
storage_type.in? CarrierWave::FileCardUploader::STORAGE_TYPES
|
91
|
-
end
|
92
|
-
|
93
|
-
def unknown_storage_type
|
94
|
-
t :carrierwave_unknown_storage_type, new_storage_type: storage_type
|
95
|
-
end
|
96
|
-
|
97
|
-
def file_updated_at
|
98
|
-
if coded?
|
99
|
-
File.mtime file.path
|
100
|
-
else
|
101
|
-
updated_at
|
102
|
-
end
|
103
|
-
rescue Errno::ENOENT # no file at path
|
104
|
-
nil
|
105
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-carrierwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-01-
|
13
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.104.
|
21
|
+
version: 1.104.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.104.
|
28
|
+
version: 1.104.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: carrierwave
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,28 +60,28 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.14.
|
63
|
+
version: 0.14.2
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.14.
|
70
|
+
version: 0.14.2
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: card-mod-permissions
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.14.
|
77
|
+
version: 0.14.2
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.14.
|
84
|
+
version: 0.14.2
|
85
85
|
description: ''
|
86
86
|
email:
|
87
87
|
- info@decko.org
|