paperclip-s3 1.0.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.textile +15 -0
- data/Rakefile +1 -0
- data/lib/paperclip-s3.rb +25 -0
- data/lib/paperclip-s3/version.rb +5 -0
- data/paperclip-s3.gemspec +23 -0
- metadata +84 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.textile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
h1. Paperclip S3 Storage
|
2
|
+
|
3
|
+
This gem will force paperclip to store attachments on S3. It's great for "Heroku":http://heroku.com apps and thats basically why I wrote it.
|
4
|
+
|
5
|
+
I was really lazy writing this over and over again, so I just gemed it.
|
6
|
+
|
7
|
+
h1. Important Notes
|
8
|
+
|
9
|
+
If you're in fact using "Heroku":http://heroku.com, and you want the attachments to have custom paths. *PLEASE* do not use *RAILS_ROOT*. Why? Every time you deploy your app to "Heroku":http://heroku.com, you're changing the RAILS_ROOT, so all your uploaded files will be lost and your bucket *WILL* be a mess!
|
10
|
+
|
11
|
+
A default, Heroku-working path is on by default, so you can just use it.
|
12
|
+
|
13
|
+
h2. Contribute
|
14
|
+
|
15
|
+
Feel free to fork, fix/patch/extend this. Everything is welcome.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/paperclip-s3.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "paperclip-s3/version"
|
2
|
+
|
3
|
+
module Paperclip
|
4
|
+
module S3
|
5
|
+
|
6
|
+
# Extends the paperclips has_attached_file method
|
7
|
+
# It will use S3 Storage. The credentials will be read from the environment
|
8
|
+
def has_attached_file(name, options = {})
|
9
|
+
options[:storage] ||= :s3
|
10
|
+
options[:path] ||= "/:class-:attachment/:id/:style-:basename.:extension"
|
11
|
+
options[:bucket] ||= ENV["S3_BUCKET"]
|
12
|
+
options[:s3_credentials] ||= {
|
13
|
+
:access_key_id => ENV['S3_KEY'],
|
14
|
+
:secret_access_key => ENV['S3_SECRET']
|
15
|
+
}
|
16
|
+
super(name, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
if defined?(ActiveRecord) and defined?(Rails)
|
24
|
+
ActiveRecord::Base.send :extend, Paperclip::S3 if Rails.env.production?
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "paperclip-s3/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "paperclip-s3"
|
7
|
+
s.version = Paperclip::S3::VERSION
|
8
|
+
s.authors = ["Nicolás Hock Isaza"]
|
9
|
+
s.email = ["nhocki@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Simple gem that makes paperclip save the attachments on Amazon S3 for a production Rails application.}
|
12
|
+
s.description = %q{The gem will simply extend the has_attached_file to make it store on Amazon S3 when the application is on production. Great for Heroku applications.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "paperclip-s3"
|
15
|
+
|
16
|
+
s.add_dependency('paperclip', '~> 2.3.11')
|
17
|
+
s.add_dependency('aws-s3', '~> 0.6.2')
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paperclip-s3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 5
|
5
|
+
version: 1.0.0pre
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Nicol\xC3\xA1s Hock Isaza"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-08 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: paperclip
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.3.11
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-s3
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.6.2
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
description: The gem will simply extend the has_attached_file to make it store on Amazon S3 when the application is on production. Great for Heroku applications.
|
39
|
+
email:
|
40
|
+
- nhocki@gmail.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- README.textile
|
51
|
+
- Rakefile
|
52
|
+
- lib/paperclip-s3.rb
|
53
|
+
- lib/paperclip-s3/version.rb
|
54
|
+
- paperclip-s3.gemspec
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: ""
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.1
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project: paperclip-s3
|
79
|
+
rubygems_version: 1.3.9.1
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Simple gem that makes paperclip save the attachments on Amazon S3 for a production Rails application.
|
83
|
+
test_files: []
|
84
|
+
|