drailties 0.4.3 → 0.5.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +6 -14
  2. data/bin/drails +4 -42
  3. data/lib/drails/app_drails_loader.rb +62 -0
  4. data/lib/drails/cli.rb +11 -0
  5. data/lib/drails/commands/application.rb +43 -0
  6. data/lib/drails/commands/destroy.rb +12 -0
  7. data/lib/drails/commands/domainserver.rb +6 -0
  8. data/lib/drails/commands/generate.rb +12 -0
  9. data/lib/drails/commands/projectionserver.rb +9 -0
  10. data/lib/drails/commands/server.rb +22 -0
  11. data/lib/drails/commands.rb +70 -0
  12. data/lib/drails/generators.rb +48 -0
  13. data/lib/drails/server/domain_server.rb +4 -1
  14. data/lib/drails/server/projection_servers.rb +5 -2
  15. data/lib/generators/drails/app/USAGE +12 -12
  16. data/lib/generators/drails/app/app_generator.rb +134 -52
  17. data/lib/generators/drails/app/templates/{event_source_controller.rb → app/controllers/event_source_controller.rb} +15 -15
  18. data/lib/generators/drails/app/templates/bin/drails +3 -0
  19. data/lib/generators/drails/app/templates/config/disco.yml +27 -0
  20. data/lib/generators/drails/app/templates/{build_validations_registry.rb → config/initializers/build_validations_registry.rb} +18 -18
  21. data/lib/generators/drails/app/templates/{create_domain.rb → config/initializers/create_domain.rb} +4 -4
  22. data/lib/generators/drails/app/templates/db/seeds.rb +14 -0
  23. data/lib/generators/drails/command/USAGE +11 -11
  24. data/lib/generators/drails/command/command_generator.rb +68 -40
  25. data/lib/generators/drails/command/templates/command.rb +24 -6
  26. data/lib/generators/drails/command/templates/event.rb +11 -10
  27. data/lib/generators/drails/command_processor/USAGE +1 -1
  28. data/lib/generators/drails/command_processor/command_processor_generator.rb +22 -15
  29. data/lib/generators/drails/command_processor/templates/command_processor.rb +5 -5
  30. data/lib/generators/drails/domain.rb +18 -18
  31. data/lib/generators/drails/event_name.rb +51 -51
  32. data/lib/generators/drails/migration/USAGE +41 -1
  33. data/lib/generators/drails/migration/migration_generator.rb +27 -28
  34. data/lib/generators/drails/migration/templates/create_table_migration.rb +19 -19
  35. data/lib/generators/drails/model/USAGE +17 -17
  36. data/lib/generators/drails/model/model_generator.rb +29 -23
  37. data/lib/generators/drails/model/templates/domain_model.rb +5 -5
  38. data/lib/generators/drails/model/templates/model.rb +4 -4
  39. data/lib/generators/drails/processor_name.rb +47 -47
  40. data/lib/generators/drails/projection/projection_generator.rb +3 -3
  41. data/lib/generators/drails/projection/templates/domain_projection.rb +9 -9
  42. data/lib/generators/drails/projection/templates/domain_projection_test.rb +6 -6
  43. data/lib/generators/drails/projection/templates/projection.rb +9 -9
  44. data/lib/generators/drails/projection/templates/projection_test.rb +6 -6
  45. data/lib/generators/drails/scaffold/USAGE +26 -26
  46. data/lib/generators/drails/scaffold/scaffold_generator.rb +91 -89
  47. data/lib/generators/drails/scaffold/templates/_eventstream.js.erb +15 -15
  48. data/lib/generators/drails/{controller → scaffold_controller}/USAGE +1 -1
  49. data/lib/generators/drails/{controller/controller_generator.rb → scaffold_controller/scaffold_controller_generator.rb} +27 -26
  50. data/lib/generators/drails/scaffold_controller/templates/controller.rb +68 -0
  51. data/lib/generators/drails/{controller → scaffold_controller}/templates/controller_test.rb +45 -45
  52. data/lib/generators/drails/use_domain_option.rb +53 -53
  53. data/lib/rails-disco/version.rb +3 -3
  54. data/lib/tasks/db.rake +187 -88
  55. metadata +33 -27
  56. data/lib/drails/application.rb +0 -8
  57. data/lib/drails/domainserver.rb +0 -5
  58. data/lib/drails/generate.rb +0 -21
  59. data/lib/drails/projectionserver.rb +0 -8
  60. data/lib/drails/server.rb +0 -18
  61. data/lib/generators/drails/app/templates/disco.yml +0 -54
  62. data/lib/generators/drails/controller/templates/controller.rb +0 -67
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.3
4
+ version: 0.5.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kranz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-18 00:00:00.000000000 Z
11
+ date: 2014-03-10 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.4.3
19
+ version: 0.5.0.pre
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.4.3
26
+ version: 0.5.0.pre
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.4.3
33
+ version: 0.5.0.pre
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.4.3
40
+ version: 0.5.0.pre
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.4.3
47
+ version: 0.5.0.pre
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.4.3
54
+ version: 0.5.0.pre
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,25 +66,32 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 4.0.0
69
- description: ! 'Internals: rake tasks, generators, commandline interface'
69
+ description: 'Internals: rake tasks, generators, commandline interface'
70
70
  email: rails-disco@hicknhack-software.com
