sublimate 0.1.1 → 0.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.
- data/lib/sublimate/chunked_file.rb +7 -1
- data/lib/sublimate/uploader.rb +9 -1
- metadata +3 -3
@@ -1,9 +1,15 @@
|
|
1
1
|
module Sublimate
|
2
2
|
#todo: This seems like it could just be IO objects that map to portions of a file
|
3
3
|
class ChunkedFile
|
4
|
+
def self.default_chunk_size
|
5
|
+
@default_chunk_size ||= (1024 * 1024 * 500)
|
6
|
+
end
|
7
|
+
def self.default_chunk_size=(v)
|
8
|
+
@default_chunk_size = v
|
9
|
+
end
|
4
10
|
def initialize(path, opts={})
|
5
11
|
@path = path
|
6
|
-
@chunk_size = opts[:chunk_size] ||
|
12
|
+
@chunk_size = opts[:chunk_size] || self.class.default_chunk_size
|
7
13
|
end
|
8
14
|
|
9
15
|
def each_chunk
|
data/lib/sublimate/uploader.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
module Sublimate
|
2
2
|
class Uploader
|
3
|
+
def self.multipart_min_size
|
4
|
+
@multipart_min_size ||= (1024 * 1024 * 1024 * 5) #5gb default
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.multipart_min_size=(v)
|
8
|
+
@multipart_min_size = v
|
9
|
+
end
|
10
|
+
|
3
11
|
def initialize(bucket, opts = {})
|
4
12
|
@bucket = bucket
|
5
13
|
@opts = opts
|
@@ -11,7 +19,7 @@ module Sublimate
|
|
11
19
|
size = File.size(path)
|
12
20
|
|
13
21
|
m = multi_method_name
|
14
|
-
if respond_to?(m)
|
22
|
+
if size > self.class.multipart_min_size && respond_to?(m)
|
15
23
|
chunked = ChunkedFile.new(path, :chunk_size => @opts[:multipart_chunk_size])
|
16
24
|
send(m, chunked, opts)
|
17
25
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sublimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-26 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: &
|
16
|
+
requirement: &70102134054460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70102134054460
|
25
25
|
description: Store ginormous files on S3 or the Rackspace Cloud using this gem.
|
26
26
|
email: mrkurt@gmail.com
|
27
27
|
executables: []
|