rom-event_store 0.0.5 → 0.0.6

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50c037f5dd51b63ad51f6a74d3b8c51e8a9c66a2
4
- data.tar.gz: 029bca73c26580e57ccb5ed9cf01b3d6a0c5a888
3
+ metadata.gz: a5b775b5663f8276f71c0d1d75e88737c147ad37
4
+ data.tar.gz: 64816ddbcb216bafa585d36c1469db032f1dbdff
5
5
  SHA512:
6
- metadata.gz: 00db3cad2e89917967fa39c376293ea4216397dd6f33487efa76c065da0c3cb83725705bcbdf278e8f4200e3a76dc0b799dca721cd58369574854e4413e56ca4
7
- data.tar.gz: 1a2e104343da21a0c7712979444903fa72e626b90d092eb3b2c6553bd4c8f9b693fa1b96c33f150ba73ca54e4d19ce375ff2d056c1f483b80d235e22c6bf0eab
6
+ metadata.gz: 5ce4ab53251102bcfe87379c020ed15425c9213f042758a5dd60b96d70925bbb6cebf3ccd62652abfda77449825b7f29240c1a824302d517885360a87b66b865
7
+ data.tar.gz: 926363dc528991fb4000f4ac34ca5bbae9e9127ef3f63ec5c0d7f74c22a77c76a67e62a163f77afcc47e590d397ad64c50177f7b725f166f404a2c3a12dc95ec
data/.rubocop.yml CHANGED
@@ -29,7 +29,7 @@ Style/AsciiComments:
29
29
  Enabled: false
30
30
 
31
31
  # Allow using braces for value-returning blocks
32
- Style/Blocks:
32
+ Style/BlockDelimiters:
33
33
  Enabled: false
34
34
 
35
35
  # Documentation checked by Inch CI
@@ -48,10 +48,6 @@ Style/Lambda:
48
48
  Style/MultilineBlockChain:
49
49
  Enabled: false
50
50
 
51
- # Even a single escaped slash can be confusing
52
- Style/RegexpLiteral:
53
- MaxSlashes: 0
54
-
55
51
  # Don’t introduce semantic fail/raise distinction
56
52
  Style/SignalException:
57
53
  EnforcedStyle: only_raise
@@ -68,11 +64,6 @@ Style/StringLiterals:
68
64
  Style/TrivialAccessors:
69
65
  Enabled: false
70
66
 
71
- # This is a shim file for those who require 'rom-mongo'
67
+ # Allow rom-sql
72
68
  Style/FileName:
73
- Exclude:
74
- - lib/rom-event_store.rb
75
-
76
- # Rescue modificar is useful sometimes
77
- Style/RescueModifier:
78
- Enabled: false
69
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,21 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-01-26 22:39:39 +0100 using RuboCop version 0.28.0.
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-09-26 17:45:40 +0200 using RuboCop version 0.34.2.
3
4
  # The point is for the user to remove these configuration records
4
5
  # one by one as the offenses are removed from the code base.
5
6
  # Note that changes in the inspected code, or installation of new
6
7
  # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ Metrics/AbcSize:
11
+ Max: 23
12
+
13
+ # Offense count: 17
14
+ # Configuration parameters: AllowURI, URISchemes.
15
+ Metrics/LineLength:
16
+ Max: 118
17
+
18
+ # Offense count: 5
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 17
data/.travis.yml CHANGED
@@ -10,7 +10,7 @@ install:
10
10
  - "wget -nc http://download.geteventstore.com/binaries/EventStore-OSS-Linux-v3.0.3.tar.gz"
11
11
  - "tar -xvzf EventStore-OSS-Linux-v3.0.3.tar.gz"
12
12
  - "mv EventStore-OSS-Linux-v3.0.3 .event_store"
13
- - "cd .event_store && ./run-node.sh --db ./ESData &"
13
+ - "cd .event_store && ./run-node.sh --mem-db &"
14
14
  - "sleep 5"
15
15
  - "./bin/init-es"
16
16
  - "bundle install"
@@ -18,6 +18,8 @@ script: "bundle exec rake ci"
18
18
  rvm:
19
19
  - 2.0
20
20
  - 2.1
21
+ - 2.2
22
+ - 2.3.0
21
23
  - rbx-2
22
24
  - jruby
