paperclip_s3du 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.DS_Store
1
2
  *.gem
2
3
  *.rbc
3
4
  .bundle
@@ -0,0 +1,22 @@
1
+ module Paperclip
2
+ module S3DU
3
+ class Railtie < Rails::Railtie
4
+ initializer "paperclip_s3du.action_controller" do
5
+ ActiveSupport.on_load(:action_controller) do
6
+ def self.paperclip_s3_direct_upload_for object, options = {}
7
+ only = options[:only] || [:create, :update]
8
+
9
+ before_filter :only => only do |controller|
10
+ param = options[:param] || :file
11
+ property = options[:property] || param
12
+
13
+ if params.has_key? param
14
+ params[object][property] = Paperclip::S3DU::S3DirectUpload.new params[param]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,4 @@
1
1
  require 'paperclip_s3du/s3_direct_upload'
2
2
  require 'paperclip_s3du/s3_direct_upload_adapter'
3
3
  require 'paperclip_s3du/s3du'
4
- require 'paperclip_s3du/application_controller'
4
+ require 'paperclip_s3du/railtie'
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'paperclip_s3du'
3
- s.version = '0.0.1'
4
- s.date = '2013-03-03'
3
+ s.version = '0.0.2'
4
+ s.date = '2013-03-09'
5
5
  s.summary = "Already-uploaded Paperclip"
6
6
  s.description = "Paperclip support for already-uploaded-in-s3 files."
7
7
  s.authors = ["Guilherme Vieira"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip_s3du
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.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-03 00:00:00.000000000 Z
12
+ date: 2013-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: paperclip
@@ -36,7 +36,7 @@ files:
36
36
  - .gitignore
37
37
  - README.md
38
38
  - lib/paperclip_s3du.rb
39
- - lib/paperclip_s3du/application_controller.rb
39
+ - lib/paperclip_s3du/railtie.rb
40
40
  - lib/paperclip_s3du/s3_direct_upload.rb
41
41
  - lib/paperclip_s3du/s3_direct_upload_adapter.rb
42
42
  - lib/paperclip_s3du/s3du.rb
@@ -1,14 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- def self.paperclip_s3_direct_upload_for object, options = {}
3
- only = options[:only] || [:create, :update]
4
-
5
- before_filter :only => only do |controller|
6
- param = options[:param] || :file
7
- property = options[:property] || param
8
-
9
- if params.has_key? param
10
- params[object][property] = Paperclip::S3DU::S3DirectUpload.new params[param]
11
- end
12
- end
13
- end
14
- end