Cooper
A schema-less revisioning database project built on Mongoid
Getting Started
Install cooper from the command prompt
gem install cooper
Usage
require 'cooper'
# Frameworks usually manage this step
Mongoid.load!('/path/to/config/mongoid.yml', :environment)
class Record
include Cooper::Document
revision_field :key
end
record = Record.new(key: 1)
record.save
p record.key
#=> 1
record.update_attributes(key: 2)
p record.key
#=> 2
record.checkout(id: 1)
p record.key
#=> 1
record.checkout(time: Time.now)
p record.key
#=> 2
Features
Cooper::Document behaves like a Mongoid::Document
It adds the capabilities of checking out declared revision fields
It uses Redis on port 6379 to get the current revision count
Road Map
- Persist revision count from mongodb
- Allow Redis configuration
- Enable validation skipping on save
## Tests
rake
will run all tests
rake spec:features
will run against mongodb (configuration is located at spec/support/mongoid.yml
)
rake spec:unit
runs tests in isolation
License
The gem is available as open source under the terms of the MIT License.
Contributing
- Fork it ( https://github.com/floum/cooper/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request