23
25
  - jruby-head
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
+ ## v0.0.6 - to-be-released
2
+
3
+ ### Changed
4
+
5
+ * Updated to ROM 0.8.0 (solnic & hecrj)
6
+
7
+ [Compare v0.0.5...HEAD](https://github.com/rom-rb/rom-event_store/compare/v0.0.5...HEAD)
8
+
9
+ ## v0.0.5 - 2015-04-08
10
+
11
+ ### Added
12
+
13
+ * Stream identifier to event data
14
+ * Development section to README
15
+ * Executable `bin/init-es` that prepares the Event Store for running specs
16
+
17
+ ### Changed
18
+
19
+ * Official `rom` repository! Yay!
20
+
21
+ ### Fixed
22
+
23
+ * Event dehydration on subscriptions
24
+
25
+ [Compare v0.0.4...v0.0.5](https://github.com/rom-rb/rom-event_store/compare/v0.0.4...v0.0.5)
26
+
1
27
  ## v0.0.4 - 2015-04-05
28
+
2
29
  ### Added
30
+
3
31
  * Asynchronous subscriptions to relations (live and catchup)
4
32
  * Partial reads from a relation (batch reads)
5
33
  * TCP driver as an own gem: [estore](https://github.com/eventstore-rb/estore) (help wanted!!)
@@ -8,13 +36,17 @@
8
36
  [Compare v0.0.3...v0.0.4](https://github.com/rom-rb/rom-event_store/compare/v0.0.3...v0.0.4)
9
37
 
10
38
  ## v0.0.3 - 2015-04-01
39
+
11
40
  ### Added
41
+
12
42
  * [TCP driver](https://github.com/mathieuravaux/eventstore-ruby) to connect and read events from the Event Store
13
43
 
14
44
  [Compare v0.0.2...v0.0.3](https://github.com/rom-rb/rom-event_store/compare/v0.0.2...v0.0.3)
15
45
 
16
46
  ## v0.0.2 - 2015-03-31
47
+
17
48
  ### Added
49
+
18
50
  * Relation through AtomPub API using HTTP
19
51
  * Read all events from a relation
20
52
  * Append events to a relation
@@ -22,4 +54,5 @@
22
54
  [Compare v0.0.1...v0.0.2](https://github.com/rom-rb/rom-event_store/compare/v0.0.1...v0.0.2)
23
55
 
24
56
  ## v0.0.1 - 2015-03-30
57
+
25
58
  Initial release
data/Gemfile CHANGED
@@ -5,12 +5,11 @@ gemspec
5
5
 
6
6
  group :test do
7
7
  gem 'inflecto'
8
- gem 'rom', git: 'https://github.com/rom-rb/rom.git', branch: 'master'
9
8
  gem 'codeclimate-test-reporter', require: false
10
9
  end
11
10
 
12
11
  group :tools do
13
- gem 'rubocop', '~> 0.28.0'
12
+ gem 'rubocop', '~> 0.28'
14
13
  gem 'guard'
15
14
  gem 'guard-rspec'
16
15
  gem 'guard-rubocop'
data/bin/init-es CHANGED
@@ -1,3 +1,15 @@
1
1
  #!/bin/bash
2
2
 
3
- curl -X POST --user admin:changeit 'http://127.0.0.1:2113/projection/$by_category/command/enable' -H 'Content-Length: 0' > /dev/null
3
+ # Set permissions to read unexisting categories
4
+ curl "http://127.0.0.1:2113/streams/\$settings" \
5
+ -i -d @bin/permissions.json \
6
+ --user admin:changeit \
7
+ -H "Content-Type: application/vnd.eventstore.events+json" \
8
+ > /dev/null
9
+
10
+ # Enable $by-category projection
11
+ curl 'http://127.0.0.1:2113/projection/$by_category/command/enable' \
12
+ -X POST \
13
+ --user admin:changeit \
14
+ -H 'Content-Length: 0' \
15
+ > /dev/null
@@ -0,0 +1,22 @@
1
+ [
2
+ {
3
+ "eventId": "7c314750-05e1-439f-b2eb-f5b0e019be72",
4
+ "eventType": "$permissions-updated",
5
+ "data": {
6
+ "$userStreamAcl" : {
7
+ "$r" : "$all",
8
+ "$w" : "$all",
9
+ "$d" : "$all",
10
+ "$mr" : "$all",
11
+ "$mw" : "$all"
12
+ },
13
+ "$systemStreamAcl" : {
14
+ "$r" : "$all",
15
+ "$w" : "$admins",
16
+ "$d" : "$admins",
17
+ "$mr" : "$admins",
18
+ "$mw" : "$admins"
19
+ }
20
+ }
21
+ }
22
+ ]
@@ -1,7 +1,7 @@
1
1
  require 'rom'
2
2
 
3
3
  require 'rom/event_store/version'
4
- require 'rom/event_store/repository'
4
+ require 'rom/event_store/gateway'
5
5
  require 'rom/event_store/relation'
6
6
  require 'rom/event_store/commands'
7
7
 
@@ -9,8 +9,8 @@ module ROM
9
9
  @options = options
10
10
  end
11
11
 
12
- def select(stream)
13
- __new__(stream: stream)
12
+ def select(aggregate)
13
+ __new__(aggregate: aggregate)
14
14
  end
15
15
 
16
16
  def from(id)
@@ -22,8 +22,8 @@ module ROM
22
22
  end
23
23
 
24
24
  def stream
25
- stream = @options[:stream]
26
- stream ? "#{category}-#{stream}" : "$ce-#{category}"
25
+ aggregate = @options[:aggregate]
26
+ aggregate ? "#{category}-#{aggregate}" : "$ce-#{category}"
27
27
  end
28
28
 
29
29
  def events
@@ -35,9 +35,9 @@ module ROM
35
35
  events
36
36
  end
37
37
 
38
- def subscribe(&block)
38
+ def subscribe
39
39
  subscription = @connection.subscription(stream, @options)
40
- subscription.on_event { |event| block.call(dehydrate(event)) }
40
+ subscription.on_event { |event| yield(dehydrate(event)) }
41
41
  subscription.start
42
42
  end
43
43
 
@@ -61,13 +61,16 @@ module ROM
61
61
 
62
62
  def dehydrate(wrapper)
63
63
  event = wrapper.event
64
+ category, aggregate = event.event_stream_id.split('-', 2)
64
65
 
65
66
  {
66
67
  id: Estore::Package.parse_uuid(event.event_id),
67
68
  type: event.event_type,
68
69
  data: event.data,
69
- stream: event.event_stream_id,
70
+ category: category,
71
+ aggregate: aggregate,
70
72
  number: event.event_number,
73
+ position: wrapper.original_event_number,
71
74
  created_at: Time.at(event.created_epoch / 1000)
72
75
  }
73
76
  end
@@ -3,7 +3,7 @@ require 'rom/event_store/dataset'
3
3
 
4
4
  module ROM
5
5
  module EventStore
6
- class Repository < ROM::Repository
6
+ class Gateway < ROM::Gateway
7
7
  def initialize(uri)
8
8
  @connection = Estore::Session.new(*uri.split(':'))
9
9
  @categories = {}
@@ -8,7 +8,7 @@ module ROM
8
8
  def self.inherited(base)
9
9
  super
10
10
 
11
- base.exposed_relations.merge([:subscribe, :from, :limit])
11
+ base.exposed_relations.merge([:select, :subscribe, :from, :limit])
12
12
  end
13
13
  end
14
14
  end
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module EventStore
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'.freeze
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_runtime_dependency 'rom', '~> 0.6'
22
+ spec.add_runtime_dependency 'rom', '~> 0.8.0'
23
23
  spec.add_runtime_dependency 'estore', '~> 0.1.1'
24
24
 
25
25
  spec.add_development_dependency 'bundler'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Héctor Ramón
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-04-08 00:00:00.000000000 Z
12
+ date: 2016-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rom
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.6'
20
+ version: 0.8.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0.6'
27
+ version: 0.8.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: estore
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -100,12 +100,13 @@ files:
100
100
  - README.md
101
101
  - Rakefile
102
102
  - bin/init-es
103
+ - bin/permissions.json
103
104
  - lib/rom-event_store.rb
104
105
  - lib/rom/event_store.rb
105
106
  - lib/rom/event_store/commands.rb
106
107
  - lib/rom/event_store/dataset.rb
108
+ - lib/rom/event_store/gateway.rb
107
109
  - lib/rom/event_store/relation.rb
108
- - lib/rom/event_store/repository.rb
109
110
  - lib/rom/event_store/version.rb
110
111
  - rom-event_store.gemspec
111
112
  homepage: https://github.com/rom-rb/rom-event_store
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  version: '0'
129
130
  requirements: []
130
131
  rubyforge_project:
131
- rubygems_version: 2.4.6
132
+ rubygems_version: 2.2.2
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Event Store support for Ruby Object Mapper