71
71
  executables:
72
72
  - drails
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - lib/drails/application.rb
77
- - lib/drails/domainserver.rb
78
- - lib/drails/generate.rb
79
- - lib/drails/projectionserver.rb
76
+ - lib/drails/app_drails_loader.rb
77
+ - lib/drails/cli.rb
78
+ - lib/drails/commands/application.rb
79
+ - lib/drails/commands/destroy.rb
80
+ - lib/drails/commands/domainserver.rb
81
+ - lib/drails/commands/generate.rb
82
+ - lib/drails/commands/projectionserver.rb
83
+ - lib/drails/commands/server.rb
84
+ - lib/drails/commands.rb
85
+ - lib/drails/generators.rb
80
86
  - lib/drails/server/domain_server.rb
81
87
  - lib/drails/server/projection_servers.rb
82
- - lib/drails/server.rb
83
88
  - lib/generators/drails/app/app_generator.rb
84
- - lib/generators/drails/app/templates/build_validations_registry.rb
85
- - lib/generators/drails/app/templates/create_domain.rb
86
- - lib/generators/drails/app/templates/disco.yml
87
- - lib/generators/drails/app/templates/event_source_controller.rb
89
+ - lib/generators/drails/app/templates/app/controllers/event_source_controller.rb
90
+ - lib/generators/drails/app/templates/bin/drails
91
+ - lib/generators/drails/app/templates/config/disco.yml
92
+ - lib/generators/drails/app/templates/config/initializers/build_validations_registry.rb
93
+ - lib/generators/drails/app/templates/config/initializers/create_domain.rb
94
+ - lib/generators/drails/app/templates/db/seeds.rb
88
95
  - lib/generators/drails/app/USAGE
89
96
  - lib/generators/drails/command/command_generator.rb
90
97
  - lib/generators/drails/command/templates/command.rb
@@ -93,10 +100,6 @@ files:
93
100
  - lib/generators/drails/command_processor/command_processor_generator.rb
94
101
  - lib/generators/drails/command_processor/templates/command_processor.rb
95
102
  - lib/generators/drails/command_processor/USAGE
96
- - lib/generators/drails/controller/controller_generator.rb
97
- - lib/generators/drails/controller/templates/controller.rb
98
- - lib/generators/drails/controller/templates/controller_test.rb
99
- - lib/generators/drails/controller/USAGE
100
103
  - lib/generators/drails/domain.rb
101
104
  - lib/generators/drails/event_name.rb
102
105
  - lib/generators/drails/migration/migration_generator.rb
@@ -116,6 +119,10 @@ files:
116
119
  - lib/generators/drails/scaffold/scaffold_generator.rb
117
120
  - lib/generators/drails/scaffold/templates/_eventstream.js.erb
118
121
  - lib/generators/drails/scaffold/USAGE
