dis 0.9.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d9ec3b8500386221e40c1ea04e0b38e0d416f6d
4
- data.tar.gz: 1b7ae3618b80c6d95b27a5ba832292c3cd035a45
3
+ metadata.gz: 8e3efb0078d31c5dad69adb12179ac307e07e44b
4
+ data.tar.gz: 568d166000b658f28b4456d1210117164b7d66d2
5
5
  SHA512:
6
- metadata.gz: 186c74e43812f0e71ddfc36856106decb829607854bd819d5a51467cfeb3e19811fabd9bd755975bfdc50ee11971e96f19a847612da6e0aaf456078a453916fe
7
- data.tar.gz: 54bc48092d38eca8edb24d727b5295c56ea9a7d31aed80432ac8ea4a9316eb14162d2333797c76ae8b280a5d55e5fcb4ab27c7652e221d2de1b486e6385b21cf
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.1+ and Ruby 1.9.3+.
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/github/elektronaut/dis)
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
@@ -1,7 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require "digest/sha1"
4
- require "fog"
4
+ require "fog/core"
5
+ require "fog/local/storage"
5
6
  require "active_job"
6
7
  require "dis/errors"
7
8
  require "dis/jobs"
@@ -6,7 +6,7 @@ module Dis
6
6
  #
7
7
  # Handles delayed deletion of objects.
8
8
  #
9
- # Dis::Jobs::Delete.enqueue("documents", hash)
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
@@ -6,7 +6,7 @@ module Dis
6
6
  #
7
7
  # Handles delayed storage of objects.
8
8
  #
9
- # Dis::Jobs::Store.enqueue("documents", hash)
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 || self.table_name
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.enqueue(type, hash)
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.enqueue(type, hash)
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,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Dis
4
- VERSION = "0.9.0"
4
+ VERSION = "1.0.2"
5
5
  end
@@ -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.9.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-09-23 00:00:00.000000000 Z
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.1.0
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.1.0
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.22.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.22.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