paperclip-s3 1.0.0pre4 → 1.0.0rc1

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/README.textile CHANGED
@@ -1,3 +1,6 @@
1
+ h1. THIS IS NOT WORKING (YET)!
2
+
3
+
1
4
  h1. Paperclip S3 Storage
2
5
 
3
6
  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.
data/lib/paperclip-s3.rb CHANGED
@@ -1,25 +1,25 @@
1
+ require 'rails'
1
2
  require 'paperclip'
2
- require "paperclip-s3/version"
3
+ require 'paperclip-s3/version'
4
+ require 'paperclip-s3/railtie'
3
5
 
4
- module Zinergia
5
- module Paperclip
6
- module S3
6
+
7
+ module Paperclip
8
+ module S3
9
+ module ClassMethods
7
10
  # Extends the paperclips has_attached_file method
8
11
  # It will use S3 Storage. The credentials will be read from the environment
9
12
  def has_attached_file(name, options = {})
10
- options[:storage] ||= :s3
11
- options[:path] ||= "/:class-:attachment/:id/:style-:basename.:extension"
12
- options[:bucket] ||= ENV["S3_BUCKET"]
13
- options[:s3_credentials] ||= {
14
- :access_key_id => ENV['S3_KEY'],
15
- :secret_access_key => ENV['S3_SECRET']
16
- }
13
+ ActiveRecord::Base.logger.error {"\n\n\n#################################### Hello from S3 Gem"}
14
+ options[:storage] = :s3
15
+ options[:path] = "/:class-:attachment/:id/:style-:basename.:extension"
16
+ options[:bucket] = ENV["S3_BUCKET"]
17
+ options[:s3_credentials] = {
18
+ :access_key_id => ENV['S3_KEY'],
19
+ :secret_access_key => ENV['S3_SECRET']
20
+ }
17
21
  super(name, options)
18
22
  end
19
23
  end
20
-
21
-
22
24
  end
23
- end
24
-
25
- ActiveRecord::Base.send(:extend, Zinergia::Paperclip::S3)
25
+ end
@@ -0,0 +1,19 @@
1
+ module Paperclip
2
+ module S3
3
+ if defined? Rails::Railtie # Don't break rails 2.x
4
+ class Railtie < Rails::Railtie
5
+ initializer 'paperclip.force_s3_attachment_on_production' do
6
+ ActiveSupport.on_load :active_record do
7
+ Paperclip::S3::Railtie.insert
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ class Railtie
14
+ def self.insert
15
+ ActiveRecord::Base.send(:extend, Paperclip::S3::ClassMethods)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module S3
3
- VERSION = "1.0.0pre4"
3
+ VERSION = "1.0.0rc1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: paperclip-s3
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 5
5
- version: 1.0.0pre4
5
+ version: 1.0.0rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Nicol\xC3\xA1s Hock Isaza"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-10 00:00:00 -05:00
13
+ date: 2011-06-14 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -50,6 +50,7 @@ files:
50
50
  - README.textile
51
51
  - Rakefile
52
52
  - lib/paperclip-s3.rb
53
+ - lib/paperclip-s3/railtie.rb
53
54
  - lib/paperclip-s3/version.rb
54
55
  - paperclip-s3.gemspec
55
56
  has_rdoc: true