122
+ - lib/generators/drails/scaffold_controller/scaffold_controller_generator.rb
123
+ - lib/generators/drails/scaffold_controller/templates/controller.rb
124
+ - lib/generators/drails/scaffold_controller/templates/controller_test.rb
125
+ - lib/generators/drails/scaffold_controller/USAGE
119
126
  - lib/generators/drails/use_domain_option.rb
120
127
  - lib/rails-disco/railtie.rb
121
128
  - lib/rails-disco/tasks.rb
@@ -135,19 +142,18 @@ require_paths:
135
142
  - lib
136
143
  required_ruby_version: !ruby/object:Gem::Requirement
137
144
  requirements:
138
- - - ! '>='
145
+ - - '>='
139
146
  - !ruby/object:Gem::Version
140
147
  version: '0'
141
148
  required_rubygems_version: !ruby/object:Gem::Requirement
142
149
  requirements:
143
- - - ! '>='
150
+ - - '>'
144
151
  - !ruby/object:Gem::Version
145
- version: '0'
152
+ version: 1.3.1
146
153
  requirements: []
147
154
  rubyforge_project:
148
- rubygems_version: 2.0.3
155
+ rubygems_version: 2.1.11
149
156
  signing_key:
150
157
  specification_version: 4
151
158
  summary: Tools for working with Rails Disco
152
159
  test_files: []
