rubberband 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ An ElasticSearch client with ThriftClient-like failover handling.
5
5
 
6
6
  == License
7
7
 
8
- Copyright 2010 Grant Rodgers. See included LICENSE file.
8
+ Copyright 2010-2011 Grant Rodgers. See included LICENSE file.
9
9
 
10
10
  == Features
11
11
 
@@ -6,12 +6,18 @@ module ElasticSearch
6
6
  class HTTP < Base
7
7
 
8
8
  DEFAULTS = {
9
- :timeout => 5
9
+ :timeout => 5,
10
+ :protocol => 'http'
10
11
  }.freeze
11
12
 
12
13
  def initialize(server, options={})
13
14
  super
14
15
  @options = DEFAULTS.merge(@options)
16
+
17
+ # Make sure the server starts with a URI scheme.
18
+ unless @server =~ /^(([^:\/?#]+):)?\/\//
19
+ @server = "#{@options[:protocol]}://" + @server
20
+ end
15
21
  end
16
22
 
17
23
  def connect!
@@ -1,3 +1,3 @@
1
1
  module ElasticSearch
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,15 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe ElasticSearch::Transport::HTTP do
4
+
5
+ context "no uri scheme" do
6
+ let(:server) { '127.0.0.1:9200' }
7
+ it 'should prepend the default scheme' do
8
+ described_class.new(server).instance_variable_get('@server').should =~ /^http:\/\//
9
+ end
10
+
11
+ it 'should make default protocol configurable' do
12
+ described_class.new(server, :protocol => 'https').instance_variable_get('@server').should =~ /^https:\/\//
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubberband
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Rodgers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-28 00:00:00 Z
18
+ date: 2011-08-22 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: patron
@@ -156,7 +156,6 @@ files:
156
156
  - .rspec
157
157
  - CONTRIBUTORS
158
158
  - Gemfile
159
- - Gemfile.lock
160
159
  - LICENSE
161
160
  - README.rdoc
162
161
  - Rakefile
@@ -190,6 +189,7 @@ files:
190
189
  - spec/bulk_spec.rb
191
190
  - spec/connect_spec.rb
192
191
  - spec/hits_spec.rb
192
+ - spec/http_spec.rb
193
193
  - spec/index_spec.rb
194
194
  - spec/spec_helper.rb
195
195
  - spec/type_spec.rb
@@ -232,6 +232,7 @@ test_files:
232
232
  - spec/bulk_spec.rb
233
233
  - spec/connect_spec.rb
234
234
  - spec/hits_spec.rb
235
+ - spec/http_spec.rb
235
236
  - spec/index_spec.rb
236
237
  - spec/spec_helper.rb
237
238
  - spec/type_spec.rb
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rubberband (0.1.2)
5
- patron
6
- yajl-ruby
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- diff-lcs (1.1.2)
12
- mocha (0.9.12)
13
- patron (0.4.12)
14
- rake (0.9.2)
15
- rspec (2.5.0)
16
- rspec-core (~> 2.5.0)
17
- rspec-expectations (~> 2.5.0)
18
- rspec-mocks (~> 2.5.0)
19
- rspec-core (2.5.1)
20
- rspec-expectations (2.5.0)
21
- diff-lcs (~> 1.1.2)
22
- rspec-mocks (2.5.0)
23
- simplecov (0.4.1)
24
- simplecov-html (~> 0.4.3)
25
- simplecov-html (0.4.3)
26
- yajl-ruby (0.8.2)
27
- yard (0.7.2)
28
-
29
- PLATFORMS
30
- ruby
31
-
32
- DEPENDENCIES
33
- bundler (~> 1.0.0)
34
- mocha (~> 0.9.0)
35
- patron (~> 0.4.12)
36
- rake (~> 0.9.2)
37
- rspec (~> 2.0)
38
- rubberband!
39
- simplecov (>= 0.3.8)
40
- yard (>= 0.7.0)