aggregate_root 0.18.2 → 0.19.0

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: 7be0506905a85654712750f3f0433f49e81578fb
4
- data.tar.gz: 23d13fff39d81b6a004b931da2da4fef89af9a2c
3
+ metadata.gz: 367ccbb494947fa3c5cd994cbecf41375c58701e
4
+ data.tar.gz: 97a6c86b8074cdff743719b2766964d1b94fe97e
5
5
  SHA512:
6
- metadata.gz: 0bfa81ccdeb9a1a58bf730446f21f406bcc48841f50f4c44f47b680a5e921f7def686c5154598dfff1cc5c881156581932a3d7318db4a50485b9ceb9ae24844f
7
- data.tar.gz: 030addff65000f67146e8fee6f7088b829db439a7e23309b61ba9906f383700d2e6eddce76ea18acf88d720e6738c1e75308b2137a7840509713ff677179b2f0
6
+ metadata.gz: 6b72579fe560266eea0e3bbb324bad7f8f8ba96a6850b9cfb19b1246d60924e10a2b526d7002356856a9d65c0e75b66ea6829de6fbc808f7bc1c46b34269a7d7
7
+ data.tar.gz: d3d2cfddb592ee8050820a49a97e31a6bc756b884202b31fcda568d10f8009d285f0dae74fbdc582dbf41a51995b4941791ea79e68129a3f97af76544e367cb4
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
-
4
- gem 'ruby_event_store', path: '../ruby_event_store'
3
+ gem 'ruby_event_store', path: '../ruby_event_store'
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler', '~> 1.15'
23
23
  spec.add_development_dependency 'rake', '~> 10.0'
24
24
  spec.add_development_dependency 'rspec', '~> 3.6'
25
- spec.add_development_dependency 'rails', '~> 4.2'
26
- spec.add_development_dependency 'ruby_event_store', '= 0.18.2'
25
+ spec.add_development_dependency 'rails', '~> 5.1'
26
+ spec.add_development_dependency 'ruby_event_store', '= 0.19.0'
27
27
  spec.add_development_dependency 'mutant-rspec', '~> 0.8.14'
28
28
 
29
29
  spec.add_dependency 'activesupport', '>= 3.0'
@@ -17,14 +17,14 @@ module AggregateRoot
17
17
  events.each do |event|
18
18
  apply(event)
19
19
  end
20
+ @version = events.size - 1
20
21
  @unpublished_events = nil
21
22
  self
22
23
  end
23
24
 
24
25
  def store(stream_name = loaded_from_stream_name, event_store: default_event_store)
25
- unpublished_events.each do |event|
26
- event_store.publish_event(event, stream_name: stream_name)
27
- end
26
+ event_store.publish_events(unpublished_events, stream_name: stream_name, expected_version: version)
27
+ @version += unpublished_events.size
28
28
  @unpublished_events = nil
29
29
  end
30
30
 
@@ -39,6 +39,10 @@ module AggregateRoot
39
39
  @unpublished_events ||= []
40
40
  end
41
41
 
42
+ def version
43
+ @version ||= -1
44
+ end
45
+
42
46
  def apply_strategy
43
47
  DefaultApplyStrategy.new
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module AggregateRoot
2
- VERSION = "0.18.2"
2
+ VERSION = "0.19.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggregate_root
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-18 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.2'
61
+ version: '5.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.2'
68
+ version: '5.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby_event_store
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.18.2
75
+ version: 0.19.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.18.2
82
+ version: 0.19.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mutant-rspec
85
85
  requirement: !ruby/object:Gem::Requirement