dis 0.9.0 → 1.0.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 +4 -4
- data/README.md +10 -4
- data/lib/dis.rb +2 -1
- data/lib/dis/jobs/delete.rb +2 -2
- data/lib/dis/jobs/store.rb +2 -2
- data/lib/dis/model.rb +6 -1
- data/lib/dis/model/class_methods.rb +3 -3
- data/lib/dis/storage.rb +3 -3
- data/lib/dis/version.rb +1 -1
- data/lib/rails/generators/dis/install/templates/initializer.rb +4 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e3efb0078d31c5dad69adb12179ac307e07e44b
|
4
|
+
data.tar.gz: 568d166000b658f28b4456d1210117164b7d66d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184a32e5b464fcc2a4f8598bf4773a2dd7bfc4ec950ce8624764a72ba64d67cdc0bec3f0c4cb430dc3b224cac141db56cc1f40951d8462782c53f83fc88a5024
|
7
|
+
data.tar.gz: 4f12596ecd11fbb0fa52af015021b90607d9fda21c2f6aada34057c6ea8b3e6f6222f29afde2d2e3825c88366b45a88bf2c45a75dbb5391d6713fc060285c962
|
data/README.md
CHANGED
@@ -19,11 +19,11 @@ It does not do any processing. The idea is to provide a simple foundation
|
|
19
19
|
other gems can build on. If you are looking to handle uploaded images,
|
20
20
|
check out [DynamicImage](https://github.com/elektronaut/dynamic_image).
|
21
21
|
|
22
|
-
Requires Rails 4.
|
22
|
+
Requires Rails 4.2+ and Ruby 1.9.3+.
|
23
23
|
|
24
24
|
## Documentation
|
25
25
|
|
26
|
-
[Documentation on RubyDoc.info](http://rdoc.info/
|
26
|
+
[Documentation on RubyDoc.info](http://rdoc.info/gems/dis)
|
27
27
|
|
28
28
|
## Installation
|
29
29
|
|
@@ -86,7 +86,13 @@ The install generator will set you up with a local storage layer on disk,
|
|
86
86
|
but this is configurable in `config/initializers/dis.rb`.
|
87
87
|
|
88
88
|
You can have as many layers as you want, any storage provider
|
89
|
-
[supported by Fog](http://fog.io/storage/) should work in theory.
|
89
|
+
[supported by Fog](http://fog.io/storage/) should work in theory. Only the
|
90
|
+
local storage is loaded by default, you'll have to manually require your provider.
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
require 'fog/aws/storage'
|
94
|
+
```
|
95
|
+
|
90
96
|
Having a local layer first is a good idea, this will provide you
|
91
97
|
with a cache on disk. Any misses will be filled from the next layer.
|
92
98
|
|
@@ -162,4 +168,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
162
168
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
163
169
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
164
170
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
165
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
171
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/dis.rb
CHANGED
data/lib/dis/jobs/delete.rb
CHANGED
@@ -6,7 +6,7 @@ module Dis
|
|
6
6
|
#
|
7
7
|
# Handles delayed deletion of objects.
|
8
8
|
#
|
9
|
-
# Dis::Jobs::Delete.
|
9
|
+
# Dis::Jobs::Delete.perform_later("documents", hash)
|
10
10
|
class Delete < ActiveJob::Base
|
11
11
|
queue_as :dis
|
12
12
|
|
@@ -15,4 +15,4 @@ module Dis
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
data/lib/dis/jobs/store.rb
CHANGED
@@ -6,7 +6,7 @@ module Dis
|
|
6
6
|
#
|
7
7
|
# Handles delayed storage of objects.
|
8
8
|
#
|
9
|
-
# Dis::Jobs::Store.
|
9
|
+
# Dis::Jobs::Store.perform_later("documents", hash)
|
10
10
|
class Store < ActiveJob::Base
|
11
11
|
queue_as :dis
|
12
12
|
|
@@ -15,4 +15,4 @@ module Dis
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
data/lib/dis/model.rb
CHANGED
@@ -155,5 +155,10 @@ module Dis
|
|
155
155
|
def dis_attribute(attribute_name)
|
156
156
|
self.class.dis_attributes[attribute_name]
|
157
157
|
end
|
158
|
+
|
159
|
+
# We don't want the data column when doing a partial write.
|
160
|
+
def keys_for_partial_write
|
161
|
+
super.reject { |a| a == "data" }
|
162
|
+
end
|
158
163
|
end
|
159
|
-
end
|
164
|
+
end
|
@@ -5,7 +5,7 @@ module Dis
|
|
5
5
|
module ClassMethods
|
6
6
|
# Returns the mapping of attribute names.
|
7
7
|
def dis_attributes
|
8
|
-
default_dis_attributes.merge(@dis_attributes
|
8
|
+
default_dis_attributes.merge(@dis_attributes ||= {})
|
9
9
|
end
|
10
10
|
|
11
11
|
# Sets the current mapping of attribute names. Use this if you want to
|
@@ -25,7 +25,7 @@ module Dis
|
|
25
25
|
# class Document < ActiveRecord::Base; end
|
26
26
|
# Document.dis_type # => "documents"
|
27
27
|
def dis_type
|
28
|
-
@dis_type
|
28
|
+
@dis_type ||= self.table_name
|
29
29
|
end
|
30
30
|
|
31
31
|
# Sets the storage type name.
|
@@ -60,4 +60,4 @@ module Dis
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/lib/dis/storage.rb
CHANGED
@@ -32,7 +32,7 @@ module Dis
|
|
32
32
|
require_writeable_layers!
|
33
33
|
hash = store_immediately!(type, file)
|
34
34
|
if layers.delayed.writeable.any?
|
35
|
-
Dis::Jobs::Store.
|
35
|
+
Dis::Jobs::Store.perform_later(type, hash)
|
36
36
|
end
|
37
37
|
hash
|
38
38
|
end
|
@@ -96,7 +96,7 @@ module Dis
|
|
96
96
|
deleted = true if layer.delete(type, hash)
|
97
97
|
end
|
98
98
|
if layers.delayed.writeable.any?
|
99
|
-
Dis::Jobs::Delete.
|
99
|
+
Dis::Jobs::Delete.perform_later(type, hash)
|
100
100
|
end
|
101
101
|
deleted
|
102
102
|
end
|
@@ -150,4 +150,4 @@ module Dis
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
153
|
-
end
|
153
|
+
end
|
data/lib/dis/version.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
3
|
# Creates a local storage layer in db/dis:
|
4
|
+
|
4
5
|
Dis::Storage.layers << Dis::Layer.new(
|
5
6
|
Fog::Storage.new({ provider: 'Local', local_root: Rails.root.join('db', 'dis') }),
|
6
7
|
path: Rails.env
|
7
8
|
)
|
8
9
|
|
9
|
-
# You can also add cloud storage
|
10
|
+
# You can also add cloud storage:
|
11
|
+
|
12
|
+
# require 'fog/aws/storage'
|
10
13
|
# Dis::Storage.layers << Dis::Layer.new(
|
11
14
|
# Fog::Storage.new({
|
12
15
|
# provider: 'AWS',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inge Jørgensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,42 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fog
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.26.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: activejob
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
40
|
+
version: 1.26.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: sqlite3
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|