stillwater 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Stillwater
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/trobrock/stillwater.png?branch=master)](http://travis-ci.org/trobrock/stillwater)
4
+ [![Build Status](https://gemnasium.com/trobrock/stillwater.png)](https://gemnasium.com/trobrock/stillwater)
5
+
3
6
  A simple connection pool, that allows connections to different servers (or anything else)
4
7
 
5
8
  ## Installation
@@ -18,23 +21,25 @@ Or install it yourself as:
18
21
 
19
22
  ## Usage
20
23
 
21
- pool = Stillwater::ConnectionPool.new
22
- %q{ host1.com host2.com }.each do |host|
23
- pool.add { MyConnectionClass.new(host) }
24
- end
25
-
26
- # Basic connection handling
27
- pool.with_connection do |connection|
28
- # Do some stuff with your connection
29
- end
30
-
31
- # Retry connections
32
- # This will retry your code with a new connection and mark the tried
33
- # connection as bad. The bad connection will be put back in the pool
34
- # at the default period of 5 minutes.
35
- pool.retry_connection_from(ServerConnectionFailed) do |connection|
36
- # Do some stuff with your connection
37
- end
24
+ ```ruby
25
+ pool = Stillwater::ConnectionPool.new
26
+ %q{ host1.com host2.com }.each do |host|
27
+ pool.add { MyConnectionClass.new(host) }
28
+ end
29
+
30
+ # Basic connection handling
31
+ pool.with_connection do |connection|
32
+ # Do some stuff with your connection
33
+ end
34
+
35
+ # Retry connections
36
+ # This will retry your code with a new connection and mark the tried
37
+ # connection as bad. The bad connection will be put back in the pool
38
+ # at the default period of 5 minutes.
39
+ pool.retry_connection_from(ServerConnectionFailed) do |connection|
40
+ # Do some stuff with your connection
41
+ end
42
+ ```
38
43
 
39
44
  ## Contributing
40
45
 
@@ -1,5 +1,3 @@
1
- require 'active_support/core_ext/array'
2
-
3
1
  module Stillwater
4
2
  class ConnectionNotAvailable < StandardError ; end
5
3
 
@@ -46,7 +44,7 @@ module Stillwater
46
44
  end
47
45
 
48
46
  def checkout
49
- connection_info = available.sample
47
+ connection_info = available.respond_to?(:sample) ? available.sample : available.choice
50
48
  raise ConnectionNotAvailable if connection_info.nil?
51
49
  connection_info[:state] = :in_use
52
50
 
@@ -1,3 +1,3 @@
1
1
  module Stillwater
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/stillwater.gemspec CHANGED
@@ -15,8 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Stillwater::VERSION
17
17
 
18
- gem.add_dependency %q<activesupport>, '~> 2.3.0'
19
-
20
18
  gem.add_development_dependency %q<rake>
21
19
  gem.add_development_dependency %q<rspec>
22
20
  gem.add_development_dependency %q<mocha>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stillwater
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Trae Robrock
@@ -16,26 +16,10 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-07-05 00:00:00 Z
19
+ date: 2012-07-09 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 2
30
- - 3
31
- - 0
32
- version: 2.3.0
33
- name: activesupport
34
- type: :runtime
35
- prerelease: false
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
23
  none: false
40
24
  requirements:
41
25
  - - ">="
@@ -47,9 +31,9 @@ dependencies:
47
31
  name: rake
48
32
  type: :development
49
33
  prerelease: false
50
- requirement: *id002
34
+ requirement: *id001
51
35
  - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
53
37
  none: false
54
38
  requirements:
55
39
  - - ">="
@@ -61,9 +45,9 @@ dependencies:
61
45
  name: rspec
62
46
  type: :development
63
47
  prerelease: false
64
- requirement: *id003
48
+ requirement: *id002
65
49
  - !ruby/object:Gem::Dependency
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
67
51
  none: false
68
52
  requirements:
69
53
  - - ">="
@@ -75,7 +59,7 @@ dependencies:
75
59
  name: mocha
76
60
  type: :development
77
61
  prerelease: false
78
- requirement: *id004
62
+ requirement: *id003
79
63
  description: A simple connection pool, that allows connections to different servers (or anything else)
80
64
  email:
81
65
  - trobrock@gmail.com