event_store 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGQxOGRkYzgyZWQ5N2Q3ODdiOTFlYWE4M2NlNmU1OTk1NWZmMjM1OQ==
4
+ YjUwMzY4MzQwZjE1NGM1M2YxZjYwOTg5ODJiMDFkZWMzMzdmODIzNw==
5
5
  data.tar.gz: !binary |-
6
- MWQ4ZGFhNTFmMzViMDNkZDNlY2YwNTlhZWY0YzlhYzAxOTg5ZWQwNg==
6
+ NmVmOWUwYWVmNWM1ZTdhYzBjYWViZTIzZWY3MzlkNjUyZWY5NjU4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmQyODFhNDViZDViZTcwYjA1NDBjYTY0M2YwNjZlZTAzMWQ1NjUyNzA3ZmM2
10
- YTkxZjI4ZjBhNTk2YjE1MTlhNzQ2YjZlNDhlZGZhOTBjYmYwMmYwYmEyZjhi
11
- MTg5ZThhOWE3OWM1MjY1YzdkYjNiODMxMmFlN2Q2OWExYjQ5Yzc=
9
+ N2I2ZGQ1MmQzM2Q0ZDFmZDFkMjYxMTk1NDcwNzg2MjIzOTNjMDgwMDY3NDZj
10
+ YTAyODczZGNjMGE0ODA2ZTM3NzUwMTk3MGE5M2ZiYWJiNTU2YjAyYjRjMTU0
11
+ NDY4ZDhiOTQxM2Y5ZTFhMDI3ZGQ5ZTQwMjU1Y2U2MjI3OTlkYWU=
12
12
  data.tar.gz: !binary |-
13
- NDk4MTM5ZjUwZmVlYzI4YmVmZmI0NjZjMzM5OGExNjkzMjJkZTQwMjI2OTdh
14
- YTZlODhhYmE1ZGYwYmVkODc4MTY3YzdiYjQ2ZWZmMmE0M2VmNzA5ODBlOGQ0
15
- ZGI4ZDEzYjM1MTAyNGQ5NmQ5OGE4ODYzOTkzODIxMTZjMzA3MjE=
13
+ MGExNTlmYzcwYmQ4ZjMwYTM5M2FiMGVlM2JkYWVkNjEzMTYzZjhkY2I2MmVh
14
+ M2IyZGIyOWE2YTFkMWU0Y2YyMGVkNzBiZjA1YWEwNGVkNmE3ODIzN2I2MGU5
15
+ MjM5MzMzYWQ2NjIzNGM3ZWQxNjIwOWE2ZDhkNGIzNWJiODgxNzA=
@@ -1,3 +1,3 @@
1
1
  module EventStore
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/event_store.rb CHANGED
@@ -47,8 +47,8 @@ module EventStore
47
47
  @redis ||= Redis.new(config_hash)
48
48
  end
49
49
 
50
- def self.local_redis_connect
51
- @redis_connection ||= redis_connect raw_db_config['redis']
50
+ def self.local_redis_config
51
+ @redis_connection ||= raw_db_config['redis']
52
52
  end
53
53
 
54
54
  def self.schema
@@ -74,11 +74,10 @@ module EventStore
74
74
  end
75
75
 
76
76
  def self.postgres(environment = 'test')
77
- local_redis_connect
78
- @adapter = 'postgres'
79
77
  @environment = environment.to_s
78
+ @adapter = 'postgres'
80
79
  @db_config ||= self.db_config
81
- create_db
80
+ custom_config(@db_config, local_redis_config, 'events', environment)
82
81
  end
83
82
 
84
83
  #To find the ip address of vertica on your local box (running in a vm)
@@ -88,12 +87,11 @@ module EventStore
88
87
  #4. the inet address for en0 is what you want
89
88
  #Hint: if it just hangs, you have have the wrong IP
90
89
  def self.vertica(environment = 'test')
91
- local_redis_connect
92
- @adapter = 'vertica'
93
- @environment = environment.to_s
94
- @db_config ||= self.db_config
90
+ @environment = environment.to_s
91
+ @adapter = 'vertica'
92
+ @db_config ||= self.db_config
95
93
  @db_config['host'] ||= ENV['VERTICA_HOST'] || vertica_host
96
- create_db
94
+ custom_config(@db_config, local_redis_config, 'events', environment)
97
95
  end
98
96
 
99
97
  def self.escape_bytea(binary_string)
@@ -109,13 +107,13 @@ module EventStore
109
107
  end
110
108
  end
111
109
 
112
- def self.custom_config(database_config, redis_config, table_name = 'events', envrionment = 'production')
110
+ def self.custom_config(database_config, redis_config, table_name = 'events', environment = 'production')
113
111
  self.redis_connect(redis_config)
114
112
  database_config = database_config.inject({}) {|memo, (k,v)| memo[k.to_s] = v; memo}
115
113
  redis_config = redis_config.inject({}) {|memo, (k,v)| memo[k.to_s] = v; memo}
116
114
 
117
- @adapter = database_config[:adapter].to_s
118
- @environment = envrionment
115
+ @adapter = database_config['adapter'].to_s
116
+ @environment = environment
119
117
  @db_config = database_config
120
118
  @table_name = table_name
121
119
  create_db
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Configuration" do
4
+ it "should do nothing if you try to clear! without a connected db" do
5
+ EventStore.stub(:db).and_return(nil)
6
+ expect {EventStore.clear!}.not_to raise_error
7
+ end
8
+ end
data/spec/spec_helper.rb CHANGED
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  require 'event_store'
21
21
 
22
- EventStore.postgres
22
+ EventStore.vertica
23
23
 
24
24
  RSpec.configure do |config|
25
25
  config.after(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Saieg, John Colvin
@@ -241,6 +241,7 @@ files:
241
241
  - spec/benchmark/memory_profile.rb
242
242
  - spec/benchmark/seed_db.rb
243
243
  - spec/event_store/client_spec.rb
244
+ - spec/event_store/config_spec.rb
244
245
  - spec/event_store/serialized_binary_event_data.txt
245
246
  - spec/event_store/snapshot_spec.rb
246
247
  - spec/event_store/vertica guy notes.txt
@@ -274,6 +275,7 @@ test_files:
274
275
  - spec/benchmark/memory_profile.rb
275
276
  - spec/benchmark/seed_db.rb
276
277
  - spec/event_store/client_spec.rb
278
+ - spec/event_store/config_spec.rb
277
279
  - spec/event_store/serialized_binary_event_data.txt
278
280
  - spec/event_store/snapshot_spec.rb
279
281
  - spec/event_store/vertica guy notes.txt