active_domain 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/active_domain/unique_command_id.rb +5 -0
- data/app/models/active_domain/unique_command_id_repository.rb +23 -0
- data/db/migrate/02_create_unique_command_ids.rb +9 -0
- data/lib/active_domain.rb +2 -0
- data/lib/active_domain/autoload.rb +4 -7
- data/lib/active_domain/command_processor.rb +1 -0
- data/lib/active_domain/command_routes.rb +1 -0
- data/lib/active_domain/server.rb +0 -1
- data/lib/active_domain/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7ba08340129529699ef9c88cbfcd40cc3e12906
|
4
|
+
data.tar.gz: b6ec97c204f267ef3ae250b95998106b58dd93cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82d9415210f438c7b98f17a3e3f7b16438b09a499d8d323096e5e6e6433c47a75cdd9cbb3caceddb5aff10be6f065d891de2ab105904468d131981d499e1c7e4
|
7
|
+
data.tar.gz: df0cc6c2652b61237fb639edcb953cc2085740e93a1153262d1a62f54e40a5833f33e79d6db27029c1cdc8e95fd25740cd45dced8fbf2c64ba02ec8a46b76f7f
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActiveDomain
|
2
|
+
class UniqueCommandIdRepository
|
3
|
+
def self.new_for(command_name)
|
4
|
+
@@commands[command_name] ||= create_or_get(command_name)
|
5
|
+
create_new @@commands[command_name]
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
def self.initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.create_or_get(command_name)
|
13
|
+
UniqueCommandId.where(command: command_name).first || UniqueCommandId.create!(command: command_name, last_id: 0)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.create_new(command)
|
17
|
+
command.update! last_id: command.last_id + 1
|
18
|
+
command.last_id
|
19
|
+
end
|
20
|
+
|
21
|
+
@@commands = {}
|
22
|
+
end
|
23
|
+
end
|
data/lib/active_domain.rb
CHANGED
@@ -14,4 +14,6 @@ module ActiveDomain
|
|
14
14
|
|
15
15
|
autoload :Event, (File.expand_path '../../app/models/active_domain/event', __FILE__)
|
16
16
|
autoload :EventRepository, (File.expand_path '../../app/models/active_domain/event_repository',__FILE__)
|
17
|
+
autoload :UniqueCommandId, (File.expand_path '../../app/models/active_domain/unique_command_id', __FILE__)
|
18
|
+
autoload :UniqueCommandIdRepository, (File.expand_path '../../app/models/active_domain/unique_command_id_repository',__FILE__)
|
17
19
|
end
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module ActiveDomain
|
2
2
|
module Autoload
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
dirs << "#{path}/projections/**/*.rb"
|
8
|
-
dirs << "#{path}/models/**/*.rb"
|
9
|
-
ActiveEvent::Support::Autoloader.load_from dirs
|
3
|
+
include ActiveEvent::Support::Autoload
|
4
|
+
private
|
5
|
+
def self.dir_names
|
6
|
+
%W(domain/command_processors domain/validations domain/models domain/projections)
|
10
7
|
end
|
11
8
|
end
|
12
9
|
end
|
data/lib/active_domain/server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_domain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Reischuck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_event
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,9 @@ extra_rdoc_files: []
|
|
128
128
|
files:
|
129
129
|
- app/models/active_domain/event.rb
|
130
130
|
- app/models/active_domain/event_repository.rb
|
131
|
+
- app/models/active_domain/unique_command_id.rb
|
132
|
+
- app/models/active_domain/unique_command_id_repository.rb
|
133
|
+
- db/migrate/02_create_unique_command_ids.rb
|
131
134
|
- lib/active_domain/autoload.rb
|
132
135
|
- lib/active_domain/command_processor.rb
|
133
136
|
- lib/active_domain/command_routes.rb
|