Skip to content

Commit

Permalink
Rename gem because of conflict with another one (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicolBen authored Jun 15, 2020
1 parent 902dc1d commit 9ed07de
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in simple_redis_lock.gemspec
# Specify your gem's dependencies in simple_redlock.gemspec
gemspec

gem 'activesupport'
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
simple_redis_lock (0.1.0)
simple_redlock (0.1.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -43,7 +43,7 @@ DEPENDENCIES
activesupport
rake (~> 10.0)
rspec (~> 3.0)
simple_redis_lock!
simple_redlock!

BUNDLED WITH
2.0.1
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Simple Redis Lock

[![CircleCI](https://circleci.com/gh/hinthealth/simple_redis_lock/tree/master.svg?style=svg&circle-token=572e9e02e6a60342db0e62647bcc0ced8295435f)](https://circleci.com/gh/hinthealth/simple_redis_lock/tree/master)
[![CircleCI](https://circleci.com/gh/hinthealth/simple_redlock/tree/master.svg?style=svg&circle-token=572e9e02e6a60342db0e62647bcc0ced8295435f)](https://circleci.com/gh/hinthealth/simple_redlock/tree/master)

This gem implements a lock using Redis in 90 lines of code.

Expand All @@ -9,7 +9,7 @@ This gem implements a lock using Redis in 90 lines of code.
Add this line to your application's Gemfile:

```ruby
gem 'simple_redis_lock'
gem 'simple_redlock'
```

And then execute:
Expand All @@ -18,13 +18,13 @@ And then execute:

Or install it yourself as:

$ gem install simple_redis_lock
$ gem install simple_redlock

## Usage

You can invoke it with `SimpleRedisLock::Locker.new.lock(key_name, value, time_in_ms)`
You can invoke it with `SimpleRedlock::Locker.new.lock(key_name, value, time_in_ms)`

If you use `ActiveRecord`, you can include `SimpleRedisLock::Lockable` and call `exclusively(:your_key)` in your record.
If you use `ActiveRecord`, you can include `SimpleRedlock::Lockable` and call `exclusively(:your_key)` in your record.

## Development

Expand All @@ -34,12 +34,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hinthealth/simple_redis_lock. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on GitHub at https://github.com/hinthealth/simple_redlock. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Simple::Redis::Lock project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hinthealth/simple_redis_lock/blob/master/CODE_OF_CONDUCT.md).
Everyone interacting in the Simple::Redis::Lock project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hinthealth/simple_redlock/blob/master/CODE_OF_CONDUCT.md).
6 changes: 0 additions & 6 deletions lib/simple_redis_lock.rb

This file was deleted.

6 changes: 6 additions & 0 deletions lib/simple_redlock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'active_support/core_ext/numeric/time'
require_relative 'simple_redlock/locker'
require_relative 'simple_redlock/lockable'

module SimpleRedlock
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SimpleRedisLock
module SimpleRedlock
module Lockable
def exclusively(key, options = {}, &block)
transaction do
Expand All @@ -13,7 +13,7 @@ def exclusive_key(key)
end

def redis_lock
@redis_lock ||= SimpleRedisLock::Locker.new
@redis_lock ||= SimpleRedlock::Locker.new
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LockError = Class.new(StandardError)

module SimpleRedisLock
module SimpleRedlock
class Locker
DEFAULT_RETRY_COUNT = 25
DEFAULT_TTL = 5.seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Connection
class Memory
def eval(*args)
case args[0]
when SimpleRedisLock::Locker::UNLOCK_SCRIPT
when SimpleRedlock::Locker::UNLOCK_SCRIPT
return 0 unless get(args[2]) == args[3]

del(args[2])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SimpleRedisLock
module SimpleRedlock
VERSION = '0.1.0'.freeze
end
6 changes: 3 additions & 3 deletions simple_redis_lock.gemspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'simple_redis_lock/version'
require 'simple_redlock/version'

Gem::Specification.new do |spec|
spec.name = 'simple_redis_lock'
spec.version = SimpleRedisLock::VERSION
spec.name = 'simple_redlock'
spec.version = SimpleRedlock::VERSION
spec.authors = ['Hint']
spec.email = ['[email protected]']

Expand Down
2 changes: 1 addition & 1 deletion spec/simple_redis_lock/lockable_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

class LockableObject
include SimpleRedisLock::Lockable
include SimpleRedlock::Lockable

attr_accessor :id

Expand Down
2 changes: 1 addition & 1 deletion spec/simple_redis_lock/locker_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

RSpec.describe SimpleRedisLock::Locker do
RSpec.describe SimpleRedlock::Locker do
let(:redis_double) { double('Redis') }
let(:redis_lock) { described_class.new(retry_count: retry_count) }
let(:retry_count) { 20 }
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'bundler/setup'
require 'rspec'
require 'simple_redis_lock'
require 'simple_redlock'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
Expand Down

0 comments on commit 9ed07de

Please sign in to comment.