disco-railties 0.5.0.rc1

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 +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +1 -0
  4. data/bin/disco +7 -0
  5. data/bin/drails +3 -0
  6. data/lib/disco/app_disco_loader.rb +62 -0
  7. data/lib/disco/cli.rb +11 -0
  8. data/lib/disco/commands/application.rb +43 -0
  9. data/lib/disco/commands/destroy.rb +12 -0
  10. data/lib/disco/commands/domainserver.rb +6 -0
  11. data/lib/disco/commands/generate.rb +12 -0
  12. data/lib/disco/commands/projectionserver.rb +9 -0
  13. data/lib/disco/commands/server.rb +22 -0
  14. data/lib/disco/commands.rb +70 -0
  15. data/lib/disco/generators.rb +48 -0
  16. data/lib/disco/server/domain_server.rb +26 -0
  17. data/lib/disco/server/projection_servers.rb +26 -0
  18. data/lib/generators/disco/app/USAGE +14 -0
  19. data/lib/generators/disco/app/app_generator.rb +140 -0
  20. data/lib/generators/disco/app/templates/app/controllers/event_source_controller.rb +16 -0
  21. data/lib/generators/disco/app/templates/bin/disco +3 -0
  22. data/lib/generators/disco/app/templates/config/disco.yml +27 -0
  23. data/lib/generators/disco/app/templates/config/initializers/build_validations_registry.rb +19 -0
  24. data/lib/generators/disco/app/templates/config/initializers/create_domain.rb +5 -0
  25. data/lib/generators/disco/app/templates/db/seeds.rb +14 -0
  26. data/lib/generators/disco/command/USAGE +11 -0
  27. data/lib/generators/disco/command/command_generator.rb +69 -0
  28. data/lib/generators/disco/command/templates/command.rb.erb +24 -0
  29. data/lib/generators/disco/command/templates/event.rb.erb +11 -0
  30. data/lib/generators/disco/command_processor/USAGE +1 -0
  31. data/lib/generators/disco/command_processor/command_processor_generator.rb +22 -0
  32. data/lib/generators/disco/command_processor/templates/command_processor.rb +5 -0
  33. data/lib/generators/disco/domain.rb +19 -0
  34. data/lib/generators/disco/event_name.rb +52 -0
  35. data/lib/generators/disco/migration/USAGE +41 -0
  36. data/lib/generators/disco/migration/migration_generator.rb +27 -0
  37. data/lib/generators/disco/migration/templates/create_table_migration.rb +19 -0
  38. data/lib/generators/disco/model/USAGE +17 -0
  39. data/lib/generators/disco/model/model_generator.rb +29 -0
  40. data/lib/generators/disco/model/templates/domain_model.rb +5 -0
  41. data/lib/generators/disco/model/templates/model.rb +5 -0
  42. data/lib/generators/disco/processor_name.rb +48 -0
  43. data/lib/generators/disco/projection/USAGE +13 -0
  44. data/lib/generators/disco/projection/projection_generator.rb +19 -0
  45. data/lib/generators/disco/projection/templates/domain_projection.rb +9 -0
  46. data/lib/generators/disco/projection/templates/domain_projection_test.rb +6 -0
  47. data/lib/generators/disco/projection/templates/projection.rb +9 -0
  48. data/lib/generators/disco/projection/templates/projection_test.rb +6 -0
  49. data/lib/generators/disco/scaffold/USAGE +27 -0
  50. data/lib/generators/disco/scaffold/scaffold_generator.rb +91 -0
  51. data/lib/generators/disco/scaffold/templates/_eventstream.js.erb +16 -0
  52. data/lib/generators/disco/scaffold_controller/USAGE +1 -0
  53. data/lib/generators/disco/scaffold_controller/scaffold_controller_generator.rb +27 -0
  54. data/lib/generators/disco/scaffold_controller/templates/controller.rb +68 -0
  55. data/lib/generators/disco/scaffold_controller/templates/controller_test.rb +45 -0
  56. data/lib/generators/disco/use_domain_option.rb +54 -0
  57. data/lib/rails-disco/railtie.rb +8 -0
  58. data/lib/rails-disco/tasks.rb +1 -0
  59. data/lib/rails-disco/version.rb +10 -0
  60. data/lib/tasks/db.rake +222 -0
  61. data/lib/tasks/split.rake +94 -0
  62. metadata +161 -0
