cellect-client 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25cd4b1c3dddd7081dced26beddbcb40a43699d6
4
- data.tar.gz: e5c95935662e60dd278aa6f5c9533e89e4d14a4d
3
+ metadata.gz: d7f53935b9eef4548e6e3887e48350be43f639be
4
+ data.tar.gz: 8e397e85876ea09b375aff057656dcb4ef78ef41
5
5
  SHA512:
6
- metadata.gz: d35b6f6acfd1e15b2462844b66d2c00f3dd2679a4ea321c7e9ced9929ac981e2cd83b514df354dde383f4a23aa3286c4dd62ac11c7d1d28efef91cdc829d4d70
7
- data.tar.gz: 029cb970efb2c7397a03852b37c7b9d21ce03e7982ac4ace97f8df55d3f4b545d2c7abc94e233479db69b2527c4f16d6c7e20b9adbe3873f070d500de9abed18
6
+ metadata.gz: e98b91839414e7bdc54ad16b5feaf3788d0bc0d5a3701977b20bdcb4cf55260a024d33f9c77e58d2bcf21a2b44506cdaf1a881fb694e1fbe5a87e793aeba76a2
7
+ data.tar.gz: a5243534696310ee3618c4168ca929eecc3e7d5ee307b01ff26334b32d2ffef58abace65a23e3e009d0e0240697cb77f7ac8b9c5d8c0a2e3959309f7881317f6
data/README.md CHANGED
@@ -4,9 +4,9 @@ This is a work in progress
4
4
 
5
5
  ## Building
6
6
 
7
- 1. Install [Boost](http://www.boost.org/): OS X: `brew update && brew install boost`, Ubuntu: `sudo apt-get update && sudo apt-get install libboost-all-dev`
7
+ 1. Install [Boost V1.55](http://www.boost.org/): OS X: `brew update && brew install boost`, Ubuntu: `sudo apt-get update && sudo apt-get install libboost-all-dev`
8
8
  2. Install gem dependencies: `bundle` (See Note)
9
- 3. Build extension: `cd ext; ruby extconf.rb; make; cd ..`
9
+
10
10
 
11
11
  ### Note
12
12
  To install rice your Ruby must be compiled with shared libraries enabled, from the rice docs:
@@ -1,5 +1,5 @@
1
1
  module Cellect
2
- module Client
2
+ module Client
3
3
  class ConfigurationError < StandardError; end;
4
4
 
5
5
  class CellectRailtie < Rails::Railtie
@@ -9,18 +9,18 @@ module Cellect
9
9
  ensure_config_environment config
10
10
  config = config[Rails.env].symbolize_keys
11
11
  ensure_config_url config
12
-
13
- Client.node_set config[:zk_url]
14
- Client.connection = Connection.pool size: config.fetch(:pool_size, 100)
12
+ connect_zookeeper config if Client.mock_zookeeper?
15
13
  end
16
14
 
15
+ private
16
+
17
17
  def config_file
18
18
  Rails.root.join 'config/cellect.yml'
19
19
  end
20
20
 
21
21
  def ensure_config_file
22
22
  return if File.exists?(config_file)
23
- raise ConfigurationError.new "No configuration file found. Create config/cellect.yml first"
23
+ raise ConfigurationError.new 'No configuration file found. Create config/cellect.yml first'
24
24
  end
25
25
 
26
26
  def ensure_config_environment(yaml)
@@ -32,6 +32,11 @@ module Cellect
32
32
  return if hash[:zk_url].present?
33
33
  raise ConfigurationError.new "No Zookeeper URL provided for #{ Rails.env } environment"
34
34
  end
35
+
36
+ def connect_zookeeper(config)
37
+ Client.node_set config[:zk_url]
38
+ Client.connection = Connection.pool size: config.fetch(:pool_size, 100)
39
+ end
35
40
  end
36
41
  end
37
42
  end
@@ -22,6 +22,10 @@ module Cellect
22
22
  node_set.nodes.values.sample
23
23
  end
24
24
 
25
+ def self.mock_zookeeper?
26
+ false
27
+ end
28
+
25
29
  if defined?(::Rails)
26
30
  require 'cellect/client/railtie'
27
31
  else
@@ -1,17 +1,7 @@
1
1
  module Cellect
2
- class NodeSet
3
- class ZK
4
- def initialize(*args)
5
-
6
- end
7
-
8
- def children(*args)
9
- []
10
- end
11
-
12
- def method_missing(*args, &block)
13
-
14
- end
2
+ module Client
3
+ def self.mock_zookeeper?
4
+ true
15
5
  end
16
6
  end
17
7
  end
@@ -1,3 +1,3 @@
1
1
  module Cellect
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -18,7 +18,6 @@ require 'celluloid/rspec'
18
18
  require 'rack/test'
19
19
  Celluloid.shutdown_timeout = 1
20
20
  Celluloid.logger = nil
21
-
22
21
  Dir["./spec/support/**/*.rb"].sort.each{ |f| require f }
23
22
 
24
23
  Cellect::Server.adapter = SpecAdapter.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellect-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-01 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler