Replace aws-s3 storage backend with the AWS SDK for Ruby. #579

Closed
wants to merge 5 commits into
from

Projects

None yet

9 participants

mattyn commented Aug 29, 2011

This commit replaces aws-s3 as the backend for storing uploaded files in Amazon S3 with the aws-sdk gem, which is the official AWS SDK for Ruby. The new backend supports all of the same options as the original one, with two additions:

  • :s3_metadata -- Automatically adds the "x-amz-meta-" prefix to the keys in the hash.
  • :s3_storage_class -- Equivalent to passing "x-amz-storage-class" in :s3_headers.

We've updated the unit tests to do mocking and stubbing against the aws-sdk API, but we left the integration tests alone. We were able to get all of the tests to pass under each of the appraisals, including the integration tests.

A significant side effect of this patch is that it is no longer possible to use aws-s3 in the same application as paperclip, because both aws-s3 and aws-sdk use the AWS::S3 constant in incompatible ways.

I have used this branch, and it works as advertised. I appreciate being on the official aws-sdk gem, and it takes advantage of newer official APIs, such as copying between buckets on S3 without first downloading the content to wherever the gem is running from which is useful for executing in rake tasks.

I did experience an incompatibility with trying to specify paperclip options in my config/environments/development.rb since this branch is based on 2.3.x to which I've not yet figured out a solution. But otherwise, I would love to see this pull request merged in officially!

Paperclip.options[:command_path] = '/opt/local/bin/'

config/environments/development.rb:19:in load_environment': undefined methodoptions' for Paperclip:Module (NoMethodError)

Cheers,
Kevin

Plus one here, I started to write code for it myself and now I don't have to do it anymore, thanks @kevinelliott :)

@mauricio, thanks for the note, but the real thanks should go to @mattyn who opened this pull request (and I assume likely did all the hard work). And another person who gives +1 adds to the demand for getting this into master... thanks for that!

lou commented Sep 29, 2011

+1 for merging this in master. I'm currently using the amazonwebservices fork in production.

Owner

This pull request cannot be automatically merged anymore. The only tricky file is lib/paperclip/storage/s3.rb. Can you rebase this pull request and then we'll pull it in?

Thanks,
-Mike

trevorrowe added some commits Oct 10, 2011
@trevorrowe trevorrowe Merge remote branch 'thoughtbot/master' into aws-sdk-backend
Conflicts:
	Gemfile
	Gemfile.lock
	features/support/s3.rb
	gemfiles/rails2.gemfile
	gemfiles/rails2.gemfile.lock
	gemfiles/rails3.gemfile
	gemfiles/rails3.gemfile.lock
	gemfiles/rails3_1.gemfile
	gemfiles/rails3_1.gemfile.lock
	lib/paperclip/storage/s3.rb
	test/storage/s3_test.rb
5f5369d
@trevorrowe trevorrowe fixed tests for the s3 storage 1f93b89
@trevorrowe trevorrowe raising appropriate error for missing :bucket option 19c1ad7
Contributor
sikachu commented Oct 14, 2011

I actually would love to see aws-sdk as another storage option to retain backward compatibility. If people switch to aws-sdk a lot, then we going to make it as default.

