drailties 0.1.0 → 0.2.0
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 +4 -4
- data/lib/drails/server/domain_server.rb +12 -2
- data/lib/drails/server/projection_servers.rb +10 -3
- data/lib/generators/drails/app/app_generator.rb +4 -0
- data/lib/generators/drails/app/templates/build_validations_registry.rb +15 -2
- data/lib/generators/drails/app/templates/event_source_controller.rb +16 -0
- data/lib/generators/drails/controller/controller_generator.rb +6 -1
- data/lib/generators/drails/controller/templates/controller.rb +12 -3
- data/lib/generators/drails/controller/templates/controller_test.rb +45 -0
- data/lib/generators/drails/model/USAGE +15 -0
- data/lib/generators/drails/model/model_generator.rb +43 -0
- data/lib/generators/drails/projection/USAGE +3 -7
- data/lib/generators/drails/projection/projection_generator.rb +6 -10
- data/lib/generators/drails/projection/templates/domain_projection.rb +5 -1
- data/lib/generators/drails/projection/templates/domain_projection_test.rb +6 -0
- data/lib/generators/drails/projection/templates/projection.rb +5 -1
- data/lib/generators/drails/projection/templates/projection_test.rb +6 -0
- data/lib/generators/drails/scaffold/USAGE +1 -3
- data/lib/generators/drails/scaffold/scaffold_generator.rb +20 -6
- data/lib/generators/drails/scaffold/templates/_eventstream.js.erb +16 -0
- data/lib/rails-disco/version.rb +1 -1
- data/lib/tasks/db.rake +1 -0
- metadata +17 -10
- /data/lib/generators/drails/{projection → model}/templates/domain_model.rb +0 -0
- /data/lib/generators/drails/{projection → model}/templates/model.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8642ab0f98128f69e538d45f9a4debeda51dc9b4
|
4
|
+
data.tar.gz: 1e574718dcefb63cdd7aa34a5438471f490ec775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdb7b28db625797316faa897cd402067622a9ebac2294a1ea45ceb753e7a2601e50d44ced3036c01bd09a76c581096e67eccc45bbdf966fb526377089fe81d1
|
7
|
+
data.tar.gz: 6d22d2cd7f89a0c8a6987d1b8946f2cd43a269c2c76f5b44b16f49a6a5a14092a2779ca344ca510f673a316faa0b5c286c1f4eed4ea9ebef6492fb76640141e6
|
@@ -5,8 +5,18 @@ require 'active_record'
|
|
5
5
|
|
6
6
|
ROOT_DIR ||= ENV['ROOT_DIR']
|
7
7
|
|
8
|
-
ActiveEvent::Autoload.app_path =
|
9
|
-
ActiveDomain::Autoload.app_path =
|
8
|
+
ActiveEvent::Autoload.app_path = ROOT_DIR
|
9
|
+
ActiveDomain::Autoload.app_path = ROOT_DIR
|
10
10
|
|
11
|
+
watchable_dirs = ActiveEvent::Autoload.watchable_dirs.merge ActiveDomain::Autoload.watchable_dirs
|
12
|
+
RELOADER = ActiveSupport::FileUpdateChecker.new([], watchable_dirs) do
|
13
|
+
ActiveEvent::Autoload.reload_module :ValidationsRegistry
|
14
|
+
ActiveDomain::Autoload.reload_module :ProjectionRegistry
|
15
|
+
ActiveEvent::Autoload.reload
|
16
|
+
ActiveDomain::Autoload.reload
|
17
|
+
ActiveEvent::ValidationsRegistry.build
|
18
|
+
end
|
19
|
+
|
20
|
+
ActiveEvent::ValidationsRegistry.build
|
11
21
|
ActiveDomain::Server.base_path = ROOT_DIR
|
12
22
|
ActiveDomain::Server.run
|
@@ -7,9 +7,16 @@ ROOT_DIR ||= ENV['ROOT_DIR']
|
|
7
7
|
WORKER_COUNT = [ENV['WORKER_COUNT'].to_i, 1].max
|
8
8
|
WORKER_NUMBER = ENV['WORKER_NUMBER'].to_i
|
9
9
|
|
10
|
-
ActiveEvent::Autoload.app_path =
|
11
|
-
ActiveProjection::Autoload.app_path =
|
12
|
-
ActiveProjection::Autoload.worker_config = {path:
|
10
|
+
ActiveEvent::Autoload.app_path = ROOT_DIR
|
11
|
+
ActiveProjection::Autoload.app_path = ROOT_DIR
|
12
|
+
ActiveProjection::Autoload.worker_config = {path: ROOT_DIR, count: WORKER_COUNT, number: WORKER_NUMBER}
|
13
13
|
|
14
|
+
watchable_dirs = ActiveEvent::Autoload.watchable_dirs.merge ActiveProjection::Autoload.watchable_dirs
|
15
|
+
RELOADER = ActiveSupport::FileUpdateChecker.new([], watchable_dirs) do
|
16
|
+
ActiveEvent::Autoload.reload_module :ValidationsRegistry
|
17
|
+
ActiveProjection::Autoload.reload_module :ProjectionTypeRegistry
|
18
|
+
ActiveEvent::Autoload.reload
|
19
|
+
ActiveProjection::Autoload.reload
|
20
|
+
end
|
14
21
|
ActiveProjection::Server.base_path = ROOT_DIR
|
15
22
|
ActiveProjection::Server.run
|
@@ -16,6 +16,10 @@ module Drails
|
|
16
16
|
copy_file 'build_validations_registry.rb', File.join('config', 'initializers', 'build_validations_registry.rb')
|
17
17
|
end
|
18
18
|
|
19
|
+
def copy_sse_controller
|
20
|
+
copy_file 'event_source_controller.rb', File.join('app', 'controllers', 'event_source_controller.rb')
|
21
|
+
end
|
22
|
+
|
19
23
|
def add_drails_to_gemfile
|
20
24
|
gem "rails-disco"
|
21
25
|
end
|
@@ -1,5 +1,18 @@
|
|
1
1
|
require 'active_event'
|
2
2
|
require 'active_projection'
|
3
|
-
ActiveEvent::Autoload.app_path = File.expand_path('
|
4
|
-
ActiveProjection::Autoload.app_path = File.expand_path('
|
3
|
+
ActiveEvent::Autoload.app_path = File.expand_path('../../..', __FILE__)
|
4
|
+
ActiveProjection::Autoload.app_path = File.expand_path('../../..', __FILE__)
|
5
|
+
|
6
|
+
watchable_dirs = ActiveEvent::Autoload.watchable_dirs.merge ActiveProjection::Autoload.watchable_dirs
|
7
|
+
RELOADER = ActiveSupport::FileUpdateChecker.new([], watchable_dirs) do
|
8
|
+
ActiveEvent::Autoload.reload_module :ValidationsRegistry
|
9
|
+
ActiveEvent::Autoload.reload
|
10
|
+
ActiveProjection::Autoload.reload
|
11
|
+
ActiveEvent::ValidationsRegistry.build
|
12
|
+
end
|
13
|
+
|
14
|
+
ActionDispatch::Reloader.to_prepare do
|
15
|
+
RELOADER.execute_if_updated
|
16
|
+
end
|
17
|
+
|
5
18
|
ActiveEvent::ValidationsRegistry.build
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class EventSourceController < ApplicationController
|
2
|
+
include ActionController::Live
|
3
|
+
include ActiveEvent::EventSourceServer
|
4
|
+
|
5
|
+
def stream
|
6
|
+
event_connection.start
|
7
|
+
response.headers['Content-Type'] = 'text/event-stream'
|
8
|
+
sse = Reloader::SSE.new(response.stream)
|
9
|
+
subscribe_to event_queue do |delivery_info, properties, body|
|
10
|
+
sse.write({:id => properties.headers['store_id']}, :event => 'refresh')
|
11
|
+
end
|
12
|
+
rescue IOError
|
13
|
+
ensure
|
14
|
+
sse.close
|
15
|
+
end
|
16
|
+
end
|
@@ -4,10 +4,15 @@ module Drails
|
|
4
4
|
class ControllerGenerator < Rails::Generators::ScaffoldControllerGenerator
|
5
5
|
source_root File.expand_path('../templates', __FILE__)
|
6
6
|
hide!
|
7
|
+
remove_hook_for :test_framework
|
8
|
+
|
9
|
+
def create_test_files
|
10
|
+
template "controller_test.rb", File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
|
11
|
+
end
|
7
12
|
|
8
13
|
private
|
9
14
|
def params_string
|
10
|
-
attributes.map{|x| "#{x.name}: params[:#{singular_table_name}][:#{x.name}]" }.join(', ')
|
15
|
+
attributes.map { |x| "#{x.name}: params[:#{singular_table_name}][:#{x.name}]" }.join(', ')
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<% module_namespacing do -%>
|
2
2
|
class <%= controller_class_name %>Controller < ApplicationController
|
3
3
|
before_action :set_<%= singular_table_name %>, only: [:show, :edit]
|
4
|
+
before_action :set_event_id, only: [:index, :show]
|
4
5
|
|
5
6
|
def index
|
6
7
|
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
@@ -19,8 +20,9 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
19
20
|
def create
|
20
21
|
<%= singular_table_name %> = <%= "#{human_name}"%>CreateCommand.new({<%= params_string %>})
|
21
22
|
valid = <%= singular_table_name %>.valid?
|
22
|
-
if valid and Domain.run_command
|
23
|
+
if valid and id = Domain.run_command(<%= singular_table_name %>)
|
23
24
|
flash[:notice] = <%= "'#{human_name} was successfully created.'" %>
|
25
|
+
session[:tmp_event_id] = id
|
24
26
|
redirect_to action: :index
|
25
27
|
else
|
26
28
|
flash[:error] = <%= "'#{human_name} couldn\\'t be created.'" %>
|
@@ -31,8 +33,9 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
31
33
|
def update
|
32
34
|
<%= singular_table_name %> = <%= "#{human_name}"%>UpdateCommand.new({id: params[:id]<%=',' unless params_string == ''%> <%= params_string %>})
|
33
35
|
valid = <%= singular_table_name %>.valid?
|
34
|
-
if valid and Domain.run_command
|
36
|
+
if valid and id = Domain.run_command(<%= singular_table_name %>)
|
35
37
|
flash[:notice] = <%= "'#{human_name} was successfully updated.'" %>
|
38
|
+
session[:tmp_event_id] = id
|
36
39
|
redirect_to action: :show, id: params[:id]
|
37
40
|
else
|
38
41
|
flash[:error] = <%= "'#{human_name} couldn\\'t be updated.'" %>
|
@@ -42,7 +45,8 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
42
45
|
|
43
46
|
def destroy
|
44
47
|
<%= singular_table_name %> = <%= "#{human_name}"%>DeleteCommand.new({id: params[:id]})
|
45
|
-
if Domain.run_command
|
48
|
+
if id = Domain.run_command(<%= singular_table_name %>)
|
49
|
+
session[:tmp_event_id] = id
|
46
50
|
flash[:notice] = <%= "'#{human_name} was successfully deleted.'" %>
|
47
51
|
else
|
48
52
|
flash[:error] = <%= "'#{human_name} couldn\\'t be deleted.'" %>
|
@@ -54,5 +58,10 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
54
58
|
def set_<%= singular_table_name %>
|
55
59
|
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
56
60
|
end
|
61
|
+
|
62
|
+
def set_event_id
|
63
|
+
@event_id = session[:tmp_event_id]
|
64
|
+
session[:tmp_event_id] = nil
|
65
|
+
end
|
57
66
|
end
|
58
67
|
<% end -%>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
<% module_namespacing do -%>
|
4
|
+
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
5
|
+
setup do
|
6
|
+
@<%= singular_table_name %> = <%= table_name %>(:one)
|
7
|
+
end
|
8
|
+
|
9
|
+
test "should get index" do
|
10
|
+
get :index
|
11
|
+
assert_response :success
|
12
|
+
assert_not_nil assigns(:<%= table_name %>)
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should get new" do
|
16
|
+
get :new
|
17
|
+
assert_response :success
|
18
|
+
end
|
19
|
+
|
20
|
+
#test "should create <%= singular_table_name %>" do
|
21
|
+
# #removed for now, because there is no reason to test the post here, cause the projection creates it
|
22
|
+
# #maybe we could test something else here instead
|
23
|
+
#end
|
24
|
+
|
25
|
+
test "should show <%= singular_table_name %>" do
|
26
|
+
get :show, id: <%= "@#{singular_table_name}" %>
|
27
|
+
assert_response :success
|
28
|
+
end
|
29
|
+
|
30
|
+
test "should get edit" do
|
31
|
+
get :edit, id: <%= "@#{singular_table_name}" %>
|
32
|
+
assert_response :success
|
33
|
+
end
|
34
|
+
|
35
|
+
#test "should update <%= singular_table_name %>" do
|
36
|
+
# #removed for now, because there is no reason to test the update here, cause the projection updates it
|
37
|
+
# #maybe we could test something else here instead
|
38
|
+
#end
|
39
|
+
|
40
|
+
#test "should destroy <%= singular_table_name %>" do
|
41
|
+
# #removed for now, because there is no reason to test the destroy here, cause the projection destroys it
|
42
|
+
# #maybe we could test something else here instead
|
43
|
+
#end
|
44
|
+
end
|
45
|
+
<% end -%>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Description:
|
2
|
+
Generates a Model and a Projection for it.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate drails:model Thing [use_domain] [attr1:type, attr2:type]
|
6
|
+
|
7
|
+
This will create if use_domain is false(standard):
|
8
|
+
app/projection/thing_projection.rb
|
9
|
+
app/models/thing.rb
|
10
|
+
db/migrate/create_thing.rb
|
11
|
+
|
12
|
+
This will create if use_domain is true:
|
13
|
+
domain/projection/thing_projection.rb
|
14
|
+
domain/models/thing.rb
|
15
|
+
db/migrate_domain/create_thing.rb
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Drails
|
2
|
+
module Generators
|
3
|
+
class ModelGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
argument :use_domain, type: :string, default: 'false'
|
6
|
+
argument :attributes, type: :array, default: [], banner: "field[:type] field[:type]"
|
7
|
+
|
8
|
+
def create_projection_file
|
9
|
+
if domain?
|
10
|
+
generate 'drails:projection', name, 'true'
|
11
|
+
else
|
12
|
+
generate 'drails:projection', name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_model_file
|
17
|
+
if domain?
|
18
|
+
template 'domain_model.rb', File.join('domain', 'models', domain_ns, "#{file_name}.rb")
|
19
|
+
else
|
20
|
+
template 'model.rb', File.join('app', 'models', class_path, "#{file_name}.rb")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_migration
|
25
|
+
generate 'drails:migration', "create_#{table_name}", use_domain, attributes.map { |x| "#{x.name}:#{x.type}" }.join(' ')
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def domain?
|
30
|
+
@domain ||= !!(/^(true|t|yes|y|1)$/i).match(use_domain)
|
31
|
+
end
|
32
|
+
|
33
|
+
def domain_ns
|
34
|
+
namespace_path = Array.new class_path
|
35
|
+
if namespace_path.empty?
|
36
|
+
namespace_path[0] = 'domain'
|
37
|
+
else
|
38
|
+
namespace_path[-1] += '_domain'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,15 +1,11 @@
|
|
1
1
|
Description:
|
2
|
-
Generates a
|
2
|
+
Generates a projection with handlers for the given events.
|
3
3
|
|
4
4
|
Example:
|
5
|
-
rails generate drails:projection Thing [use_domain]
|
5
|
+
rails generate drails:projection Thing [use_domain] [event1 event2 ...]
|
6
6
|
|
7
7
|
This will create if use_domain is false(standard):
|
8
8
|
app/projection/thing_projection.rb
|
9
|
-
app/models/thing.rb
|
10
|
-
db/migrate/create_thing.rb
|
11
9
|
|
12
10
|
This will create if use_domain is true:
|
13
|
-
domain/projection/thing_projection.rb
|
14
|
-
domain/models/thing.rb
|
15
|
-
db/migrate_domain/create_thing.rb
|
11
|
+
domain/projection/thing_projection.rb
|
@@ -3,28 +3,24 @@ module Drails
|
|
3
3
|
class ProjectionGenerator < Rails::Generators::NamedBase
|
4
4
|
source_root File.expand_path('../templates', __FILE__)
|
5
5
|
argument :use_domain, type: :string, default: 'false'
|
6
|
-
argument :
|
6
|
+
argument :events, type: :array, default: [], banner: "event event"
|
7
7
|
|
8
8
|
def create_projection_file
|
9
9
|
if domain?
|
10
|
-
template 'domain_projection.rb', File.join('domain', 'projections', domain_ns, "#{
|
10
|
+
template 'domain_projection.rb', File.join('domain', 'projections', domain_ns, "#{plural_file_name}_projection.rb")
|
11
11
|
else
|
12
|
-
template 'projection.rb', File.join('app', 'projections', class_path, "#{
|
12
|
+
template 'projection.rb', File.join('app', 'projections', class_path, "#{plural_file_name}_projection.rb")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def create_test_files
|
17
17
|
if domain?
|
18
|
-
template '
|
18
|
+
template 'domain_projection_test.rb', File.join("test/projections", class_path, "#{plural_file_name}_projection_test.rb")
|
19
19
|
else
|
20
|
-
template '
|
20
|
+
template 'projection_test.rb', File.join("test/projections", class_path, "#{plural_file_name}_projection_test.rb")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def create_migration
|
25
|
-
generate 'drails:migration', "create_#{table_name}", use_domain, attributes.map { |x| "#{x.name}:#{x.type}" }.join(' ')
|
26
|
-
end
|
27
|
-
|
28
24
|
private
|
29
25
|
def domain?
|
30
26
|
@domain ||= !!(/^(true|t|yes|y|1)$/i).match(use_domain)
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module <%=if Rails::Generators.namespace.present? then Rails::Generators.namespace.name end%>Domain
|
2
|
-
class <%=
|
2
|
+
class <%= plural_name.camelcase %>Projection
|
3
3
|
include ActiveDomain::Projection
|
4
|
+
<% events.each do |event| %>
|
5
|
+
def <%=event.underscore%>(event)
|
6
|
+
end
|
7
|
+
<% end %>
|
4
8
|
end
|
5
9
|
end
|
@@ -3,7 +3,7 @@ Description:
|
|
3
3
|
commands, events and command_processor.
|
4
4
|
|
5
5
|
Example:
|
6
|
-
rails generate drails:scaffold Thing
|
6
|
+
rails generate drails:scaffold Thing [attr1:type, attr2:type]
|
7
7
|
|
8
8
|
This will create:
|
9
9
|
app/commands/thing_create_command.rb
|
@@ -24,6 +24,4 @@ Example:
|
|
24
24
|
db/migrate/create_thing.rb
|
25
25
|
db/migrate_domain/create_thing.rb
|
26
26
|
domain/command_processors/thing_processor.rb
|
27
|
-
domain/models/thing.rb
|
28
|
-
domain/projections/thing_projection.rb
|
29
27
|
a resource route
|
@@ -4,9 +4,8 @@ module Drails
|
|
4
4
|
source_root File.expand_path('../templates', __FILE__)
|
5
5
|
argument :attributes, type: :array, default: [], banner: "field[:type] field[:type]"
|
6
6
|
|
7
|
-
def
|
8
|
-
generate 'drails:
|
9
|
-
generate 'drails:projection', name, 'true', attr_string
|
7
|
+
def create_models
|
8
|
+
generate 'drails:model', name, 'false', attr_string
|
10
9
|
end
|
11
10
|
|
12
11
|
def create_commands
|
@@ -18,6 +17,12 @@ module Drails
|
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
20
|
+
def add_to_command_processor
|
21
|
+
content = "
|
22
|
+
command.id = ActiveDomain::UniqueCommandIdRepository.new_for command.class.name"
|
23
|
+
inject_into_file File.join('domain', 'command_processors', domain_ns, "#{file_name}_processor.rb"), content, after: /(\s)*process(\s)*(.)*CreateCommand(.)*/
|
24
|
+
end
|
25
|
+
|
21
26
|
def add_route
|
22
27
|
route "resources :#{plural_name}"
|
23
28
|
end
|
@@ -26,6 +31,16 @@ module Drails
|
|
26
31
|
generate 'drails:controller', name, attr_string
|
27
32
|
end
|
28
33
|
|
34
|
+
def copy_event_stream_client
|
35
|
+
copy_file '_eventstream.js.erb', File.join('app', 'views', plural_file_name, '_eventstream.js.erb')
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_event_stram_client_to_views
|
39
|
+
include_text = '<%= javascript_tag render partial: \'eventstream\', formats: [:js], locals: {event_id: @event_id} %>'
|
40
|
+
prepend_to_file File.join('app', 'views', plural_file_name, 'index.html.erb'), include_text
|
41
|
+
prepend_to_file File.join('app', 'views', plural_file_name, 'show.html.erb'), include_text
|
42
|
+
end
|
43
|
+
|
29
44
|
private
|
30
45
|
def attr_string
|
31
46
|
@attr_string ||= attributes.map { |x| "#{x.name}:#{x.type}" }.join(' ')
|
@@ -34,11 +49,10 @@ module Drails
|
|
34
49
|
def add_to_projections(action)
|
35
50
|
content = "
|
36
51
|
|
37
|
-
def #{name}_#{action}_event(event)
|
52
|
+
def #{name.underscore}_#{action}_event(event)
|
38
53
|
#{method_bodies[action]}
|
39
54
|
end"
|
40
|
-
inject_into_file File.join('app', 'projections', class_path, "#{
|
41
|
-
inject_into_file File.join('domain', 'projections', domain_ns, "#{file_name}_projection.rb"), content, after: /(\s)*include(\s)*ActiveDomain::Projection/
|
55
|
+
inject_into_file File.join('app', 'projections', class_path, "#{plural_file_name}_projection.rb"), content, after: /(\s)*include(\s)*ActiveProjection::ProjectionType/
|
42
56
|
end
|
43
57
|
|
44
58
|
def method_bodies
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% if event_id.present? %>
|
2
|
+
$(document).ready(function () {
|
3
|
+
setTimeout(function () {
|
4
|
+
var source = new EventSource('/event_stream');
|
5
|
+
source.addEventListener('refresh', function (e) {
|
6
|
+
var event = JSON.parse(e.data);
|
7
|
+
if (<%= event_id %> == event.id){
|
8
|
+
window.location.reload();
|
9
|
+
}else if (<%= event_id %> < event.id){
|
10
|
+
source.removeEventListener('refresh');
|
11
|
+
source.close();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
}, 1);
|
15
|
+
});
|
16
|
+
<% end %>
|
data/lib/rails-disco/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -86,6 +86,7 @@ namespace :db do
|
|
86
86
|
task :setup_domain do
|
87
87
|
Rake::Task[:'db:configuration'].invoke('domain')
|
88
88
|
cp_r Gem::Specification.find_by_name('active_event').gem_dir + '/db/migrate/.', 'db/migrate_domain'
|
89
|
+
cp_r Gem::Specification.find_by_name('active_domain').gem_dir + '/db/migrate/.', 'db/migrate_domain'
|
89
90
|
Rake::Task[:'db:migrate'].invoke
|
90
91
|
end
|
91
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drailties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Kranz
|
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,42 +16,42 @@ 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: active_domain
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: active_projection
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/generators/drails/app/templates/build_validations_registry.rb
|
87
87
|
- lib/generators/drails/app/templates/create_domain.rb
|
88
88
|
- lib/generators/drails/app/templates/disco.yml
|
89
|
+
- lib/generators/drails/app/templates/event_source_controller.rb
|
89
90
|
- lib/generators/drails/app/USAGE
|
90
91
|
- lib/generators/drails/command/command_generator.rb
|
91
92
|
- lib/generators/drails/command/templates/command.rb
|
@@ -96,17 +97,23 @@ files:
|
|
96
97
|
- lib/generators/drails/command_processor/USAGE
|
97
98
|
- lib/generators/drails/controller/controller_generator.rb
|
98
99
|
- lib/generators/drails/controller/templates/controller.rb
|
100
|
+
- lib/generators/drails/controller/templates/controller_test.rb
|
99
101
|
- lib/generators/drails/controller/USAGE
|
100
102
|
- lib/generators/drails/migration/migration_generator.rb
|
101
103
|
- lib/generators/drails/migration/templates/create_table_migration.rb
|
102
104
|
- lib/generators/drails/migration/USAGE
|
105
|
+
- lib/generators/drails/model/model_generator.rb
|
106
|
+
- lib/generators/drails/model/templates/domain_model.rb
|
107
|
+
- lib/generators/drails/model/templates/model.rb
|
108
|
+
- lib/generators/drails/model/USAGE
|
103
109
|
- lib/generators/drails/projection/projection_generator.rb
|
104
|
-
- lib/generators/drails/projection/templates/domain_model.rb
|
105
110
|
- lib/generators/drails/projection/templates/domain_projection.rb
|
106
|
-
- lib/generators/drails/projection/templates/
|
111
|
+
- lib/generators/drails/projection/templates/domain_projection_test.rb
|
107
112
|
- lib/generators/drails/projection/templates/projection.rb
|
113
|
+
- lib/generators/drails/projection/templates/projection_test.rb
|
108
114
|
- lib/generators/drails/projection/USAGE
|
109
115
|
- lib/generators/drails/scaffold/scaffold_generator.rb
|
116
|
+
- lib/generators/drails/scaffold/templates/_eventstream.js.erb
|
110
117
|
- lib/generators/drails/scaffold/USAGE
|
111
118
|
- lib/rails-disco/version.rb
|
112
119
|
- lib/tasks/db.rake
|
File without changes
|
File without changes
|