Project

fake_aws

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A subset of AWS as a Rack app, for dev and testing
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 2.3.0
>= 0
>= 0
~> 3.0.0

Runtime

~> 0.0.5
 Project Readme

FakeAWS

A minimal implementation of AWS as a Rack app, for testing and development.

This is designed to pair nicely with AWSRaw.

Installation

Add this line to your application's Gemfile:

gem 'fake_aws'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fake_aws

Status Build Status Code Climate

So far there's only a tiny bit of S3 implemented, but it's well tested and fairly easy to extend. Pull requests for more features are welcome.

Usage

The easiest way to try this out is with Faraday:

connection = Faraday.new do |faraday|
  faraday.adapter :rack, FakeAWS::S3::RackApp.new('root_directory')
end

The root directory you provide is used to store S3 objects and metadata.

For example, the following PUT Object request:

connection.put do |request|
  request.url("http://s3.amazonaws.com/test_bucket/test_path/test_file.txt")
  request.headers["Content-Type"] = "text/plain"
  request.body = "Hello, world!"
end

will create a file root_directory/test_bucket/test_path/test_file.txt.

It will also create root_directory/test_bucket/test_path/test_file.txt.metadata.json, which holds the metadata for the file as a JSON hash.

Implemented Operations

S3

Path-style, virtual-hosted-style, and CNAME-style requests are supported for all operations.

No authentication or security is implemented.

Content-Type and x-amz-metadata headers are stored and returned.

Pull requests for other operations are welcome!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

To Do

  • Implement GET Bucket requests
  • Improve the response headers (Content-Length, ETag, etc.)
  • Check signing of requests
  • Handle PUT Object Copy requests