@@ -0,0 +1,68 @@
1
+ <% if namespaced? -%>
2
+ require_dependency '<%= namespaced_file_path %>/application_controller'
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= controller_class_name %>Controller < ApplicationController
7
+ before_action :set_event_id, only: [:index, :show]
8
+
9
+ def index
10
+ @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
11
+ end
12
+
13
+ def show
14
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, 'params[:id]') %>
15
+ end
16
+
17
+ def new
18
+ @<%= singular_table_name %> = <%= command_class_name('create') %>Command.new
19
+ end
20
+
21
+ def edit
22
+ @<%= singular_table_name %> = <%= command_class_name('update') %>Command.new <%= orm_class.find(class_name, 'params[:id]') %>.attributes
23
+ end
24
+
25
+ def create
26
+ @<%= singular_table_name %> = <%= command_class_name('create') %>Command.new <%= singular_table_name %>_params
27
+ if @<%= singular_table_name %>.valid? && (session[:tmp_event_id] = Domain.run_command(@<%= singular_table_name %>))
28
+ redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %>
29
+ else
30
+ render action: 'new'
31
+ end
32
+ end
33
+
34
+ def update
35
+ @<%= singular_table_name %> = <%= command_class_name('update') %>Command.new <%= singular_table_name %>_params.merge(id: params[:id])
36
+ if @<%= singular_table_name %>.valid? && (session[:tmp_event_id] = Domain.run_command(@<%= singular_table_name %>))
37
+ redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %>
38
+ else
39
+ render action: 'edit'
40
+ end
41
+ end
42
+
43
+ def destroy
44
+ delete_<%= singular_table_name %> = <%= command_class_name('delete') %>Command.new(id: params[:id])
45
+ session[:tmp_event_id] = event_id = Domain.run_command(delete_<%= singular_table_name %>)
46
+ if event_id
47
+ redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully destroyed.'" %>
48
+ else
49
+ redirect_to <%= singular_table_name %>_url(id: params[:id]), alert: <%= "'#{human_name} could not be deleted.'" %>
50
+ end
51
+ end
52
+
53
+ private
54
+
55
+ def <%= "#{singular_table_name}_params" %>
56
+ <%- if attributes_names.empty? -%>
57
+ params[<%= ":#{singular_table_name}" %>]
58
+ <%- else -%>
59
+ params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
60
+ <%- end -%>
61
+ end
62
+
63
+ def set_event_id
64
+ @event_id = session[:tmp_event_id]
65
+ session[:tmp_event_id] = nil
66
+ end
67
+ end
68
+ <% 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,54 @@
1
+ require 'active_support/concern'
2
+ require 'generators/disco/domain.rb'
3
+
4
+ module Disco
5
+ module Generators
6
+ module UseDomainOption
7
+ extend ActiveSupport::Concern
8
+
9
+ include Domain
10
+
11
+ included do
12
+ class_option :domain, type: :boolean, default: false, desc: "generate for the domain"
13
+ end
14
+
15
+ protected
16
+
17
+ def use_domain?
18
+ options[:domain]
19
+ end
20
+
21
+ def use_domain(file_name)
22
+ if use_domain?
23
+ "domain_#{file_name}"
24
+ else
25
+ file_name
26
+ end
27
+ end
28
+
29
+ def use_domain_class_path
30
+ if use_domain?
31
+ domain_class_path
32
+ else
33
+ class_path
34
+ end
35
+ end
36
+
37
+ def use_domain_base_path
38
+ if use_domain?
39
+ 'domain'
40
+ else
41
+ 'app'
42
+ end
43
+ end
44
+
45
+ def use_domain_class_file_path(type, file_name)
46
+ File.join use_domain_base_path, type, use_domain_class_path, file_name
47
+ end
48
+
49
+ def use_domain_param
50
+ '--domain' if use_domain?
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,8 @@
1
+ require 'rails/railtie'
2
+ module RailsDisco
3
+ class Railtie < Rails::Railtie
4
+ rake_tasks do
5
+ load "tasks/db.rake"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ require 'rails-disco/railtie' if defined?(Rails)
@@ -0,0 +1,10 @@
1
+ module RailsDisco
2
+ module VERSION
3
+ MAJOR = 0
4
+ MINOR = 5
5
+ TINY = 0
6
+ PRE = "rc1"
7
+
8
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
9
+ end
10
+ end
data/lib/tasks/db.rake ADDED
@@ -0,0 +1,222 @@
1
+ require 'yaml'
2
+ require 'active_record'
3
+
4
+ namespace :disco do
5
+ namespace :db do
6
+ def disco_database_configuration(disco_config, database)
7
+ disco_config.reduce({}) do |map, (key, value)|
8
+ if value.is_a?(Hash) && value.has_key?(database)
9
+ map[key] = value[database]
10
+ end
11
+ map
12
+ end
13
+ end
14
+
15
+ task :load_config => :environment do
16
+ migrate_path = 'db/migrate'
17
+ ActiveRecord::Tasks::DatabaseTasks.db_dir = Rails.application.config.paths['db'].first
18
+ ActiveRecord::Tasks::DatabaseTasks.seed_loader = Rails.application
19
+ ActiveRecord::Base.clear_all_connections!
20
+
21
+ if ENV['SYSTEM'] == 'domain'
22
+ migrate_path = 'db/migrate_domain'
23
+ ActiveRecord::Tasks::DatabaseTasks.env = ENV['DOMAIN_ENV'] || Rails.env
24
+ disco_config = YAML.load_file(File.join Rails.root, 'config', 'disco.yml')
25
+ ActiveRecord::Tasks::DatabaseTasks.database_configuration = disco_database_configuration(disco_config, 'domain_database')
26
+ ActiveRecord::Tasks::DatabaseTasks.migrations_paths =
27
+ Array(ENV['DOMAIN_MIGRATIONS_DIR'] || Rails.application.paths[migrate_path] || File.join(Rails.root, migrate_path))
28
+ ActiveRecord::Tasks::DatabaseTasks.fixtures_path = File.join Rails.root, 'test', 'fixtures_domain'
29
+ ENV['SCHEMA'] = File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema_domain.rb')
30
+ ENV['DB_STRUCTURE'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'structure_domain.sql')
31
+
32
+ else # 'projection' - normal rails
33
+ ActiveRecord::Tasks::DatabaseTasks.env = ENV['PROJECTION_ENV'] || Rails.env
34
+ ActiveRecord::Tasks::DatabaseTasks.database_configuration = Rails.application.config.database_configuration
35
+ ActiveRecord::Tasks::DatabaseTasks.migrations_paths = Array(Rails.application.paths[migrate_path])
36
+ ActiveRecord::Tasks::DatabaseTasks.fixtures_path = File.join Rails.root, 'test', 'fixtures'
37
+ ENV['SCHEMA'] = File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
38
+ ENV['DB_STRUCTURE'] = File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'structure.sql')
39
+ end
40
+
41
+ if defined?(ENGINE_PATH) && (engine = Rails::Engine.find(ENGINE_PATH))
42
+ if engine.paths[migrate_path].existent
43
+ ActiveRecord::Tasks::DatabaseTasks.migrations_paths += Array(engine.paths[migrate_path])
44
+ elsif Dir.exists?(File.join engine.root, migrate_path)
45
+ ActiveRecord::Tasks::DatabaseTasks.migrations_paths << File.join(engine.root, migrate_path)
46
+ end
47
+ end
48
+ Rails.env = ActiveRecord::Tasks::DatabaseTasks.env
49
+ ActiveRecord::Tasks::DatabaseTasks.root = Rails.root if ActiveRecord::Tasks::DatabaseTasks.respond_to? :root
50
+
51
+ #puts "env = #{ActiveRecord::Tasks::DatabaseTasks.env}"
52
+ puts "system = #{ENV['SYSTEM']}"
53
+ #puts "config = #{ActiveRecord::Tasks::DatabaseTasks.database_configuration[ActiveRecord::Tasks::DatabaseTasks.env]}"
54
+ end
55
+
56
+ def connect
57
+ ActiveRecord::Base.establish_connection ActiveRecord::Tasks::DatabaseTasks.env
58
+ end
59
+
60
+ namespace :migrate do
61
+ desc 'Copys the migrations files from the gems directories (options: SYSTEM=(projection|domain))'
62
+ task :copy => :load_config do
63
+ target_path = ActiveRecord::Tasks::DatabaseTasks.migrations_paths.first
64
+ gems = %w(active_event active_domain)
65
+ gems = %w(active_projection) if ENV['SYSTEM'] != 'domain'
66
+ gems.each do |gem|
67
+ gem_spec = Gem::Specification.find_by_name(gem)
68
+ if gem.nil?
69
+ puts "missing gem #{gem}!"
70
+ elsif Dir.exists?(File.join gem_spec.gem_dir, 'db/migrate')
71
+ cp_r (File.join gem_spec.gem_dir, 'db/migrate/.'), target_path
72
+ else
73
+ puts "missing db/migrate in gem #{gem}!"
74
+ end
75
+ end
76
+ end
77
+
78
+ desc 'Copy and run migrations (options: SYSTEM=(projection|domain))'
79
+ task :setup do
80
+ Rake::Task[:'disco:db:migrate:copy'].invoke
81
+ Rake::Task[:'disco:db:create'].invoke
82
+ Rake::Task[:'disco:db:migrate'].invoke
83
+ end
84
+
85
+ # make sure the right database is connected
86
+ task :down do connect end
87
+ task :up do connect end
88
+ task :status do connect end
89
+ end
90
+
91
+ task :migrate do connect end
92
+
93
+ namespace :schema do
94
+ task :load do connect end
95
+ end
96
+ namespace :structure do
97
+ task :load do connect end
98
+ end
99
+ end
100
+
101
+ load 'active_record/railties/databases.rake'
102
+
103
+ namespace :domain do
104
+ task :environment do
105
+ ENV['SYSTEM'] = 'domain'
106
+ end
107
+
108
+ namespace :create do
109
+ task :all => [:environment, :'disco:db:create:all']
110
+ end
111
+
112
+ desc 'Create the database from config/disco.yml (use create:all to create all dbs in the config)'
113
+ task :create => [:environment, :'disco:db:create']
114
+
115
+ namespace :drop do
116
+ task :all => [:environment, :'disco:db:drop:all']
117
+ end
118
+
119
+ desc 'Drops the database using config/disco.yml (use drop:all to drop all databases)'
120
+ task :drop => [:environment, :'disco:db:drop']
121
+
122
+ desc 'run domain migrations'
123
+ task :migrate => [:environment, :'disco:db:migrate']
124
+
125
+ namespace :migrate do
126
+ desc 'Display status of migrations'
127
+ task :status => [:environment, :'disco:db:migrate:status']
128
+
129
+ desc 'Copy migrations from rails disco'
130
+ task :copy => [:environment, :'disco:db:migrate:copy']
131
+
132
+ desc 'Copy and run migrations from rails disco'
133
+ task :setup => [:environment, :'disco:db:migrate:setup']
134
+
135
+ desc 'drop and create, copy and run migrations from rails disco'
136
+ task :reset => [:environment, :'disco:db:migrate:reset']
137
+ end
138
+
139
+ desc 'create and load schema and seeds for domain database'
140
+ task :setup => [:environment, :'disco:db:setup']
141
+ end
142
+
143
+ def reenable
144
+ Rake::Task.tasks.map &:reenable
145
+ end
146
+
147
+ desc 'creates the domain and projection databases for the current environment'
148
+ task :create do
149
+ ENV['SYSTEM'] = 'projection'
150
+ Rake::Task[:'disco:db:create'].invoke
151
+
152
+ reenable
153
+ Rake::Task[:'disco:domain:create'].invoke
154
+ end
155
+
156
+ desc 'drops the domain and projection databases for the current environment'
157
+ task :drop do
158
+ ENV['SYSTEM'] = 'projection'
159
+ Rake::Task[:'disco:db:drop'].invoke
160
+
161
+ reenable
162
+ Rake::Task[:'disco:domain:drop'].invoke
163
+ end
164
+
165
+ desc 'migrates the domain and projection databases for the current environment'
166
+ task :migrate do
167
+ ENV['SYSTEM'] = 'projection'
168
+ Rake::Task[:'disco:db:migrate'].invoke
169
+
170
+ reenable
171
+ Rake::Task[:'disco:domain:migrate'].invoke
172
+ end
173
+
174
+ desc 'Create and load schema and seeds for domain and projection databases'
175
+ task :setup do
176
+ ENV['SYSTEM'] = 'projection'
177
+ Rake::Task[:'disco:db:setup'].invoke
178
+
179
+ reenable
180
+ Rake::Task[:'disco:domain:setup'].invoke
181
+ end
182
+
183
+ desc 'Drop, recreate and load schema and seeds for domain and projection databases'
184
+ task :reset do
185
+ ENV['SYSTEM'] = 'projection'
186
+ Rake::Task[:'disco:db:drop'].invoke
187
+ Rake::Task[:'disco:db:setup'].invoke
188
+
189
+ reenable
190
+ Rake::Task[:'disco:domain:drop'].invoke
191
+ Rake::Task[:'disco:domain:setup'].invoke
192
+ end
193
+
194
+ namespace :migrate do
195
+ desc 'copies, creates and runs all migrations for domain and projection databases for the current environment'
196
+ task :setup do
197
+ ENV['SYSTEM'] = 'projection'
198
+ Rake::Task[:'disco:db:migrate:setup'].invoke
199
+
200
+ reenable
201
+ Rake::Task[:'disco:domain:migrate:setup'].invoke
202
+ end
203
+
204
+ desc 'Resets your domain and projection databases using your migrations for the current environment'
205
+ task :reset do
206
+ ENV['SYSTEM'] = 'projection'
207
+ Rake::Task[:'disco:db:migrate:reset'].invoke
208
+
209
+ reenable
210
+ Rake::Task[:'disco:domain:migrate:reset'].invoke
211
+ end
212
+
213
+ desc 'Display status of domain and projection migrations'
214
+ task :status do
215
+ ENV['SYSTEM'] = 'projection'
216
+ Rake::Task[:'disco:db:migrate:status'].invoke
217
+
218
+ reenable
219
+ Rake::Task[:'disco:domain:migrate:status'].invoke
220
+ end
221
+ end
222
+ end
@@ -0,0 +1,94 @@
1
+ def do_in_parent_dir
2
+ cd '../'
3
+ yield
4
+ cd PROJECT_NAME
5
+ end
6
+
7
+ task :environment do
8
+ PROJECT_NAME = File.basename(pwd)
9
+ end
10
+
11
+ task :create_domain => :create_frontend do
12
+ dir = "#{PROJECT_NAME}_domain"
13
+ app_dir = "#{dir}/app"
14
+ config_dir = "#{dir}/config"
15
+ bin_dir = "#{dir}/bin"
16
+ db_dir = "#{dir}/db"
17
+ do_in_parent_dir do
18
+ mkdir dir unless Dir.exists?(dir)
19
+ mkdir app_dir unless Dir.exists?(app_dir)
20
+ move "#{FRONTEND_DIR}/domain/command_processors", app_dir
21
+ move "#{FRONTEND_DIR}/domain/models", app_dir
22
+ move "#{FRONTEND_DIR}/domain/projections", app_dir
23
+ move "#{FRONTEND_DIR}/domain/validations", app_dir
24
+ remove_dir "#{FRONTEND_DIR}/domain"
25
+ mkdir config_dir unless Dir.exists?(config_dir)
26
+ move "#{FRONTEND_DIR}/config/disco.yml", config_dir
27
+ mkdir bin_dir unless Dir.exists?(bin_dir)
28
+ move "#{FRONTEND_DIR}/bin/domain_server.rb", bin_dir
29
+ mkdir db_dir unless Dir.exists?(db_dir)
30
+ move "#{FRONTEND_DIR}/db/migrate_domain/.", "#{db_dir}/migrate"
31
+ remove_dir "#{FRONTEND_DIR}/db" if Dir["#{FRONTEND_DIR}/db/*"].empty?
32
+ #todo: gemfile and gemspec
33
+ end
34
+ end
35
+
36
+ task :create_projection => :create_frontend do
37
+ dir = "#{PROJECT_NAME}_projection"
38
+ app_dir = "#{dir}/app"
39
+ config_dir = "#{dir}/config"
40
+ bin_dir = "#{dir}/bin"
41
+ db_dir = "#{dir}/db"
42
+ do_in_parent_dir do
43
+ mkdir dir unless Dir.exists?(dir)
44
+ mkdir app_dir unless Dir.exists?(app_dir)
45
+ move "#{FRONTEND_DIR}/app/models", app_dir
46
+ move "#{FRONTEND_DIR}/app/projections", app_dir
47
+ mkdir config_dir unless Dir.exists?(config_dir)
48
+ move "#{FRONTEND_DIR}/config/disco.yml", config_dir
49
+ mkdir bin_dir unless Dir.exists?(bin_dir)
50
+ move "#{FRONTEND_DIR}/bin/projection_servers.rb", bin_dir
51
+ mkdir db_dir unless Dir.exists?(db_dir)
52
+ move "#{FRONTEND_DIR}/db/migrate/.", "#{db_dir}/migrate"
53
+ remove_dir "#{FRONTEND_DIR}/db" if Dir["#{FRONTEND_DIR}/db/*"].empty?
54
+ #todo: gemfile and gemspec
55
+ end
56
+ end
57
+
58
+ task :create_interface => :create_frontend do
59
+ dir = "#{PROJECT_NAME}_interface"
60
+ app_dir = "#{dir}/app"
61
+ lib_dir = "#{dir}/lib"
62
+ do_in_parent_dir do
63
+ mkdir dir unless Dir.exists?(dir)
64
+ mkdir app_dir unless Dir.exists?(app_dir)
65
+ move "#{FRONTEND_DIR}/app/commands", app_dir
66
+ move "#{FRONTEND_DIR}/app/events", app_dir
67
+ move "#{FRONTEND_DIR}/app/validations", app_dir
68
+ mkdir lib_dir unless Dir.exists?(lib_dir)
69
+ temp_dir = "#{lib_dir}/#{PROJECT_NAME}"
70
+ mkdir temp_dir unless Dir.exists?(temp_dir)
71
+ move "#{FRONTEND_DIR}/lib/#{PROJECT_NAME}/domain.rb", temp_dir
72
+ move "#{FRONTEND_DIR}/lib/#{PROJECT_NAME}.rb", "#{lib_dir}/#{dir}.rb"
73
+ #todo: delete first line in this file
74
+ #todo: gemfile and gemspec
75
+ end
76
+ end
77
+
78
+ task :create_frontend => :environment do
79
+ FRONTEND_DIR = "#{PROJECT_NAME}_frontend"
80
+ app_dir = "#{FRONTEND_DIR}/app"
81
+ lib_dir = "#{FRONTEND_DIR}/lib"
82
+ do_in_parent_dir do
83
+ mkdir FRONTEND_DIR unless Dir.exists?(FRONTEND_DIR)
84
+ cp_r "#{PROJECT_NAME}/.", FRONTEND_DIR
85
+ cp_r "#{FRONTEND_DIR}/lib/#{PROJECT_NAME}.rb", "#{lib_dir}/#{FRONTEND_DIR}.rb"
86
+ #todo: delete line 2, 5 and 6 in this file
87
+ end
88
+ end
89
+
90
+
91
+ desc 'split this'
92
+ task :split => [:create_projection, :create_domain, :create_interface] do
93
+ puts 'done'
94
+ end
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: disco-railties
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0.rc1
5
+ platform: ruby
6
+ authors:
7
+ - HicknHack Software
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: active_event
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.0.rc1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.0.rc1
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_domain
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.0.rc1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.0.rc1
41
+ - !ruby/object:Gem::Dependency
42
+ name: active_projection
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.0.rc1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.0.rc1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 4.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 4.0.0
69
+ description: 'Rails Disco internals: rake tasks, generators and the commandline interface'
70
+ email: rails-disco@hicknhack-software.com
71
+ executables:
72
+ - disco
73
+ - drails
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - lib/disco/app_disco_loader.rb
78
+ - lib/disco/cli.rb
79
+ - lib/disco/commands/application.rb
80
+ - lib/disco/commands/destroy.rb
81
+ - lib/disco/commands/domainserver.rb
82
+ - lib/disco/commands/generate.rb
83
+ - lib/disco/commands/projectionserver.rb
84
+ - lib/disco/commands/server.rb
85
+ - lib/disco/commands.rb
86
+ - lib/disco/generators.rb
87
+ - lib/disco/server/domain_server.rb
88
+ - lib/disco/server/projection_servers.rb
89
+ - lib/generators/disco/app/app_generator.rb
90
+ - lib/generators/disco/app/templates/app/controllers/event_source_controller.rb
91
+ - lib/generators/disco/app/templates/bin/disco
92
+ - lib/generators/disco/app/templates/config/disco.yml
93
+ - lib/generators/disco/app/templates/config/initializers/build_validations_registry.rb
94
+ - lib/generators/disco/app/templates/config/initializers/create_domain.rb
95
+ - lib/generators/disco/app/templates/db/seeds.rb
96
+ - lib/generators/disco/app/USAGE
97
+ - lib/generators/disco/command/command_generator.rb
98
+ - lib/generators/disco/command/templates/command.rb.erb
99
+ - lib/generators/disco/command/templates/event.rb.erb
100
+ - lib/generators/disco/command/USAGE
101
+ - lib/generators/disco/command_processor/command_processor_generator.rb
102
+ - lib/generators/disco/command_processor/templates/command_processor.rb
103
+ - lib/generators/disco/command_processor/USAGE
104
+ - lib/generators/disco/domain.rb
105
+ - lib/generators/disco/event_name.rb
106
+ - lib/generators/disco/migration/migration_generator.rb
107
+ - lib/generators/disco/migration/templates/create_table_migration.rb
108
+ - lib/generators/disco/migration/USAGE
109
+ - lib/generators/disco/model/model_generator.rb
110
+ - lib/generators/disco/model/templates/domain_model.rb
111
+ - lib/generators/disco/model/templates/model.rb
112
+ - lib/generators/disco/model/USAGE
113
+ - lib/generators/disco/processor_name.rb
114
+ - lib/generators/disco/projection/projection_generator.rb
115
+ - lib/generators/disco/projection/templates/domain_projection.rb
116
+ - lib/generators/disco/projection/templates/domain_projection_test.rb
117
+ - lib/generators/disco/projection/templates/projection.rb
118
+ - lib/generators/disco/projection/templates/projection_test.rb
119
+ - lib/generators/disco/projection/USAGE
120
+ - lib/generators/disco/scaffold/scaffold_generator.rb
121
+ - lib/generators/disco/scaffold/templates/_eventstream.js.erb
122
+ - lib/generators/disco/scaffold/USAGE
123
+ - lib/generators/disco/scaffold_controller/scaffold_controller_generator.rb
124
+ - lib/generators/disco/scaffold_controller/templates/controller.rb
125
+ - lib/generators/disco/scaffold_controller/templates/controller_test.rb
126
+ - lib/generators/disco/scaffold_controller/USAGE
127
+ - lib/generators/disco/use_domain_option.rb
128
+ - lib/rails-disco/railtie.rb
129
+ - lib/rails-disco/tasks.rb
130
+ - lib/rails-disco/version.rb
131
+ - lib/tasks/db.rake
132
+ - lib/tasks/split.rake
133
+ - Rakefile
134
+ - MIT-LICENSE
135
+ - bin/disco
136
+ - bin/drails
137
+ homepage: https://github.com/hicknhack-software/rails-disco
138
+ licenses:
139
+ - MIT
140
+ metadata: {}
141
+ post_install_message:
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - '>'
153
+ - !ruby/object:Gem::Version
154
+ version: 1.3.1
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 2.1.11
158
+ signing_key:
159
+ specification_version: 4
160
+ summary: Tools for working with Rails Disco
161
+ test_files: []