Permalink
Browse files

Support optional S3 paperclip storage

  • Loading branch information...
1 parent 8264885 commit f0b7cf6f96fa2c49f7fc458dd8317da720fff91d @knowuh knowuh committed Jun 21, 2012
Showing with 25 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 Gemfile
  3. +6 −0 Gemfile.lock
  4. +11 −0 config/initializers/paperclip_ini.rb
  5. +5 −0 config/paperclip.sample.yml
View
@@ -90,3 +90,4 @@ sis_import_data
**/sis_import_test_data/report
config/sis_import_data.yml
*.sublime_project.*
+config/paperclip.yml
View
@@ -67,6 +67,8 @@ source "http://rubygems.org"
gem 'delayed_job_active_record', "~> 0.3.2"
gem 'daemons', "~> 1.1.8"
gem 'rush', "~> 0.6.7"
+ # to support hosting paperclip attachments on S3:
+ gem "aws-s3", :require => "aws/s3"
group :development do
gem "rake", "~> 0.9.2"
View
@@ -56,6 +56,10 @@ GEM
arel (2.0.10)
arrayfields (4.7.4)
awesome_print (1.0.1)
+ aws-s3 (0.6.3)
+ builder
+ mime-types
+ xml-simple
builder (2.1.2)
calendar_date_select (1.16.3)
capistrano (2.9.0)
@@ -295,6 +299,7 @@ GEM
win32-api (>= 1.4.5)
windows-api (>= 0.3.0)
wirble (0.1.3)
+ xml-simple (1.1.1)
xpath (0.1.4)
nokogiri (~> 1.3)
@@ -310,6 +315,7 @@ DEPENDENCIES
acts-as-taggable-on (~> 2.1.1)
arrayfields
awesome_print
+ aws-s3
calendar_date_select
capistrano-ext
capybara (~> 1.1.1)
@@ -0,0 +1,11 @@
+config_file ="#{::Rails.root.to_s}/config/paperclip.yml"
+if File.exists?(config_file)
+ Rails.logger.info("configuring paperclip from #{config_file}")
+ c = YAML::load(File.open(config_file))
+ # TODO: do we want to scope to RAILS_ENV?
+ c.each do |key,val|
+ Paperclip::Attachment.default_options[key.to_sym] = val
+ end
+else
+ Rails.logger.info("no configuration file for Paperclip. Using defaults. (no s3 storage)")
+end
@@ -0,0 +1,5 @@
+storage: s3
+s3_credentials:
+ access_key_id: <your access key here>
+ secret_access_key: <your secret code here>
+ bucket: <your bucket name here>

0 comments on commit f0b7cf6

Please sign in to comment.