s3_multipart 0.0.9 → 0.0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +10 -4
- data/app/models/s3_multipart/upload.rb +2 -2
- data/lib/generators/s3_multipart/install_new_migrations_generator.rb +20 -0
- data/lib/generators/s3_multipart/templates/add_size_column_to_s3_multipart_uploads.rb +5 -0
- data/lib/generators/s3_multipart/templates/aws.yml +2 -1
- data/lib/generators/s3_multipart/templates/configuration_initializer.rb +1 -0
- data/lib/s3_multipart.rb +1 -0
- data/lib/s3_multipart/config.rb +10 -2
- data/lib/s3_multipart/version.rb +4 -1
- data/spec/integration/uploads_controller_spec.rb +10 -10
- metadata +4 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,12 @@ The S3 Multipart gem brings direct multipart uploading to S3 to Rails. Data is p
|
|
4
4
|
|
5
5
|
Multipart uploading allows files to be split into many chunks and uploaded in parallel or succession (or both). This can result in dramatically increased upload speeds for the client and allows for the pausing and resuming of uploads. For a more complete overview of multipart uploading as it applies to S3, see the documentation [here](http://docs.amazonwebservices.com/AmazonS3/latest/dev/mpuoverview.html). Read more about the philosophy behind the gem on the Bitcast [blog](http://blog.bitcast.io/post/43001057745/direct-multipart-uploads-to-s3-in-rails).
|
6
6
|
|
7
|
+
## What's New
|
8
|
+
|
9
|
+
**0.0.10.2** - Fixed some bugs. Modifications made to the database table used by the gem are now handled by migrations. If you are upgrading versions, run `rails g s3_multipart:install_new_migrations` followed by `rake db:migrate`. Fresh installs do not require subsequent migrations. The current version must now also be passed in to the gem's configuration function to alert you of breaking changes. This is done by setting a revision yml variable. See the section regarding the aws.yml file in the readme section below (just before "Getting Started").
|
10
|
+
|
11
|
+
**0.0.9** - File type and size validations are now specified in the upload controller. Untested support for browsers that lack the FileBlob API
|
12
|
+
|
7
13
|
## Setup
|
8
14
|
|
9
15
|
First, assuming that you already have an S3 bucket set up, you will need to paste the following into your CORS configuration file, located under the permissions tab in your S3 console.
|
@@ -79,13 +85,14 @@ $(function() {
|
|
79
85
|
|
80
86
|
This piece of code does some configuration and provides various callbacks that you can hook into. It will be discussed further at the end of the Getting Started guide below.
|
81
87
|
|
82
|
-
Finally, edit the aws.yml that was created in your config folder with the correct credentials for each environment.
|
88
|
+
Finally, edit the aws.yml that was created in your config folder with the correct credentials for each environment. Set the revision number to the current version number. If breaking changes are made to the gem in a later version, then you will be notified when the two versions do not match in the log.
|
83
89
|
|
84
90
|
```yaml
|
85
91
|
development:
|
86
92
|
access_key_id: ""
|
87
93
|
secret_access_key: ""
|
88
94
|
bucket: ""
|
95
|
+
revision: "#.#.#"
|
89
96
|
```
|
90
97
|
|
91
98
|
## Getting Started
|
@@ -174,6 +181,7 @@ S3Multipart.configure do |config|
|
|
174
181
|
config.bucket_name = ''
|
175
182
|
config.s3_access_key = ''
|
176
183
|
config.s3_secret_key = ''
|
184
|
+
config.revision = S3Multipart::Version
|
177
185
|
end
|
178
186
|
```
|
179
187
|
|
@@ -194,6 +202,7 @@ S3Multipart.configure do |config|
|
|
194
202
|
config.bucket_name = ''
|
195
203
|
config.s3_access_key = ''
|
196
204
|
config.s3_secret_key = ''
|
205
|
+
config.revision = S3Multipart::Version
|
197
206
|
end
|
198
207
|
|
199
208
|
run Combustion::Application
|
@@ -213,9 +222,6 @@ S3_Multipart is very much a work in progress. If you squash a bug, make enhancem
|
|
213
222
|
|
214
223
|
The library is working on the latest version of IE, Firefox, Safari, and Chrome. Tests for over 100 browsers are currently being conducted.
|
215
224
|
|
216
|
-
## What's New
|
217
|
-
|
218
|
-
**0.0.9** - File type and size validations are now specified in the upload controller. Untested support for browsers that lack the FileBlob API
|
219
225
|
|
220
226
|
## To Do
|
221
227
|
|
@@ -15,9 +15,9 @@ module S3Multipart
|
|
15
15
|
|
16
16
|
case stage
|
17
17
|
when :begin
|
18
|
-
controller.on_begin_callback.call(self, session)
|
18
|
+
controller.on_begin_callback.call(self, session) if controller.on_begin_callback
|
19
19
|
when :complete
|
20
|
-
controller.on_complete_callback.call(self, session)
|
20
|
+
controller.on_complete_callback.call(self, session) if controller.on_begin_callback
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module S3Multipart
|
4
|
+
class InstallNewMigrationsGenerator < Rails::Generators::Base
|
5
|
+
desc "Generates the migrations necessary when updating the gem to the latest version"
|
6
|
+
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
|
9
|
+
def create_latest_migrations
|
10
|
+
copy_file "add_size_column_to_s3_multipart_uploads.rb", "db/migrate/#{migration_time}_add_size_to_s3_multipart_uploads.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def migration_time
|
16
|
+
Time.now.strftime("%Y%m%d%H%M%S")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/s3_multipart.rb
CHANGED
data/lib/s3_multipart/config.rb
CHANGED
@@ -3,10 +3,18 @@ require 'singleton'
|
|
3
3
|
module S3Multipart
|
4
4
|
class Config
|
5
5
|
include Singleton
|
6
|
-
attr_accessor :s3_access_key, :s3_secret_key, :bucket_name
|
6
|
+
attr_accessor :s3_access_key, :s3_secret_key, :bucket_name, :revision
|
7
7
|
|
8
8
|
def self.configure(block)
|
9
9
|
block.call(self.instance)
|
10
|
+
check_for_breaking_changes
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.check_for_breaking_changes
|
14
|
+
version = S3Multipart::VERSION
|
15
|
+
if self.instance.revision != version
|
16
|
+
raise ArgumentError, "Breaking changes were made to the S3_Multipart gem:\n #{BREAKING_CHANGES[version.to_sym]}\n See the Readme for additional information."
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
12
|
-
end
|
20
|
+
end
|
data/lib/s3_multipart/version.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
1
|
module S3Multipart
|
2
|
-
VERSION = "0.0.
|
2
|
+
VERSION = "0.0.10.2"
|
3
|
+
BREAKING_CHANGES = {
|
4
|
+
:"0.0.10.2" => 'Modifications made to the database table used by the gem are now handled by migrations. If you are upgrading versions, run `rails g s3_multipart:install_new_migrations` followed by `rake db:migrate`. Fresh installs do not require subsequent migrations. The current version must now also be passed in to the gem\'s configuration function to alert you of breaking changes. This is done by setting a revision yml variable. See the section regarding the aws.yml file in the readme section below (just before "Getting Started").'
|
5
|
+
}
|
3
6
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'spec_helper.rb'
|
2
|
-
require "digest/sha1"
|
3
|
-
|
4
|
-
describe "Uploads controller" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
1
|
+
# require 'spec_helper.rb'
|
2
|
+
# require "digest/sha1"
|
3
|
+
#
|
4
|
+
# describe "Uploads controller" do
|
5
|
+
# it "should create an upload" do
|
6
|
+
# post '/s3_multipart/uploads', {object_name: "example_object.wmv", content_type: "video/x-ms-wmv", uploader: Digest::SHA1.hexdigest("VideoUploader")}
|
7
|
+
# parsed_body = JSON.parse(response.body)
|
8
|
+
# parsed_body.should_not eq({"error"=>"There was an error initiating the upload"})
|
9
|
+
# end
|
10
|
+
# end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_multipart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuid
|
@@ -165,6 +165,8 @@ files:
|
|
165
165
|
- javascripts/upload.js
|
166
166
|
- javascripts/uploadpart.js
|
167
167
|
- lib/generators/s3_multipart/install_generator.rb
|
168
|
+
- lib/generators/s3_multipart/install_new_migrations_generator.rb
|
169
|
+
- lib/generators/s3_multipart/templates/add_size_column_to_s3_multipart_uploads.rb
|
168
170
|
- lib/generators/s3_multipart/templates/add_uploader_column_to_model.rb
|
169
171
|
- lib/generators/s3_multipart/templates/aws.yml
|
170
172
|
- lib/generators/s3_multipart/templates/configuration_initializer.rb
|