153
- has_rdoc:
@@ -1,8 +0,0 @@
1
- require 'rails/generators'
2
- require 'rails/generators/rails/app/app_generator'
3
-
4
- Rails::Generators::AppGenerator.start
5
-
6
- ROOT_DIR = Dir.pwd
7
- ARGV.unshift 'app'
8
- require 'drails/generate'
@@ -1,5 +0,0 @@
1
- puts 'Starting Domain Command Server'
2
- puts '=> Ctrl-C to shutdown domain server'
3
- trap(:INT) { exit }
4
- Process.spawn({"ROOT_DIR" => ROOT_DIR}, "ruby #{File.expand_path '../server', __FILE__}/domain_server.rb")
5
- Process.waitall
@@ -1,21 +0,0 @@
1
- require 'rails/generators'
2
-
3
- if [nil, "-h", "--help"].include?(ARGV.first)
4
- puts "Usage: drails generate GENERATOR [args] [options]"
5
- puts
6
- puts "General options:"
7
- puts " -h, [--help] # Print generator's options and usage"
8
- puts " -p, [--pretend] # Run but do not make any changes"
9
- puts " -f, [--force] # Overwrite files that already exist"
10
- puts " -s, [--skip] # Skip files that already exist"
11
- puts " -q, [--quiet] # Suppress status output"
12
- puts
13
- puts "Please choose a generator below."
14
- puts
15
- puts "Scaffold"
16
- puts "Command"
17
- puts "Projection"
18
- exit(1)
19
- end
20
-
21
- Rails::Generators.invoke "drails:#{ARGV.shift}", ARGV, behavior: :invoke, destination_root: ROOT_DIR
@@ -1,8 +0,0 @@
1
- puts 'Starting Projection Server'
2
- puts '=> Ctrl-C to shutdown projections server'
3
- trap(:INT) { exit }
4
- count = [ARGV.shift.to_i, 1].max
5
- count.times do |i|
6
- Process.spawn({"ROOT_DIR" => ROOT_DIR, "WORKER_COUNT" => count.to_s, "WORKER_NUMBER" => i.to_s}, "ruby #{File.expand_path '../server', __FILE__}/projection_servers.rb")
7
- end
8
- Process.waitall
data/lib/drails/server.rb DELETED
@@ -1,18 +0,0 @@
1
- puts 'Starting domain, projection and Rails server...'
2
- puts '=> Ctrl-C to shutdown all servers'
3
- env = {'ROOT_DIR' => ROOT_DIR}
4
- pids = []
5
- pids << Process.spawn(env, "ruby #{File.expand_path '../server', __FILE__}/domain_server.rb")
6
- pids << Process.spawn(env, "ruby #{File.expand_path '../server', __FILE__}/projection_servers.rb")
7
- pids << Process.spawn(env, 'rails s')
8
- trap(:INT) do
9
- pids.each do |pid|
10
- begin
11
- Process.kill 9, pid
12
- rescue Exception
13
- # do nothing
14
- end
15
- end
16
- exit
17
- end
18
- Process.waitall
@@ -1,54 +0,0 @@
1
- development:
2
- domain_database:
3
- adapter: sqlite3
4
- database: db/domain_dev.sqlite3
5
- pool: 5
6
- timeout: 5000
7
- projection_database:
8
- adapter: sqlite3
9
- database: db/projection_dev.sqlite3
10
- pool: 5
11
- timeout: 5000
12
- drb_server:
13
- scheme: druby
14
- host: 127.0.0.1
15
- port: 8787
16
- event_connection:
17
- scheme: amqp
18
- host: 127.0.0.1
19
- port: 5672
20
- event_exchange: events
21
-
22
- test:
23
- domain_database:
24
- adapter: sqlite3
25
- database: db/domain_test.sqlite3
26
- pool: 5
27
- timeout: 5000
28
- projection_database:
29
- adapter: sqlite3
30
- database: db/projection_test.sqlite3
31
- pool: 5
32
- timeout: 5000
33
-
34
- production:
35
- domain_database:
36
- adapter: sqlite3
37
- database: db/domain.sqlite3
38
- pool: 5
39
- timeout: 5000
40
- projection_database:
41
- adapter: sqlite3
42
- database: db/projection.sqlite3
43
- pool: 5
44
- timeout: 5000
45
- drb_server:
46
- protocol: druby
47
- host: 127.0.0.1
48
- port: 8787
49
- event_connection:
50
- scheme: amqp
51
- userinfo: amqp:password
52
- host: 127.0.0.1
53
- port: 9797
54
- event_exchange: events
@@ -1,67 +0,0 @@
1
- <% module_namespacing do -%>
2
- class <%= controller_class_name %>Controller < ApplicationController
3
- before_action :set_<%= singular_table_name %>, only: [:show, :edit]
4
- before_action :set_event_id, only: [:index, :show]
5
-
6
- def index
7
- @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
8
- end
9
-
10
- def show
11
- end
12
-
13
- def new
14
- @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
15
- end
16
-
17
- def edit
18
- end
19
-
20
- def create
21
- <%= singular_table_name %> = <%= command_class_name('create') %>Command.new({<%= params_string %>})
22
- valid = <%= singular_table_name %>.valid?
23
- if valid and id = Domain.run_command(<%= singular_table_name %>)
24
- flash[:notice] = <%= "'#{human_name} was successfully created.'" %>
25
- session[:tmp_event_id] = id
26
- redirect_to action: :index
27
- else
28
- flash[:error] = <%= "'#{human_name} couldn\\'t be created.'" %>
29
- redirect_to action: :new
30
- end
31
- end
32
-
33
- def update
34
- <%= singular_table_name %> = <%= command_class_name('update') %>Command.new({id: params[:id]<%=',' unless params_string == ''%> <%= params_string %>})
35
- valid = <%= singular_table_name %>.valid?
36
- if valid and id = Domain.run_command(<%= singular_table_name %>)
37
- flash[:notice] = <%= "'#{human_name} was successfully updated.'" %>
38
- session[:tmp_event_id] = id
39
- redirect_to action: :show, id: params[:id]
40
- else
41
- flash[:error] = <%= "'#{human_name} couldn\\'t be updated.'" %>
42
- redirect_to action: :edit, id: params[:id]
43
- end
44
- end
45
-
46
- def destroy
47
- <%= singular_table_name %> = <%= command_class_name('delete') %>Command.new({id: params[:id]})
48
- if id = Domain.run_command(<%= singular_table_name %>)
49
- session[:tmp_event_id] = id
50
- flash[:notice] = <%= "'#{human_name} was successfully deleted.'" %>
51
- else
52
- flash[:error] = <%= "'#{human_name} couldn\\'t be deleted.'" %>
53
- end
54
- redirect_to action: :index
55
- end
56
-
57
- private
58
- def set_<%= singular_table_name %>
59
- @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
60
- end
61
-
62
- def set_event_id
63
- @event_id = session[:tmp_event_id]
64
- session[:tmp_event_id] = nil
65
- end
66
- end
67
- <% end -%>