rails-disco 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +68 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3997af248b9c0660541364ffe3bd21f00dd6b017
|
4
|
+
data.tar.gz: 4371df585fc8167fce8c52d09961260e76564096
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 49baf07499aee68eb274f8973e3761d56c734adfe124621a7b8b2f0e705e2f6c0873ac00cdc9dd3f793f71c3ff0aefeaea980393e8785d4e1c90cf1150fb43c8
|
7
|
+
data.tar.gz: efc87f5320f7262bbc89bb8909f4e31dca2e719e72bee8d6864450a9fa56c21d67ee5042d730505604325a57a248ee800fdfcfb60df52c601ce18cd00f10cfd8
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Rails Disco - A distributed party with commands, events and projections
|
2
|
+
|
3
|
+
Rails Disco is a framework on top of the rails framework to provide cqrs and simple event sourcing possibilities to rails.
|
4
|
+
The framework consists out of three main parts, commands, events and projections.
|
5
|
+
|
6
|
+
_Commands_ will be created and executed by actions of your controller, instead of directly manipulating your model. These commands are only the order to do something and after possible validations, the framework executes them by creating an event and finally manipulating the model.
|
7
|
+
|
8
|
+
The _events_ will be all stored in a separate database and also published to all projections, where they can be processed to update the projections model/database
|
9
|
+
|
10
|
+
Finally _projections_ are your representation of your data, they get the events and process them, to get the needed informations for building up their models.
|
11
|
+
|
12
|
+
# Requirements
|
13
|
+
|
14
|
+
* At the moment Rails Disco uses [Rails 4](https://github.com/rails/rails). Maybe it works with Rails 3.2, but we didn't test that.
|
15
|
+
|
16
|
+
* Because Rails Disco relies on [bunny](https://github.com/ruby-amqp/bunny) for sending the events from the domain to the projection, you need [RabbitMQ](http://www.rabbitmq.com/download.html) on your system.
|
17
|
+
|
18
|
+
# Getting Started
|
19
|
+
|
20
|
+
1. Rails Disco depends heavily on [RubyOnRails](http://rubyonrails.org/), so you should install that first if you haven't yet.
|
21
|
+
|
22
|
+
2. Install Rails Disco at the command prompt
|
23
|
+
|
24
|
+
gem install rails-disco
|
25
|
+
|
26
|
+
3. At the command prompt, create a new Rails Disco application.
|
27
|
+
|
28
|
+
drails new myapp
|
29
|
+
|
30
|
+
where "myapp" is the application name.
|
31
|
+
|
32
|
+
(Note: You can also add Rails Disco to an existing rails application. Simply omit the application name and run the command inside your application.)
|
33
|
+
|
34
|
+
4. Change directory to `myapp`, if you haven't yet and migrate the databases:
|
35
|
+
|
36
|
+
cd myapp
|
37
|
+
drails rake db:setup
|
38
|
+
|
39
|
+
This will create the two databases domain and projection (for database details look in config/disco.yml)
|
40
|
+
|
41
|
+
5. If you just want to look a some standard server output, start the drails server. Else go ahead and skip this point.
|
42
|
+
|
43
|
+
drails server
|
44
|
+
|
45
|
+
This will start the domain, the projection and the standard rails server, but you won't see much of the disco yet.
|
46
|
+
|
47
|
+
6. For a humble begin, scaffolding is the way to go. Lets create a simple blog system:
|
48
|
+
|
49
|
+
drails generate scaffold Post title:string text:text
|
50
|
+
|
51
|
+
The syntax is leant to rails' generate style and it basically creates a resource Post with a title and a text attribute.
|
52
|
+
|
53
|
+
7. Before we can start, we need to tell rails that we have some shiny new db. Open up config/database.yml and edit the config for your environment (propably development) to the projection database. So basically:
|
54
|
+
|
55
|
+
- ~~database: db/development.sqlite3~~
|
56
|
+
+ database: db/projection_dev.sqlite3
|
57
|
+
|
58
|
+
8. Now that we have something to rely on, lets see it in action:
|
59
|
+
|
60
|
+
drails server
|
61
|
+
|
62
|
+
9. Go to http://localhost:3000/posts and you'll see an empty list of our posts with a link to create a new one. Go ahead and create one. If you watch the console output, you can see that an event will be created for the creating of the post and will be published to the projection.
|
63
|
+
|
64
|
+
10. If you look at your databases, you see in both of them a table `posts`, which contains your freshly created post. The domain database also contains a table `domain_events`. There you find an event for your post creation. Lets see this in action.
|
65
|
+
|
66
|
+
11. Clear your projection database and restart the server. You will see some console output, where the projection is requesting the missing posts from the domain and there you have your projection database complete again.
|
67
|
+
|
68
|
+
12. Thats it for now, have fun with it. For more informations take a look at the [wiki](https://github.com/hicknhack-software/rails-disco/wiki)
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-disco
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Kranz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: drailties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.0
|
27
|
+
description: Rails Disco is a framework on top of the rails framework to provide cqrs
|
28
|
+
and simple event sourcing possibilities to rails.
|
29
|
+
email: robert.kranz@hicknhack-software.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
homepage: https://github.com/hicknhack-software/rails-disco
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.0.5
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: A distributed party with commands, events and projections
|
59
|
+
test_files: []
|