fog/fog — pull request #1154 by masterzen (2012-09-17 21:52:15+00:00)
Title: Fog::Mock data persistence hooks

Hi,

Please find an attempt to provide Fog::Mock data persistence hooks in Fog::Mock to allow fog based application to persist the mock data between application calls.

The idea is to be able to write acceptance tests like this fake cucumber one:

```
Scenario: creating an S3 bucket
Given I run 's3 bucket create test'
When I run `s3 bucket list`
Then the output should contain exactly:
"""
+---------+
| bucket |
+---------+
| test |
+---------+
"""
```

This is covered by minimal tests (let me know if more or different tests are needed).

The PR also contains modifications to bin/fog to reload/dump mocked data provided FOG_MOCK is true and the FOG_STATE_FILE environment variable contains a path to a file that will upon fog exit contain all the mocked data.
Ex:

```
brice@macbook% FOG_MOCK=true FOG_STATE_FILE=/tmp/fogirb.yaml bundle exec bin/fog
Welcome to fog interactive!
:default provides AWS and VirtualBox
>> Fog::Compute.new(:provider => 'aws').servers.create.identity
"i-5e9f3a97"
>> exit

brice@macbook% FOG_MOCK=true FOG_STATE_FILE=/tmp/fogirb.yaml bundle exec bin/fog
Welcome to fog interactive!
:default provides AWS and VirtualBox
>> Fog::Compute.new(:provider => 'aws').servers.get('i-5e9f3a97').identity
"i-5e9f3a97"
```

Thanks!
Brice