Project

fakerclip

0.0
No commit activity in last 3 years
No release in over 3 years
Simulate writing and reading from S3 by using your filesystem as a Fake S3.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.20
>= 0
~> 3.4
>= 3.2
 Project Readme

Fakerclip

Fake S3 on your filesystem for Paperclip.

This is a Rails Engine that helps simulate writing and reading from S3, by using your filesystem as a Fake S3.

Instead of this:

PATH_CONFIG = if App.use_s3_for_this_environment
  { url: 'is/my/s3/path', s3_bucket: 's3-foo-bar-bucket' }
else
  { path: 'is/my/local/path'}
end

has_attachment :foobar, DEFAULT_PAPERCLIP_CONFIG.merge(PATH_CONFIG)

do this:

PATH_CONFIG = { url: 'is/my/s3/path', s3_bucket: 's3-foo-bar-bucket' }

has_attachment :foobar, DEFAULT_PAPERCLIP_CONFIG.merge(PATH_CONFIG)

You should be able to write one config per paperclip attachment, specify the S3 bucket/folder setup, and be done with it.

With FakerClip, your filesystem is treated as an s3 bucket so you don't have to wonder if the changes you made to your s3 bucket configuration will break in production. The idea is, if it didn't work on your local filesystem on development or test environments, it won't work on S3!

Setup

gem 'fakerclip'

That's it! Now, just omit : { path: 'is/my/local/path' } from the example above and expect that your files will appear in "#{Rails.root}/public/fakerclip/(development|test)/s3-foo-bar-bucket/" with the same structure as you would expect on S3, e.g. is/my/s3/path from above.

You can use either/both the fog and the aws-sdk gems as the client for S3

Development

bundle exec rake app:db:migrate app:db:test:prepare
bundle exec rspec