<commit_before># FakeAWS

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

This is still in the very early stages of development.

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

## 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

## Usage

TODO: Write usage instructions here

## 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

- Handle bucket names in the host as well as the path
- Spit out a properly formatted response on a successful PUT object operation
- Complete the missing fields in XML error responses
- Check signing of requests
- Handle PUT Object copy requests
<commit_msg>Make the readme vaguely useful.<commit_after># FakeAWS

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

This is designed to pair nicely with [AWSRaw](https://github.com/envato/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

This is still in the very early stages of development.

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.

The S3 implementation only supports basic PUT Object and GET Object requests.
The bucket name must be in the path, not the host.  No authentication or
security is implemented.  `Content-Type` and `x-amz-metadata` headers are
stored and returned. Responses may or may not be properly formatted.


## Usage

The easiest way to try this out is with [Faraday](https://github.com/lostisland/faraday):

```ruby
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:

```ruby
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`.

(Note: `root_directory/test_bucket` must already exist! As there's no
implementation of the Create Bucket operation yet, you'll need to make the
directory for the bucket yourself before doing a PUT Object.)

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.


## 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

- Handle bucket names in the host as well as the path
- Spit out a properly formatted response on a successful PUT object operation
- Complete the missing fields in XML error responses
- Check signing of requests
- Handle PUT Object copy requests

{'fraction_non_alphanumeric': 0.07251908396946564, 'fraction_numerical': 0.004697592483852026, 'mean_word_length': 4.062407132243685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '272475', 'n_tokens_mistral': 999, 'n_tokens_neox': 948, 'n_words': 472}