braintree/curator — pull request #41 by bmorton (2014-02-14 08:02:36+00:00)
Title: Repository settings

This is my first swing at adding support for issue #40. The diff for `spec/curator/repository_spec.rb` is a little hairy since I fixed some alignment issues that were throwing me off. If you want to cherry-pick deaf5c8 into master, I can rebase and it'll be a little cleaner. I'd love whatever feedback anyone's got! Here's a quick overview (taken from what I updated in the README):

### Repository configuration
Repositories allow their default collection properties to be configured through a syntax similar to [Sinatra's configuration interface](http://www.sinatrarb.com/configuration.html). Configurable properties are data store specific and currently Riak is the only supported default-overridable data store.

The methods used to configure the Repository are `set`, `enable`, and `disable`:

```ruby
class NoteRepository
include Curator::Repository

set :n_val, 5
enable :allow_mult
disable :last_write_wins
end
```

For more information on the properties that can be configured for Riak buckets, [see this documentation](http://docs.basho.com/riak/latest/theory/concepts/Buckets/).

#### Applying the configuration
Repository configuration is not applied automatically. To apply the uncommitted properties, run the `curator:repository:apply` rake task:

```sh
$ rake curator:repository:apply
[Curator] Preparing to apply settings to all repositories...
* Updating settings for NoteRepository... Done!
[Curator] Done!
```

To manually apply uncommitted properties to a specific repository, use `NoteRepository.apply_settings!` in an irb or Rails console session.