gem_of_thrones 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source :rubygems
2
2
  gemspec
3
3
 
4
+ gem 'bump'
4
5
  gem 'rake'
5
6
  gem 'rspec', '~>2'
6
7
  gem 'activesupport', '>3'
@@ -1,29 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gem_of_thrones (0.2.1)
4
+ gem_of_thrones (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- activesupport (3.2.3)
9
+ activesupport (3.2.11)
10
10
  i18n (~> 0.6)
11
11
  multi_json (~> 1.0)
12
12
  benhutton-libmemcached_store (0.3.2)
13
13
  memcached
14
+ bump (0.3.9)
14
15
  diff-lcs (1.1.3)
15
- i18n (0.6.0)
16
- memcached (1.3.5)
17
- multi_json (1.3.4)
18
- rake (0.9.2)
19
- rspec (2.6.0)
20
- rspec-core (~> 2.6.0)
21
- rspec-expectations (~> 2.6.0)
22
- rspec-mocks (~> 2.6.0)
23
- rspec-core (2.6.4)
24
- rspec-expectations (2.6.0)
25
- diff-lcs (~> 1.1.2)
26
- rspec-mocks (2.6.0)
16
+ i18n (0.6.1)
17
+ memcached (1.5.0)
18
+ multi_json (1.5.0)
19
+ rake (10.0.3)
20
+ rspec (2.12.0)
21
+ rspec-core (~> 2.12.0)
22
+ rspec-expectations (~> 2.12.0)
23
+ rspec-mocks (~> 2.12.0)
24
+ rspec-core (2.12.2)
25
+ rspec-expectations (2.12.1)
26
+ diff-lcs (~> 1.1.3)
27
+ rspec-mocks (2.12.1)
27
28
 
28
29
  PLATFORMS
29
30
  ruby
@@ -31,6 +32,7 @@ PLATFORMS
31
32
  DEPENDENCIES
32
33
  activesupport (> 3)
33
34
  benhutton-libmemcached_store
35
+ bump
34
36
  gem_of_thrones!
35
37
  memcached
36
38
  rake
data/Rakefile CHANGED
@@ -1,22 +1,6 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
+ require "bump/tasks"
2
3
 
3
4
  task :default do
4
5
  sh "rspec spec/"
5
6
  end
6
-
7
- # extracted from https://github.com/grosser/project_template
8
- rule /^version:bump:.*/ do |t|
9
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
10
- index = ['major', 'minor','patch'].index(t.name.split(':').last)
11
- file = 'lib/gem_of_thrones/version.rb'
12
-
13
- version_file = File.read(file)
14
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
15
- version_parts[index] = version_parts[index].to_i + 1
16
- version_parts[2] = 0 if index < 2 # remove patch for minor
17
- version_parts[1] = 0 if index < 1 # remove minor for major
18
- new_version = version_parts * '.'
19
- File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
20
-
21
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
22
- end
data/Readme.md CHANGED
@@ -2,16 +2,16 @@ Everybody wants to be king, but only one can win (synchronized via a distributed
2
2
  Update something everybody depends on without doing it multiple times or using a cron.
3
3
 
4
4
  Cache must support the interface `write(key, value, :expires_in => xxx, :unless_exist => true)`,<br/>
5
- which afaik only `ActiveSupport::Cache::MemCacheStore` and [ActiveSupport::Cache::LibmemcachedStore](https://github.com/benhutton/libmemcached_store) do.
6
-
5
+ supported in:
6
+ - `ActiveSupport::Cache::MemCacheStore`
7
+ - [ActiveSupport::Cache::LibmemcachedStore](https://github.com/benhutton/libmemcached_store)
8
+ - `ActiveSupport::Cache::MemoryStore` @ rails edge
9
+ - [ActiveSupport::Cache::RedisStore](https://rubygems.org/gems/redis-activesupport)
7
10
 
8
11
  Install
9
12
  =======
10
- gem install gem_of_thrones
11
- Or
12
-
13
- rails plugin install git://github.com/grosser/gem_of_thrones.git
14
13
 
14
+ gem install gem_of_thrones
15
15
 
16
16
  Usage
17
17
  =====
@@ -31,9 +31,27 @@ Usage
31
31
  end
32
32
  end
33
33
 
34
+ When not to use (by [Ben Osheroff](https://github.com/osheroff))
35
+ ==================
36
+ For a really critical master, memcache isn't traditionally that great.
37
+ Memcache's best high-availability offering is a cluster of servers with the key hashing to a different server,
38
+ and a server can drop out (due to timeouts or sporadic failures or what have you),
39
+ and then you lose cache coherency and some servers can think a key belongs somewhere
40
+ and some servers think it belongs elsewhere, and it's just not that great.
41
+ What you're left with then is either going with a single memcache (single point of failure, oy),
42
+ or sacrificing true locks.
43
+
44
+ Redis might be slightly better solution as it at least offers some failover via replication, and I think it has a check-and-set operator.
45
+
46
+ The big heavies in this space are of course zookeeper etc, but that can be overboard.
47
+
48
+ Development
49
+ ==========
50
+ Start `memcached` then `rake`.
51
+
34
52
  Author
35
53
  ======
36
54
  [Zendesk](http://zendesk.com)<br/>
37
55
  michael@grosser.it<br/>
38
56
  License: MIT<br/>
39
- [![Build Status](https://secure.travis-ci.org/grosser/gem_of_thrones.png)](http://travis-ci.org/grosser/gem_of_thrones)
57
+ [![Build Status](https://travis-ci.org/grosser/gem_of_thrones.png)](https://travis-ci.org/grosser/gem_of_thrones)
@@ -4,10 +4,10 @@ class GemOfThrones
4
4
  def initialize(options)
5
5
  @options = {
6
6
  :timeout => 10 * 60,
7
- :cache_key => "GemOfThrones.",
8
- :cache => "You have to set :cache",
7
+ :cache_key => "GemOfThrones."
9
8
  }.merge(options)
10
9
 
10
+ raise "Set a :cache" unless options[:cache]
11
11
  raise "Only integers are supported for timeout" if options[:timeout].is_a?(Float)
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  class GemOfThrones
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_of_thrones
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-09 00:00:00 Z
18
+ date: 2013-01-26 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: