Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
* Added CHANGELOG
* Added LICENSE
* Added basic README
  • Loading branch information
David Czarnecki committed Jan 11, 2012
1 parent ebf7e99 commit 10177dc
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

* Initial release
20 changes: 20 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2012 David Czarnecki

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# amico

Friendships backed by Redis in Ruby.

## Installation

`gem install amico`

or in your `Gemfile`

```ruby
gem 'amico'
```

Make sure your redis server is running! Redis configuration is outside the scope of this README, but
check out the Redis documentation, http://redis.io/documentation.

## Usage

Configure amico:

```ruby
Amico.configure do |configuration|
configuration.redis = Redis.new
configuration.namespace = 'amico'
configuration.following_key = 'following'
configuration.followers_key = 'followers'
end
```

```ruby
require 'amico'
=> true

Amico.configure do |configuration|
configuration.redis = Redis.new
configuration.namespace = 'amico'
configuration.following_key = 'following'
configuration.followers_key = 'followers'
end

Amico.follow(1, 11)
=> [1, 1]

Amico.following?(1, 11)
=> true

Amico.following?(11, 1)
=> false

Amico.follow(11, 1)
=> [1, 1]

Amico.following?(11, 1)
=> true

Amico.following_count(1)
=> 1

Amico.followers_count(1)
=> 1

Amico.unfollow(11, 1)
=> [1, 1]

Amico.following_count(11)
=> 0

Amico.following_count(1)
=> 1

Amico.follower?(1, 11)
=> false
```

## Contributing to amico

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

## Copyright

Copyright (c) 2012 David Czarnecki. See LICENSE.txt for further details.

1 change: 1 addition & 0 deletions lib/amico.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'redis'
require 'amico/version'
require 'amico/configuration'
require 'amico/friendships'
Expand Down
3 changes: 1 addition & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'rspec'
require 'redis'
require 'amico'

Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Expand All @@ -8,7 +7,7 @@
config.before(:each) do
Amico.configure do |configuration|
redis = Redis.new
redis.flushdb
redis.flushall
configuration.redis = redis
end
end
Expand Down

0 comments on commit 10177dc

Please sign in to comment.