Owner
% ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
% bundle && rake && git push
Fetching source index for http://rubygems.org/
Using rake (0.9.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.1) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.1) 
Using arel (2.2.1) 
Using tzinfo (0.3.30) 
Using activerecord (3.1.1) 
Using bundler (1.0.12) 
Using appraisal (0.3.8) 
Using rack (1.3.5) 
Using bcat (0.6.2) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using diff-lcs (1.1.3) 
Using json (1.6.1) 
Using gherkin (2.4.21) 
Using term-ansicolor (1.0.7) 
Using cucumber (1.0.6) 
Using rdiscount (1.6.8) 
Using rspec-core (2.7.1) 
Using rspec-expectations (2.7.0) 
Using rspec-mocks (2.7.0) 
Using rspec (2.7.0) 
Using aruba (0.4.6) 
Installing multi_xml (0.4.1) 
Installing httparty (0.8.1) 
Using nokogiri (1.5.0) 
Installing uuidtools (2.1.2) 
Installing aws-sdk (1.2.1) 
Using mime-types (1.16) 
Using rack-test (0.6.1) 
Using json_pure (1.6.1) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.9.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using cocaine (0.2.0) 
Using coderay (0.9.8) 
Using excon (0.7.6) 
Using fakeweb (1.3.0) 
Using formatador (0.2.1) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using ruby-hmac (0.4.0) 
Using fog (1.0.0) 
Using metaclass (0.0.1) 
Using sexp_processor (3.0.7) 
Using ruby_parser (2.0.6) 
Using method_source (0.6.6) 
Using mocha (0.10.0) 
Using slop (2.1.0) 
Using pry (0.9.6.2) 
Using rdoc (3.11) 
Using shoulda (2.11.3) 
Using sqlite3 (1.3.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
>> bundle install --gemfile=/home/mike/lib/paperclip/gemfiles/rails2.gemfile
Using rake (0.9.2) 
Using activesupport (2.3.14) 
Using rack (1.1.2) 
Using actionpack (2.3.14) 
Using actionmailer (2.3.14) 
Using activerecord (2.3.14) 
Using activeresource (2.3.14) 
Using bundler (1.0.12) 
Using appraisal (0.3.8) 
Using bcat (0.6.2) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using builder (3.0.0) 
Using diff-lcs (1.1.3) 
Using json (1.6.1) 
Using gherkin (2.4.21) 
Using term-ansicolor (1.0.7) 
Using cucumber (1.0.6) 
Using rdiscount (1.6.8) 
Using rspec-core (2.7.1) 
Using rspec-expectations (2.7.0) 
Using rspec-mocks (2.7.0) 
Using rspec (2.7.0) 
Using aruba (0.4.6) 
Using multi_json (1.0.3) 
Using multi_xml (0.4.1) 
Using httparty (0.8.1) 
Using nokogiri (1.5.0) 
Using uuidtools (2.1.2) 
Using aws-sdk (1.2.1) 
Using mime-types (1.16) 
Using rack-test (0.6.1) 
Using json_pure (1.6.1) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.9.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using cocaine (0.2.0) 
Using coderay (0.9.8) 
Using excon (0.7.6) 
Using fakeweb (1.3.0) 
Using formatador (0.2.1) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using ruby-hmac (0.4.0) 
Using fog (1.0.0) 
Using metaclass (0.0.1) 
Using sexp_processor (3.0.7) 
Using ruby_parser (2.0.6) 
Using method_source (0.6.6) 
Using mocha (0.10.0) 
Using paperclip (2.4.4) from source at ../ 
Using slop (2.1.0) 
Using pry (0.9.6.2) 
Using rails (2.3.14) 
Using rdoc (3.11) 
Using shoulda (2.11.3) 
Using sqlite3 (1.3.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
>> bundle install --gemfile=/home/mike/lib/paperclip/gemfiles/rails3.gemfile
Using rake (0.9.2) 
Using abstract (1.0.0) 
Using activesupport (3.0.10) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.10) 
Using erubis (2.6.6) 
Using rack (1.2.4) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.30) 
Using actionpack (3.0.10) 
Using mime-types (1.16) 
Using polyglot (0.3.2) 
Using treetop (1.4.10) 
Using mail (2.2.19) 
Using actionmailer (3.0.10) 
Using arel (2.0.10) 
Using activerecord (3.0.10) 
Using activeresource (3.0.10) 
Using bundler (1.0.12) 
Using appraisal (0.3.8) 
Using bcat (0.6.2) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using diff-lcs (1.1.3) 
Using json (1.6.1) 
Using gherkin (2.4.21) 
Using term-ansicolor (1.0.7) 
Using cucumber (1.0.6) 
Using rdiscount (1.6.8) 
Using rspec-core (2.7.1) 
Using rspec-expectations (2.7.0) 
Using rspec-mocks (2.7.0) 
Using rspec (2.7.0) 
Using aruba (0.4.6) 
Using multi_json (1.0.3) 
Using multi_xml (0.4.1) 
Using httparty (0.8.1) 
Using nokogiri (1.5.0) 
Using uuidtools (2.1.2) 
Using aws-sdk (1.2.1) 
Using json_pure (1.6.1) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.9.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using cocaine (0.2.0) 
Using coderay (0.9.8) 
Using excon (0.7.6) 
Using fakeweb (1.3.0) 
Using formatador (0.2.1) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using ruby-hmac (0.4.0) 
Using fog (1.0.0) 
Using metaclass (0.0.1) 
Using sexp_processor (3.0.7) 
Using ruby_parser (2.0.6) 
Using method_source (0.6.6) 
Using mocha (0.10.0) 
Using paperclip (2.4.4) from source at ../ 
Using slop (2.1.0) 
Using pry (0.9.6.2) 
Using rdoc (3.11) 
Using thor (0.14.6) 
Using railties (3.0.10) 
Using rails (3.0.10) 
Using shoulda (2.11.3) 
Using sqlite3 (1.3.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
>> bundle install --gemfile=/home/mike/lib/paperclip/gemfiles/rails3_1.gemfile
Using rake (0.9.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.1) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.1) 
Using erubis (2.7.0) 
Using rack (1.3.5) 
Using rack-cache (1.1) 
Using rack-mount (0.8.3) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.0.3) 
Using actionpack (3.1.1) 
Using mime-types (1.16) 
Using polyglot (0.3.2) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.1.1) 
Using arel (2.2.1) 
Using tzinfo (0.3.30) 
Using activerecord (3.1.1) 
Using activeresource (3.1.1) 
Using bundler (1.0.12) 
Using appraisal (0.3.8) 
Using bcat (0.6.2) 
Using ffi (1.0.9) 
Using childprocess (0.2.2) 
Using diff-lcs (1.1.3) 
Using json (1.6.1) 
Using gherkin (2.4.21) 
Using term-ansicolor (1.0.7) 
Using cucumber (1.0.6) 
Using rdiscount (1.6.8) 
Using rspec-core (2.7.1) 
Using rspec-expectations (2.7.0) 
Using rspec-mocks (2.7.0) 
Using rspec (2.7.0) 
Using aruba (0.4.6) 
Using multi_xml (0.4.1) 
Using httparty (0.8.1) 
Using nokogiri (1.5.0) 
Using uuidtools (2.1.2) 
Using aws-sdk (1.2.1) 
Using json_pure (1.6.1) 
Using rubyzip (0.9.4) 
Using selenium-webdriver (2.9.0) 
Using xpath (0.1.4) 
Using capybara (1.1.1) 
Using cocaine (0.2.0) 
Using coderay (0.9.8) 
Using excon (0.7.6) 
Using fakeweb (1.3.0) 
Using formatador (0.2.1) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using ruby-hmac (0.4.0) 
Using fog (1.0.0) 
Using metaclass (0.0.1) 
Using sexp_processor (3.0.7) 
Using ruby_parser (2.0.6) 
Using method_source (0.6.6) 
Using mocha (0.10.0) 
Using paperclip (2.4.4) from source at ../ 
Using slop (2.1.0) 
Using pry (0.9.6.2) 
Using rack-ssl (1.3.2) 
Using rdoc (3.11) 
Using thor (0.14.6) 
Using railties (3.1.1) 
Using rails (3.1.1) 
Using shoulda (2.11.3) 
Using sqlite3 (1.3.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
>> BUNDLE_GEMFILE=/home/mike/lib/paperclip/gemfiles/rails2.gemfile bundle exec /var/lib/gems/1.8/bin/rake test cucumber
/usr/bin/ruby1.8 -I"lib:lib:profile" -I"/var/lib/gems/1.8/gems/rake-0.9.2/lib" "/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" 
Testing against version 2.3.14
debugger disabled
  * WARNING: 'test: missing :bucket option should raise an argument error. ' is already defined
Loaded suite /var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
..................................................................................................................../home/mike/lib/paperclip/test/attachment_test.rb:564: warning: multiple values for a block parameter (0 for 1)
    from /usr/lib/ruby/1.8/test/unit/assertions.rb:123
....................................................................................sh: identify: not found
..identify: unable to open image `/home/This File Does Not Exist.omg': gick-6.6.0/modules-Q16/coders/omg.la @ error/blob.c/OpenBlob/2489.
....................identify: improper image header `/tmp/stream20111021-16545-1drlniu-0.png' @ error/png.c/ReadPNGImage/2957.
identify: improper image header `/tmp/stream20111021-16545-1drlniu-0.png' @ error/png.c/ReadPNGImage/2957.
identify: improper image header `/tmp/stream20111021-16545-1drlniu-0.png' @ error/png.c/ReadPNGImage/2957.
.identify: improper image header `/tmp/stream20111021-16545-ab5gtx-0.png' @ error/png.c/ReadPNGImage/2957.
identify: improper image header `/tmp/stream20111021-16545-ab5gtx-0.png' @ error/png.c/ReadPNGImage/2957.
identify: improper image header `/tmp/stream20111021-16545-ab5gtx-0.png' @ error/png.c/ReadPNGImage/2957.
..............[DEPRECATION] validates_attachment_thumbnail is deprecated. This validation is on by default and will be removed from future versions. If you wish to turn it off, supply :whiny => false in your definition.
........Permission denied - /home/mike/lib/paperclip/public/system/avatars/1/original/5k.png - skipping file
.Permission denied - /home/mike/lib/paperclip/public/system/avatars/1/original/5k.png - skipping file
.....................................................................................................................................................................................................sh: convert: not found
..............convert: unrecognized option `-this-aint-no-option' @ error/convert.c/ConvertImageCommand/2777.
.sh: convert: not found
....convert: unrecognized option `-this-aint-no-option' @ error/convert.c/ConvertImageCommand/2777.
...../home/mike/lib/paperclip/test/thumbnail_test.rb:256: warning: already initialized constant GeoParser
.........................................................
Finished in 47.907005 seconds.

524 tests, 918 assertions, 0 failures, 0 errors
/usr/bin/ruby1.8 -S bundle exec cucumber --format progress
..................................F--.........................................................

(::) failed steps (::)

expected there to be content "Name: something" in "Action Controller: Exception caught\n    body { background-color: #fff; color: #333; }\n\n    body, p, ol, ul, td {\n      font-family: verdana, arial, helvetica, sans-serif;\n      font-size:   13px;\n      line-height: 18px;\n    }\n\n    pre {\n      background-color: #eee;\n      padding: 10px;\n      font-size: 11px;\n    }\n\n    a { color: #000; }\n    a:visited { color: #666; }\n    a:hover { color: #fff; background-color:#000; }\n  \n\n\n  FakeWeb::NetConnectNotAllowedError\n  \n    in UsersController#create\n  \n\nReal HTTP connections are disabled. Unregistered request: PUT https://paperclip.s3.amazonaws.com/attachments/1/original/5k.png\n\n\n\nRAILS_ROOT: /home/mike/lib/paperclip/tmp/aruba/testapp\n\n\n  \n    \n    Application Trace |\n  \n    \n    Framework Trace |\n  \n    \n    Full Trace \n  \n\n  \n    \n      /var/lib/gems/1.8/gems/fakeweb-1.3.0/lib/fake_web/ext/net_http.rb:53:in `request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:29:in `handle'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:45:in `http_session_for'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:27:in `handle'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:207:in `make_sync_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:219:in `retry_server_errors'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:202:in `make_sync_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:342:in `client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client_logging.rb:25:in `log_client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client_logging.rb:24:in `log_client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:317:in `client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:255:in `return_or_raise'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:316:in `client_request'\n(eval):3:in `put_object'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/s3/s3_object.rb:305:in `write'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:279:in `flush_writes'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:270:in `each'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:270:in `flush_writes'\n/home/mike/lib/paperclip/lib/paperclip/attachment.rb:176:in `save'\n/home/mike/lib/paperclip/lib/paperclip.rb:460:in `send'\n/home/mike/lib/paperclip/lib/paperclip.rb:460:in `save_attached_files'\n/home/mike/lib/paperclip/lib/paperclip.rb:453:in `each_attachment'\n/home/mike/lib/paperclip/lib/paperclip.rb:452:in `each'\n/home/mike/lib/paperclip/lib/paperclip.rb:452:in `each_attachment'\n/home/mike/lib/paperclip/lib/paperclip.rb:459:in `save_attached_files'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `send'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:93:in `run'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `each'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `send'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `run'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:344:in `callback'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:251:in `create_or_update'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2577:in `save_without_validation'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/validations.rb:1089:in `save_without_dirty'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/dirty.rb:79:in `save_without_transactions'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `send'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'\n/home/mike/lib/paperclip/tmp/aruba/testapp/app/controllers/users_controller.rb:46:in `create'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/mime_responds.rb:106:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/mime_responds.rb:106:in `respond_to'\n/home/mike/lib/paperclip/tmp/aruba/testapp/app/controllers/users_controller.rb:45:in `create'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `send'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `perform_action_without_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:617:in `call_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/flash.rb:151:in `perform_action'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `send'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `process_without_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:606:in `process'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:391:in `process'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:386:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/routing/route_set.rb:438:in `call'\n    \n  \n    \n      /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'\n/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:87:in `dispatch'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:121:in `_call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:114:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:108:in `call'\n    \n  \n    \n      /var/lib/gems/1.8/gems/fakeweb-1.3.0/lib/fake_web/ext/net_http.rb:53:in `request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:29:in `handle'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:45:in `http_session_for'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/http/net_http_handler.rb:27:in `handle'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:207:in `make_sync_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:219:in `retry_server_errors'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:202:in `make_sync_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:342:in `client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client_logging.rb:25:in `log_client_request'\n/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client_logging.rb:24:in `log_client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:317:in `client_request'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:255:in `return_or_raise'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/core/client.rb:316:in `client_request'\n(eval):3:in `put_object'\n/var/lib/gems/1.8/gems/aws-sdk-1.2.1/lib/aws/s3/s3_object.rb:305:in `write'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:279:in `flush_writes'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:270:in `each'\n/home/mike/lib/paperclip/lib/paperclip/storage/s3.rb:270:in `flush_writes'\n/home/mike/lib/paperclip/lib/paperclip/attachment.rb:176:in `save'\n/home/mike/lib/paperclip/lib/paperclip.rb:460:in `send'\n/home/mike/lib/paperclip/lib/paperclip.rb:460:in `save_attached_files'\n/home/mike/lib/paperclip/lib/paperclip.rb:453:in `each_attachment'\n/home/mike/lib/paperclip/lib/paperclip.rb:452:in `each'\n/home/mike/lib/paperclip/lib/paperclip.rb:452:in `each_attachment'\n/home/mike/lib/paperclip/lib/paperclip.rb:459:in `save_attached_files'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `send'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:93:in `run'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `each'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `send'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `run'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:344:in `callback'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:251:in `create_or_update'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2577:in `save_without_validation'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/validations.rb:1089:in `save_without_dirty'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/dirty.rb:79:in `save_without_transactions'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `send'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save'\n/home/mike/lib/paperclip/tmp/aruba/testapp/app/controllers/users_controller.rb:46:in `create'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/mime_responds.rb:106:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/mime_responds.rb:106:in `respond_to'\n/home/mike/lib/paperclip/tmp/aruba/testapp/app/controllers/users_controller.rb:45:in `create'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `send'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `perform_action_without_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:617:in `call_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'\n/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'\n/var/lib/gems/1.8/gems/activesupport-2.3.14/lib/active_support/core_ext/benchmark.rb:17:in `ms'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/flash.rb:151:in `perform_action'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `send'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `process_without_filters'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/filters.rb:606:in `process'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:391:in `process'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:386:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/routing/route_set.rb:438:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:87:in `dispatch'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:121:in `_call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:29:in `call'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:29:in `call'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:9:in `cache'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:28:in `call'\n/var/lib/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/string_coercion.rb:25:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/head.rb:9:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/params_parser.rb:15:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/session/cookie_store.rb:99:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/failsafe.rb:26:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `synchronize'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:114:in `call'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/reloader.rb:34:in `run'\n/var/lib/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:108:in `call'\n/var/lib/gems/1.8/gems/rails-2.3.14/lib/rails/rack/static.rb:31:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/urlmap.rb:47:in `call'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/urlmap.rb:41:in `each'\n/var/lib/gems/1.8/gems/rack-1.1.2/lib/rack/urlmap.rb:41:in `call'\n/var/lib/gems/1.8/gems/rack-test-0.6.1/lib/rack/mock_session.rb:30:in `request'\n/var/lib/gems/1.8/gems/rack-test-0.6.1/lib/rack/test.rb:219:in `process_request'\n/var/lib/gems/1.8/gems/rack-test-0.6.1/lib/rack/test.rb:66:in `post'\n(__FORWARDABLE__):3:in `__send__'\n(__FORWARDABLE__):3:in `post'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/rack_test/browser.rb:62:in `send'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/rack_test/browser.rb:62:in `process'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/rack_test/browser.rb:27:in `submit'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/rack_test/form.rb:64:in `submit'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/rack_test/node.rb:59:in `click'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/node/element.rb:99:in `click'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/node/base.rb:46:in `wait_until'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/node/element.rb:99:in `click'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/node/actions.rb:38:in `click_button'\n(eval):2:in `send'\n(eval):2:in `click_button'\n/var/lib/gems/1.8/gems/capybara-1.1.1/lib/capybara/dsl.rb:161:in `click_button'\n/home/mike/lib/paperclip/features/step_definitions/web_steps.rb:53\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/rb_support/rb_step_definition.rb:62:in `invoke'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/step_match.rb:25:in `invoke'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/step_invocation.rb:59:in `invoke'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/step_invocation.rb:38:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:99:in `visit_step'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:98:in `visit_step'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/step_collection.rb:15:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/step_collection.rb:14:in `each'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/step_collection.rb:14:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:93:in `visit_steps'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/scenario.rb:55:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:79:in `with_hooks'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:95:in `before_and_after'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:78:in `with_hooks'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime/support_code.rb:120:in `call'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime/support_code.rb:120:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/language_support/language_methods.rb:13:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/language_support/language_methods.rb:95:in `call'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/language_support/language_methods.rb:95:in `execute_around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/language_support/language_methods.rb:12:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime/support_code.rb:119:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime/support_code.rb:117:in `call'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime/support_code.rb:117:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:90:in `around'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:77:in `with_hooks'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/scenario.rb:53:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/scenario.rb:108:in `with_visitor'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/scenario.rb:47:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/feature.rb:43:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/feature.rb:42:in `each'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/feature.rb:42:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:20:in `visit_feature'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/features.rb:29:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/features.rb:17:in `each'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/features.rb:17:in `each'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/features.rb:28:in `accept'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:14:in `visit_features'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/runtime.rb:45:in `run!'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/cli/main.rb:43:in `execute!'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/lib/cucumber/cli/main.rb:20:in `execute'\n/var/lib/gems/1.8/gems/cucumber-1.0.6/bin/cucumber:14\n/var/lib/gems/1.8/bin/cucumber:19:in `load'\n/var/lib/gems/1.8/bin/cucumber:19\n    \n  \n\n\n\n\n\n\n\nRequest\nParameters: {\"commit\"=>\"Submit\",\n \"user\"=>{\"name\"=>\"something\",\n \"attachment\"=>#<File:/tmp/RackMultipart20111021-17655-edb1n3-0>}}\n\nShow session dump\n--- \n\n\n\nResponse\nHeaders: {\"Content-Type\"=>\"\",\n \"Cache-Control\"=>\"no-cache\"}\n\n\n\n" (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:107:in `/^(?:|I )should see "([^"]*)"$/'
features/basic_integration.feature:45:in `Then I should see "Name: something"'

Failing Scenarios:
cucumber features/basic_integration.feature:26 # Scenario: S3 Integration test

6 scenarios (1 failed, 5 passed)
82 steps (1 failed, 2 skipped, 79 passed)
5m29.331s
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -S bundle exec cucumber -...]

Tasks: TOP => cucumber
(See full trace by running task with --trace)
Contributor
sikachu commented Oct 21, 2011

I've tried to merge this one in, and see a test failure. I think we should switch to aws-sdk, and it would be great if you can help us fix it. :)

I have created storage module for Paperclip that uses aws-sdk. Works well, using it in production projects myself.
https://github.com/igor-alexandrov/paperclip-aws

Contributor
sikachu commented Nov 12, 2011

Nice, let me see if I can pull your cod in :)

@sikachu sikachu added a commit that referenced this pull request Dec 12, 2011
@sikachu sikachu Use AWS::SDK instead of AWS::S3
The original commit came from @amazonwebservices and @trevorrowe in #579.
I had to revise the commit and make sure all the test cases are passing.
All credits still goes to those guys, thanks a lot!
75f413d
@sikachu sikachu closed this Dec 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment