drailties 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/bin/drails +0 -1
  3. data/lib/drails/server.rb +18 -7
  4. data/lib/generators/drails/app/USAGE +4 -1
  5. data/lib/generators/drails/app/app_generator.rb +24 -0
  6. data/lib/generators/drails/app/templates/event_source_controller.rb +1 -1
  7. data/lib/generators/drails/command/USAGE +5 -5
  8. data/lib/generators/drails/command/command_generator.rb +15 -19
  9. data/lib/generators/drails/command/templates/command.rb +2 -1
  10. data/lib/generators/drails/command/templates/event.rb +2 -1
  11. data/lib/generators/drails/command_processor/command_processor_generator.rb +4 -12
  12. data/lib/generators/drails/controller/controller_generator.rb +7 -0
  13. data/lib/generators/drails/controller/templates/controller.rb +3 -3
  14. data/lib/generators/drails/domain.rb +19 -0
  15. data/lib/generators/drails/event_name.rb +52 -0
  16. data/lib/generators/drails/migration/migration_generator.rb +5 -4
  17. data/lib/generators/drails/migration/templates/create_table_migration.rb +3 -3
  18. data/lib/generators/drails/model/USAGE +7 -5
  19. data/lib/generators/drails/model/model_generator.rb +6 -26
  20. data/lib/generators/drails/processor_name.rb +48 -0
  21. data/lib/generators/drails/projection/USAGE +6 -4
  22. data/lib/generators/drails/projection/projection_generator.rb +5 -25
  23. data/lib/generators/drails/projection/templates/domain_projection.rb +2 -2
  24. data/lib/generators/drails/projection/templates/projection.rb +2 -2
  25. data/lib/generators/drails/scaffold/USAGE +11 -11
  26. data/lib/generators/drails/scaffold/scaffold_generator.rb +35 -24
  27. data/lib/generators/drails/use_domain_option.rb +54 -0
  28. data/lib/rails-disco/railtie.rb +8 -0
  29. data/lib/rails-disco/tasks.rb +1 -0
  30. data/lib/rails-disco/version.rb +1 -1
  31. data/lib/tasks/db.rake +96 -82
  32. metadata +15 -11
  33. data/lib/drails/rake.rb +0 -17
  34. data/lib/drailties.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8642ab0f98128f69e538d45f9a4debeda51dc9b4
4
- data.tar.gz: 1e574718dcefb63cdd7aa34a5438471f490ec775
3
+ metadata.gz: d08d30f7e31adfdc8b7796b5d37b580298ce45c9
4
+ data.tar.gz: 432c6895cb8b9095c8d61e1e6641fa27a08d157f
5
5
  SHA512:
6
- metadata.gz: dfdb7b28db625797316faa897cd402067622a9ebac2294a1ea45ceb753e7a2601e50d44ced3036c01bd09a76c581096e67eccc45bbdf966fb526377089fe81d1
7
- data.tar.gz: 6d22d2cd7f89a0c8a6987d1b8946f2cd43a269c2c76f5b44b16f49a6a5a14092a2779ca344ca510f673a316faa0b5c286c1f4eed4ea9ebef6492fb76640141e6
6
+ metadata.gz: b5c3bc2afcbfc6d5a385371221072562b2eb7d1d926e79c7f76af5cfe84e4ea8599a425817690447931cf1213ac2c6d046e1a8dbfd08df8ef6df1521ef40b6b5
7
+ data.tar.gz: 8e8de79b5f581b2c57470e296525a79ff03e18d225addf655d7db64ded665ea3616b4764ec09cf5471f4431d3ea7c38a8e84c5ae2810ec62dcb17a10992f2e2c
data/bin/drails CHANGED
@@ -25,7 +25,6 @@ where COMMAND is one of:
25
25
  domainserver(ds) start the domain server
26
26
  projectionserver(ps) start the projection server
27
27
  server(s) start both server
28
- rake start a rake task
29
28
  EOT
30
29
 
31
30
  command = ARGV.shift
data/lib/drails/server.rb CHANGED
@@ -1,7 +1,18 @@
1
- puts 'Domain and Projection Server started'
2
- puts '=> Ctrl-C to shutdown both server'
3
- trap(:INT) { exit }
4
- Process.spawn({"ROOT_DIR" => ROOT_DIR}, "ruby #{File.expand_path '../server', __FILE__}/domain_server.rb")
5
- Process.spawn({"ROOT_DIR" => ROOT_DIR}, "ruby #{File.expand_path '../server', __FILE__}/projection_servers.rb")
6
- Process.spawn({"ROOT_DIR" => ROOT_DIR}, "rails s")
7
- Process.waitall
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
@@ -5,6 +5,9 @@ Example:
5
5
  rails generate drails:app
6
6
 
7
7
  This will create:
8
+ app/controllers/event_source_controller.rb
9
+ a route for this controller
8
10
  config/build_validations_registry.rb
9
11
  config/initializers/create_domain.rb
10
- config/disco.yml
12
+ config/disco.yml
13
+ adds rails-disco to your gemfile
@@ -20,9 +20,33 @@ module Drails
20
20
  copy_file 'event_source_controller.rb', File.join('app', 'controllers', 'event_source_controller.rb')
21
21
  end
22
22
 
23
+ def add_sse_route
24
+ route "get 'event_stream' => 'event_source#stream'"
25
+ end
26
+
23
27
  def add_drails_to_gemfile
24
28
  gem "rails-disco"
25
29
  end
30
+
31
+ def enable_rake_tasks
32
+ content = "
33
+ require 'rails-disco/tasks'"
34
+ inject_into_file File.join('config/application.rb'), content, after: /require 'rails\/all'/
35
+ rescue Exception
36
+ puts "Seems like you invoked it from an engine, so put\n
37
+ require 'rails-disco/tasks'\n
38
+ in your application.rb from the main application to have the rails disco rake tasks available"
39
+ end
40
+
41
+ def enable_concurrency
42
+ application 'config.preload_frameworks = true'
43
+ application 'config.allow_concurrency = true'
44
+ rescue Exception
45
+ puts "Seems like you invoked it from an engine, so remember to put\n
46
+ config.preload_frameworks = true
47
+ config.allow_concurrency = true\n
48
+ in your application.rb from the main application"
49
+ end
26
50
  end
27
51
  end
28
52
  end
@@ -5,7 +5,7 @@ class EventSourceController < ApplicationController
5
5
  def stream
6
6
  event_connection.start
7
7
  response.headers['Content-Type'] = 'text/event-stream'
8
- sse = Reloader::SSE.new(response.stream)
8
+ sse = ActiveEvent::SSE.new(response.stream)
9
9
  subscribe_to event_queue do |delivery_info, properties, body|
10
10
  sse.write({:id => properties.headers['store_id']}, :event => 'refresh')
11
11
  end
@@ -2,10 +2,10 @@ Description:
2
2
  Generates a Command, an Event and adds it to the CommandProcessor or creates one.
3
3
 
4
4
  Example:
5
- rails generate drails:command ThingCreate
5
+ rails generate drails:command CreateThing [attr1, attr2] --event=CreatedThing --processor=Things
6
6
 
7
7
  This will create:
8
- app/commands/thing_create_command.rb
9
- app/events/thing_create_event.rb
10
- domain/command_processors/thing_processor.rb if it not exists
11
- Adds a method to this or the existing processor
8
+ app/commands/create_thing_command.rb
9
+ app/events/created_thing_event.rb
10
+ domain/command_processors/things_processor.rb unless it exists
11
+ Adds a command handler to this or an existing processor
@@ -1,43 +1,39 @@
1
+ require 'generators/drails/processor_name.rb'
2
+ require 'generators/drails/event_name.rb'
3
+ require 'generators/drails/domain.rb'
4
+
1
5
  module Drails
2
6
  module Generators
3
7
  class CommandGenerator < Rails::Generators::NamedBase
4
8
  source_root File.expand_path('../templates', __FILE__)
5
9
  argument :attributes, type: :array, default: [], banner: "attribute attribute"
10
+ include ProcessorName
11
+ include EventName
12
+ include Domain
6
13
 
7
14
  def create_command_file
8
15
  template 'command.rb', File.join('app/commands', class_path, "#{file_name}_command.rb")
9
16
  end
10
17
 
11
18
  def create_related_event_file
12
- template 'event.rb', File.join('app/events', class_path, "#{file_name}_event.rb")
19
+ return if skip_event?
20
+ template 'event.rb', File.join('app/events', event_class_path, "#{event_file_name}_event.rb")
13
21
  end
14
22
 
15
23
  def create_command_processor
16
- generate 'drails:command_processor', processor_file_name, '-s'
24
+ return if skip_processor?
25
+ generate 'drails:command_processor', processor_file_path, '-s', '--skip-namespace'
17
26
  end
18
27
 
19
28
  def add_to_command_processor
29
+ return if skip_processor?
20
30
  content = "
21
31
 
22
32
  process #{class_name}Command do |command|
23
- command.is_valid_do { event #{class_name}Event.new command.to_hash }
33
+ command.is_valid_do { event #{event_class_name}Event.new command.to_hash }
24
34
  end"
25
- inject_into_file File.join('domain/command_processors', domain_ns, "#{processor_file_name}_processor.rb"), content, after: /(\s)*include(\s)*ActiveDomain::CommandProcessor/
26
- end
27
-
28
- private
29
- def processor_file_name
30
- file_name.split('_').first
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
- namespace_path
35
+ file = File.join('domain/command_processors', processor_domain_class_path, "#{processor_file_name}_processor.rb")
36
+ inject_into_file file, content, after: /(\s)*include(\s)*ActiveDomain::CommandProcessor/
41
37
  end
42
38
  end
43
39
  end
@@ -1,4 +1,5 @@
1
- <% module_namespacing do -%>class <%= class_name %>Command
1
+ <% module_namespacing do -%>
2
+ class <%= class_name %>Command
2
3
  include ActiveEvent::Command
3
4
  attributes :id<%=',' unless attributes_names.empty? %> <%=attributes_names.map{|x| ":#{x}"}.join(', ')%>
4
5
  end
@@ -1,4 +1,5 @@
1
- <% module_namespacing do -%>class <%= class_name %>Event
1
+ <% module_namespacing do -%>
2
+ class <%= event_class_name %>Event
2
3
  include ActiveEvent::EventType
3
4
  attributes :id<%=',' unless attributes_names.empty? %> <%=attributes_names.map{|x| ":#{x}"}.join(', ')%>
4
5
 
@@ -1,22 +1,14 @@
1
+ require 'generators/drails/domain.rb'
2
+
1
3
  module Drails
2
4
  module Generators
3
5
  class CommandProcessorGenerator < Rails::Generators::NamedBase
4
6
  source_root File.expand_path('../templates', __FILE__)
7
+ include Domain
5
8
  hide!
6
9
 
7
10
  def create_command_processor_file
8
- template 'command_processor.rb', File.join('domain/command_processors', domain_ns, "#{file_name}_processor.rb")
9
- end
10
-
11
- private
12
- def domain_ns
13
- namespace_path = Array.new class_path
14
- if namespace_path.empty?
15
- namespace_path[0] = 'domain'
16
- else
17
- namespace_path[-1] += '_domain'
18
- end
19
- namespace_path
11
+ template 'command_processor.rb', File.join('domain/command_processors', domain_class_path, "#{file_name}_processor.rb")
20
12
  end
21
13
  end
22
14
  end
@@ -10,7 +10,14 @@ module Drails
10
10
  template "controller_test.rb", File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb")
11
11
  end
12
12
 
13
+ protected
14
+
15
+ def command_class_name(command)
16
+ (class_path + ["#{command}_#{file_name}"]).map(&:camelize) * '::'
17
+ end
18
+
13
19
  private
20
+
14
21
  def params_string
15
22
  attributes.map { |x| "#{x.name}: params[:#{singular_table_name}][:#{x.name}]" }.join(', ')
16
23
  end
@@ -18,7 +18,7 @@ class <%= controller_class_name %>Controller < ApplicationController
18
18
  end
19
19
 
20
20
  def create
21
- <%= singular_table_name %> = <%= "#{human_name}"%>CreateCommand.new({<%= params_string %>})
21
+ <%= singular_table_name %> = <%= command_class_name('create') %>Command.new({<%= params_string %>})
22
22
  valid = <%= singular_table_name %>.valid?
23
23
  if valid and id = Domain.run_command(<%= singular_table_name %>)
24
24
  flash[:notice] = <%= "'#{human_name} was successfully created.'" %>
@@ -31,7 +31,7 @@ class <%= controller_class_name %>Controller < ApplicationController
31
31
  end
32
32
 
33
33
  def update
34
- <%= singular_table_name %> = <%= "#{human_name}"%>UpdateCommand.new({id: params[:id]<%=',' unless params_string == ''%> <%= params_string %>})
34
+ <%= singular_table_name %> = <%= command_class_name('update') %>Command.new({id: params[:id]<%=',' unless params_string == ''%> <%= params_string %>})
35
35
  valid = <%= singular_table_name %>.valid?
36
36
  if valid and id = Domain.run_command(<%= singular_table_name %>)
37
37
  flash[:notice] = <%= "'#{human_name} was successfully updated.'" %>
@@ -44,7 +44,7 @@ class <%= controller_class_name %>Controller < ApplicationController
44
44
  end
45
45
 
46
46
  def destroy
47
- <%= singular_table_name %> = <%= "#{human_name}"%>DeleteCommand.new({id: params[:id]})
47
+ <%= singular_table_name %> = <%= command_class_name('delete') %>Command.new({id: params[:id]})
48
48
  if id = Domain.run_command(<%= singular_table_name %>)
49
49
  session[:tmp_event_id] = id
50
50
  flash[:notice] = <%= "'#{human_name} was successfully deleted.'" %>
@@ -0,0 +1,19 @@
1
+ require 'active_support/concern'
2
+
3
+ module Drails
4
+ module Generators
5
+ module Domain
6
+ extend ActiveSupport::Concern
7
+
8
+ def domain_class_path
9
+ @domain_calss_path ||= class_path_domain class_path
10
+ end
11
+
12
+ protected
13
+
14
+ def class_path_domain(class_path)
15
+ (Array.new class_path).unshift 'domain'
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,52 @@
1
+ require 'active_support/concern'
2
+
3
+ module Drails
4
+ module Generators
5
+ module EventName
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ class_option :event, type: :string, default: nil, desc: "name of the event (defaults to NAME)"
10
+ class_option :skip_event, type: :boolean, default: false, desc: "skip event generation"
11
+ end
12
+
13
+ def initialize(args, *options)
14
+ super
15
+ assign_event_name!(event_name)
16
+ end
17
+
18
+ protected
19
+
20
+ attr_reader :event_file_name
21
+ attr_reader :event_class_path
22
+
23
+ def skip_event?
24
+ options[:skip_event]
25
+ end
26
+
27
+ def event_name
28
+ options[:event] || name
29
+ end
30
+
31
+ def event_class_name
32
+ (event_class_path + [event_file_name]).map!{ |m| m.camelize }.join('::')
33
+ end
34
+
35
+ def event_file_path
36
+ @event_file_path ||= (event_class_path + [event_file_name]).join('/')
37
+ end
38
+
39
+ def event_domain_class_path
40
+ @event_domain_class_path ||= class_path_domain event_class_path
41
+ end
42
+
43
+ private
44
+
45
+ def assign_event_name!(event_name)
46
+ @event_class_path = event_name.include?('/') ? event_name.split('/') : event_name.split('::')
47
+ @event_class_path.map! &:underscore
48
+ @event_file_name = @event_class_path.pop
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,12 +1,12 @@
1
1
  require 'rails/generators/active_record/migration/migration_generator'
2
+ require 'generators/drails/use_domain_option.rb'
3
+
2
4
  module Drails
3
5
  module Generators
4
6
  class MigrationGenerator < ActiveRecord::Generators::MigrationGenerator
5
7
  source_root File.expand_path('../templates', __FILE__)
6
8
  hide!
7
- remove_argument :attibutes
8
- argument :use_domain, type: :string, default: 'false'
9
- argument :attributes, type: :array, default: [], banner: "field[:type] field[:type]"
9
+ include UseDomainOption
10
10
 
11
11
  def create_migration_file
12
12
  set_local_assigns!
@@ -15,8 +15,9 @@ module Drails
15
15
  end
16
16
 
17
17
  private
18
+
18
19
  def migration_dir
19
- if (/^(true|t|yes|y|1)$/i).match(use_domain)
20
+ if use_domain?
20
21
  'migrate_domain'
21
22
  else
22
23
  'migrate'
@@ -2,11 +2,11 @@ class <%= migration_class_name %> < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :<%= table_name %> do |t|
4
4
  <% attributes.each do |attribute| -%>
5
- <% if attribute.password_digest? -%>
5
+ <% if attribute.password_digest? -%>
6
6
  t.string :password_digest<%= attribute.inject_options %>
7
- <% else -%>
7
+ <% else -%>
8
8
  t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
9
- <% end -%>
9
+ <% end -%>
10
10
  <% end -%>
11
11
  <% if options[:timestamps] %>
12
12
  t.timestamps
@@ -2,14 +2,16 @@ Description:
2
2
  Generates a Model and a Projection for it.
3
3
 
4
4
  Example:
5
- rails generate drails:model Thing [use_domain] [attr1:type, attr2:type]
5
+ rails generate drails:model Thing [attr1:type, attr2:type]
6
6
 
7
- This will create if use_domain is false(standard):
7
+ This will create:
8
8
  app/projection/thing_projection.rb
9
9
  app/models/thing.rb
10
10
  db/migrate/create_thing.rb
11
11
 
12
- This will create if use_domain is true:
13
- domain/projection/thing_projection.rb
14
- domain/models/thing.rb
12
+ rails generate drails:model Thing [attr1:type, attr2:type] --domain
13
+
14
+ This will create:
15
+ domain/projections/domain/thing_projection.rb
16
+ domain/models/domain/thing.rb
15
17
  db/migrate_domain/create_thing.rb
@@ -1,42 +1,22 @@
1
+ require 'generators/drails/use_domain_option.rb'
2
+
1
3
  module Drails
2
4
  module Generators
3
5
  class ModelGenerator < Rails::Generators::NamedBase
4
6
  source_root File.expand_path('../templates', __FILE__)
5
- argument :use_domain, type: :string, default: 'false'
6
7
  argument :attributes, type: :array, default: [], banner: "field[:type] field[:type]"
8
+ include UseDomainOption
7
9
 
8
10
  def create_projection_file
9
- if domain?
10
- generate 'drails:projection', name, 'true'
11
- else
12
- generate 'drails:projection', name
13
- end
11
+ generate 'drails:projection', name, use_domain_param
14
12
  end
15
13
 
16
14
  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
15
+ template use_domain('model.rb'), use_domain_class_file_path('models', "#{file_name}.rb")
22
16
  end
23
17
 
24
18
  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
19
+ generate 'drails:migration', "create_#{table_name}", attributes.map { |x| "#{x.name}:#{x.type}" }.join(' '), use_domain_param
40
20
  end
41
21
  end
42
22
  end
@@ -0,0 +1,48 @@
1
+ require 'active_support/concern'
2
+
3
+ module Drails
4
+ module Generators
5
+ module ProcessorName
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ class_option :processor, type: :string, default: nil, desc: "class_name of the command processor (defaults to NAME)"
10
+ class_option :skip_processor, type: :boolean, default: false, desc: "Skip command processor generation"
11
+ end
12
+
13
+ def initialize(args, *options)
14
+ super
15
+ assign_processor_names!(processor_name)
16
+ end
17
+
18
+ protected
19
+
20
+ attr_reader :processor_file_name
21
+ attr_reader :processor_class_path
22
+
23
+ def skip_processor?
24
+ options[:skip_processor]
25
+ end
26
+
27
+ def processor_name
28
+ options[:processor] || name
29
+ end
30
+
31
+ def processor_file_path
32
+ @processor_file_path ||= (processor_class_path + [processor_file_name]).join('/')
33
+ end
34
+
35
+ def processor_domain_class_path
36
+ @processor_domain_class_path ||= class_path_domain processor_class_path
37
+ end
38
+
39
+ private
40
+
41
+ def assign_processor_names!(processor_name)
42
+ @processor_class_path = processor_name.include?('/') ? processor_name.split('/') : processor_name.split('::')
43
+ @processor_class_path.map! &:underscore
44
+ @processor_file_name = @processor_class_path.pop
45
+ end
46
+ end
47
+ end
48
+ end
@@ -2,10 +2,12 @@ Description:
2
2
  Generates a projection with handlers for the given events.
3
3
 
4
4
  Example:
5
- rails generate drails:projection Thing [use_domain] [event1 event2 ...]
5
+ rails generate drails:projection Thing [event event]
6
6
 
7
- This will create if use_domain is false(standard):
7
+ This will create:
8
8
  app/projection/thing_projection.rb
9
9
 
10
- This will create if use_domain is true:
11
- domain/projection/thing_projection.rb
10
+ rails generate drails:projection Thing [event event] --domain
11
+
12
+ This will create:
13
+ domain/projections/domain/thing_projection.rb
@@ -1,38 +1,18 @@
1
+ require 'generators/drails/use_domain_option.rb'
2
+
1
3
  module Drails
2
4
  module Generators
3
5
  class ProjectionGenerator < Rails::Generators::NamedBase
4
6
  source_root File.expand_path('../templates', __FILE__)
5
- argument :use_domain, type: :string, default: 'false'
6
7
  argument :events, type: :array, default: [], banner: "event event"
8
+ include UseDomainOption
7
9
 
8
10
  def create_projection_file
9
- if domain?
10
- template 'domain_projection.rb', File.join('domain', 'projections', domain_ns, "#{plural_file_name}_projection.rb")
11
- else
12
- template 'projection.rb', File.join('app', 'projections', class_path, "#{plural_file_name}_projection.rb")
13
- end
11
+ template use_domain('projection.rb'), use_domain_class_file_path('projections', "#{plural_file_name}_projection.rb")
14
12
  end
15
13
 
16
14
  def create_test_files
17
- if domain?
18
- template 'domain_projection_test.rb', File.join("test/projections", class_path, "#{plural_file_name}_projection_test.rb")
19
- else
20
- template 'projection_test.rb', File.join("test/projections", class_path, "#{plural_file_name}_projection_test.rb")
21
- end
22
- end
23
-
24
- private
25
- def domain?
26
- @domain ||= !!(/^(true|t|yes|y|1)$/i).match(use_domain)
27
- end
28
-
29
- def domain_ns
30
- namespace_path = Array.new class_path
31
- if namespace_path.empty?
32
- namespace_path[0] = 'domain'
33
- else
34
- namespace_path[-1] += '_domain'
35
- end
15
+ template use_domain('projection_test.rb'), File.join("test/projections", use_domain_class_path, "#{plural_file_name}_projection_test.rb")
36
16
  end
37
17
  end
38
18
  end
@@ -1,8 +1,8 @@
1
1
  module <%=if Rails::Generators.namespace.present? then Rails::Generators.namespace.name end%>Domain
2
- class <%= plural_name.camelcase %>Projection
2
+ class <%= class_name %>Projection
3
3
  include ActiveDomain::Projection
4
4
  <% events.each do |event| %>
5
- def <%=event.underscore%>(event)
5
+ def <%= event.underscore.split('/') * '__' %>(event)
6
6
  end
7
7
  <% end %>
8
8
  end
@@ -1,8 +1,8 @@
1
1
  <% module_namespacing do -%>
2
- class <%= plural_name.camelcase %>Projection
2
+ class <%= class_name %>Projection
3
3
  include ActiveProjection::ProjectionType
4
4
  <% events.each do |event| %>
5
- def <%=event.underscore%>(event)
5
+ def <%= event.underscore.split('/') * '__' %>(event)
6
6
  end
7
7
  <% end %>
8
8
  end
@@ -6,22 +6,22 @@ Example:
6
6
  rails generate drails:scaffold Thing [attr1:type, attr2:type]
7
7
 
8
8
  This will create:
9
- app/commands/thing_create_command.rb
10
- app/commands/thing_update_command.rb
11
- app/commands/thing_delete_command.rb
12
9
  app/controllers/things_controller
13
- app/events/thing_create_event.rb
14
- app/events/thing_update_event.rb
15
- app/events/thing_delete_event.rb
16
- app/helpers/thing_helper.rb
10
+ app/commands/create_thing_command.rb
11
+ app/commands/update_thing_command.rb
12
+ app/commands/delete_thing_command.rb
13
+ domain/command_processors/thing_processor.rb
14
+ app/events/created_thing_event.rb
15
+ app/events/updated_thing_event.rb
16
+ app/events/deleted_thing_event.rb
17
+ app/projections/things_projection.rb
18
+ db/migrate/create_things.rb
17
19
  app/models/thing.rb
18
- app/projections/thing_projection.rb
20
+ app/helpers/things_helper.rb
21
+ app/views/things/_eventstream.js.erb
19
22
  app/views/things/_form.html.erb
20
23
  app/views/things/edit.html.erb
21
24
  app/views/things/index.html.erb
22
25
  app/views/things/new.html.erb
23
26
  app/views/things/show.html.erb
24
- db/migrate/create_thing.rb
25
- db/migrate_domain/create_thing.rb
26
- domain/command_processors/thing_processor.rb
27
27
  a resource route
@@ -1,18 +1,26 @@
1
+ require 'generators/drails/processor_name.rb'
2
+ require 'generators/drails/domain.rb'
3
+
1
4
  module Drails
2
5
  module Generators
3
6
  class ScaffoldGenerator < Rails::Generators::NamedBase
4
7
  source_root File.expand_path('../templates', __FILE__)
5
8
  argument :attributes, type: :array, default: [], banner: "field[:type] field[:type]"
9
+ include ProcessorName
10
+ include Domain
6
11
 
7
12
  def create_models
8
- generate 'drails:model', name, 'false', attr_string
13
+ generate 'drails:model', name, attr_string
9
14
  end
10
15
 
11
16
  def create_commands
12
17
  %w(create update delete).each do |action|
13
18
  attr_arg = attributes_names.join(' ') unless action == 'delete'
14
- command = "#{name}_#{action}"
15
- generate 'drails:command', command, attr_arg
19
+ command = (class_path + ["#{action}_#{file_name}"]) * '/'
20
+ event_arg = "--event=" + (class_path + ["#{action}d_#{file_name}"]) * '/'
21
+ processor_arg = "--processor=#{processor_name}"
22
+ processor_arg = "--skip-processor" if skip_processor?
23
+ generate 'drails:command', command, attr_arg, processor_arg, event_arg
16
24
  add_to_projections(action)
17
25
  end
18
26
  end
@@ -20,11 +28,19 @@ module Drails
20
28
  def add_to_command_processor
21
29
  content = "
22
30
  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(.)*/
31
+ inject_into_file File.join('domain/command_processors', domain_class_path, "#{processor_file_name}_processor.rb"), content, after: /(\s)*process(\s)*(.)*CreateCommand(.)*/
24
32
  end
25
33
 
26
- def add_route
27
- route "resources :#{plural_name}"
34
+ def add_routes
35
+ routing_code = ""
36
+ class_path.each_with_index do |ns, i|
37
+ add_line_with_indent routing_code, (i + 1), "namespace :#{ns} do"
38
+ end
39
+ add_line_with_indent routing_code, (class_path.length + 1), "resources :#{plural_name}"
40
+ class_path.each_with_index do |ns, i|
41
+ add_line_with_indent routing_code, (class_path.length - i), "end"
42
+ end
43
+ route routing_code[2..-1]
28
44
  end
29
45
 
30
46
  def create_controller
@@ -32,45 +48,40 @@ module Drails
32
48
  end
33
49
 
34
50
  def copy_event_stream_client
35
- copy_file '_eventstream.js.erb', File.join('app', 'views', plural_file_name, '_eventstream.js.erb')
51
+ copy_file '_eventstream.js.erb', File.join('app/views', class_path, plural_file_name, '_eventstream.js.erb')
36
52
  end
37
53
 
38
- def add_event_stram_client_to_views
54
+ def add_event_stream_client_to_views
39
55
  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
56
+ prepend_to_file File.join('app/views', class_path, plural_file_name, 'index.html.erb'), include_text
57
+ prepend_to_file File.join('app/views', class_path, plural_file_name, 'show.html.erb'), include_text
42
58
  end
43
59
 
44
60
  private
61
+
45
62
  def attr_string
46
63
  @attr_string ||= attributes.map { |x| "#{x.name}:#{x.type}" }.join(' ')
47
64
  end
48
65
 
49
66
  def add_to_projections(action)
67
+ event_func = (class_path + ["#{action}d_#{file_name}_event"]) * '__'
50
68
  content = "
51
69
 
52
- def #{name.underscore}_#{action}_event(event)
70
+ def #{event_func}(event)
53
71
  #{method_bodies[action]}
54
72
  end"
55
- inject_into_file File.join('app', 'projections', class_path, "#{plural_file_name}_projection.rb"), content, after: /(\s)*include(\s)*ActiveProjection::ProjectionType/
73
+ inject_into_file File.join('app/projections', class_path, "#{plural_file_name}_projection.rb"), content, after: /(\s)*include(\s)*ActiveProjection::ProjectionType/
56
74
  end
57
75
 
58
76
  def method_bodies
59
77
  {
60
- 'create' => "#{human_name}.create! event.values.merge(id: event.id)",
61
- 'update' => "#{human_name}.find(event.id).update! event.values",
62
- 'delete' => "#{human_name}.find(event.id).destroy!",
78
+ 'create' => "#{class_name}.create! event.values.merge(id: event.id)",
79
+ 'update' => "#{class_name}.find(event.id).update! event.values",
80
+ 'delete' => "#{class_name}.find(event.id).destroy!",
63
81
  }
64
82
  end
65
-
66
- def domain_ns
67
- namespace_path = Array.new class_path
68
- if namespace_path.empty?
69
- namespace_path[0] = 'domain'
70
- else
71
- namespace_path[-1] += '_domain'
72
- end
73
- namespace_path
83
+ def add_line_with_indent(target, indent, str)
84
+ target << "#{" " * indent}#{str}\n"
74
85
  end
75
86
  end
76
87
  end
@@ -0,0 +1,54 @@
1
+ require 'active_support/concern'
2
+ require 'generators/drails/domain.rb'
3
+
4
+ module Drails
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)
@@ -1,7 +1,7 @@
1
1
  module RailsDisco
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 2
4
+ MINOR = 3
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
data/lib/tasks/db.rake CHANGED
@@ -2,108 +2,122 @@ require 'yaml'
2
2
  require 'logger'
3
3
  require 'active_record'
4
4
 
5
- namespace :db do
6
- def create_database config
7
- options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
8
-
9
- create_db = lambda do |config|
10
- ActiveRecord::Base.establish_connection config.merge('database' => nil)
11
- ActiveRecord::Base.connection.create_database config['database'], options
12
- ActiveRecord::Base.establish_connection config
13
- end
5
+ namespace :drails do
6
+ namespace :db do
7
+ def create_database(config)
8
+ options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
9
+
10
+ create_db = lambda do |config|
11
+ ActiveRecord::Base.establish_connection config.merge('database' => nil)
12
+ ActiveRecord::Base.connection.create_database config['database'], options
13
+ ActiveRecord::Base.establish_connection config
14
+ end
14
15
 
15
- begin
16
- create_db.call config
17
- rescue Mysql::Error => sqlerr
18
- if sqlerr.errno == 1405
19
- print "#{sqlerr.error}. \nPlease provide the root password for your mysql installation\n>"
20
- root_password = $stdin.gets.strip
16
+ begin
17
+ create_db.call config
18
+ rescue Mysql::Error => sqlerr
19
+ if sqlerr.errno == 1405
20
+ print "#{sqlerr.error}. \nPlease provide the root password for your mysql installation\n>"
21
+ root_password = $stdin.gets.strip
21
22
 
22
- grant_statement = <<-SQL
23
+ grant_statement = <<-SQL
23
24
  GRANT ALL PRIVILEGES ON #{config['database']}.*
24
25
  TO '#{config['username']}'@'localhost'
25
26
  IDENTIFIED BY '#{config['password']}' WITH GRANT OPTION;
26
- SQL
27
+ SQL
28
+
29
+ create_db.call config.merge('database' => nil, 'username' => 'root', 'password' => root_password)
30
+ else
31
+ $stderr.puts sqlerr.error
32
+ $stderr.puts "Couldn't create database for #{config.inspect}, charset: utf8, collation: utf8_unicode_ci"
33
+ $stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config['charset']
34
+ end
35
+ end
36
+ end
27
37
 
28
- create_db.call config.merge('database' => nil, 'username' => 'root', 'password' => root_password)
38
+ task :db_env do
39
+ DATABASE_ENV = ENV['DATABASE_ENV'] || 'development'
40
+ end
41
+
42
+ task :environment => :db_env do
43
+ if ENV['ENV'] == 'domain'
44
+ @migration_dir = ENV['MIGRATIONS_DIR'] || 'db/migrate_domain'
45
+ @env = 'domain'
29
46
  else
30
- $stderr.puts sqlerr.error
31
- $stderr.puts "Couldn't create database for #{config.inspect}, charset: utf8, collation: utf8_unicode_ci"
32
- $stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config['charset']
47
+ @migration_dir = ENV['MIGRATIONS_DIR'] || 'db/migrate'
48
+ @env = 'projection'
33
49
  end
34
50
  end
35
- end
36
-
37
- task :db_env do
38
- DATABASE_ENV = ENV['DATABASE_ENV'] || 'development'
39
- end
40
51
 
41
- task :environment, [:file_name] => [:db_env] do |t, args|
42
- if args.file_name == 'domain'
43
- @migration_dir = ENV['MIGRATIONS_DIR'] || 'db/migrate_domain'
44
- else
45
- @migration_dir = ENV['MIGRATIONS_DIR'] || 'db/migrate'
52
+ task :configuration => :environment do
53
+ @config = YAML.load_file("config/disco.yml")[DATABASE_ENV]["#{@env}_database"]
46
54
  end
47
- end
48
55
 
49
- task :configuration, [:file_name] => [:environment] do |t, args|
50
- @config = YAML.load_file("config/disco.yml")[DATABASE_ENV]["#{args.file_name}_database"]
51
- end
56
+ task :configure_connection => :configuration do
57
+ ActiveRecord::Base.establish_connection @config
58
+ ActiveRecord::Base.logger = Logger.new STDOUT if @config['logger']
59
+ end
52
60
 
53
- task :configure_connection => :configuration do
54
- ActiveRecord::Base.establish_connection @config
55
- ActiveRecord::Base.logger = Logger.new STDOUT if @config['logger']
56
- end
61
+ desc 'Create the database from config/disco.yml for the current DATABASE_ENV (options: ENV=(projection|domain))'
62
+ task :create => :configure_connection do
63
+ create_database @config
64
+ end
57
65
 
58
- desc 'Create the database from config/disco.yml for the current DATABASE_ENV'
59
- task :create => :configure_connection do
60
- create_database @config
61
- end
66
+ desc 'Drops the database for the current DATABASE_ENV (options: ENV=(projection|domain))'
67
+ task :drop => :configure_connection do
68
+ ActiveRecord::Base.connection.drop_database @config['database']
69
+ end
62
70
 
63
- desc 'Drops the database for the current DATABASE_ENV'
64
- task :drop => :configure_connection do
65
- ActiveRecord::Base.connection.drop_database @config['database']
66
- end
71
+ desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n) (options: ENV=(projection|domain)).'
72
+ task :rollback => :configure_connection do
73
+ step = ENV['STEP'] ? ENV['STEP'].to_i : 1
74
+ ActiveRecord::Migrator.rollback @migration_dir, step
75
+ end
67
76
 
68
- desc 'Migrate the database (options: VERSION=x, VERBOSE=false).'
69
- task :migrate => :configure_connection do
70
- ActiveRecord::Migration.verbose = true
71
- ActiveRecord::Migrator.migrate @migration_dir, ENV['VERSION'] ? ENV['VERSION'].to_i : nil
72
- end
77
+ desc 'Retrieves the current schema version number'
78
+ task :version => :configure_connection do
79
+ puts "Current version: #{ActiveRecord::Migrator.current_version}"
80
+ end
73
81
 
74
- desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).'
75
- task :rollback => :configure_connection do
76
- step = ENV['STEP'] ? ENV['STEP'].to_i : 1
77
- ActiveRecord::Migrator.rollback @migration_dir, step
78
- end
82
+ desc 'Copys the migrations files from the gems directories (options: ENV=(projection|domain))'
83
+ task :copy_migrations => :environment do
84
+ if @env == 'domain'
85
+ cp_r Gem::Specification.find_by_name('active_event').gem_dir + '/db/migrate/.', @migration_dir
86
+ cp_r Gem::Specification.find_by_name('active_domain').gem_dir + '/db/migrate/.', @migration_dir
87
+ else
88
+ cp_r Gem::Specification.find_by_name('active_projection').gem_dir + '/db/migrate/.', @migration_dir
89
+ end
90
+ end
79
91
 
80
- desc 'Retrieves the current schema version number'
81
- task :version => :configure_connection do
82
- puts "Current version: #{ActiveRecord::Migrator.current_version}"
83
- end
92
+ desc 'Migrates the database (options: VERSION=x, ENV=(projection|domain))'
93
+ task :migrate => :configure_connection do
94
+ ActiveRecord::Migration.verbose = true
95
+ ActiveRecord::Migrator.migrate @migration_dir, ENV['VERSION'] ? ENV['VERSION'].to_i : nil
96
+ end
84
97
 
85
- desc 'Migrates the domain database (for use in multi project setup)'
86
- task :setup_domain do
87
- Rake::Task[:'db:configuration'].invoke('domain')
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'
90
- Rake::Task[:'db:migrate'].invoke
91
- end
98
+ desc 'Copys the domain migrations and migrates the domain database'
99
+ task :setup_domain do
100
+ ENV['ENV'] = 'domain'
101
+ Rake::Task[:'drails:db:copy_migrations'].invoke
102
+ Rake::Task[:'drails:db:migrate'].invoke
103
+ end
92
104
 
93
- desc 'Migrates the projection database (for use in multi project setup)'
94
- task :setup_projection do
95
- Rake::Task[:'db:configuration'].invoke('projection')
96
- cp_r Gem::Specification.find_by_name('active_projection').gem_dir + '/db/migrate/.', 'db/migrate'
97
- Rake::Task[:'db:migrate'].invoke
98
- end
105
+ desc 'Copys the projection migrations and migrates the projection database'
106
+ task :setup_projection do
107
+ ENV['ENV'] = 'projection'
108
+ Rake::Task[:'drails:db:copy_migrations'].invoke
109
+ Rake::Task[:'drails:db:migrate'].invoke
110
+ end
99
111
 
100
- desc 'Migrates the domain and the projection database (for use in single project setup)'
101
- task :setup do
102
- Rake::Task[:'db:setup_domain'].invoke
103
- Rake::Task[:'db:environment'].reenable
104
- Rake::Task[:'db:configure_connection'].reenable
105
- Rake::Task[:'db:configuration'].reenable
106
- Rake::Task[:'db:migrate'].reenable
107
- Rake::Task[:'db:setup_projection'].invoke
112
+ desc 'Copys the gem migrations and migrates the domain and the projection database after'
113
+ task :setup do
114
+ Rake::Task[:'drails:db:setup_domain'].invoke
115
+ Rake::Task[:'drails:db:environment'].reenable
116
+ Rake::Task[:'drails:db:configure_connection'].reenable
117
+ Rake::Task[:'drails:db:configuration'].reenable
118
+ Rake::Task[:'drails:db:migrate'].reenable
119
+ Rake::Task[:'drails:db:copy_migrations'].reenable
120
+ Rake::Task[:'drails:db:setup_projection'].invoke
121
+ end
108
122
  end
109
123
  end
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.2.0
4
+ version: 0.3.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-10-04 00:00:00.000000000 Z
11
+ date: 2013-10-15 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.2.0
19
+ version: 0.3.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.2.0
26
+ version: 0.3.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.2.0
33
+ version: 0.3.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.2.0
40
+ version: 0.3.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.2.0
47
+ version: 0.3.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.2.0
54
+ version: 0.3.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 4.0.0
69
69
  description: 'Internals: rake tasks, generators, commandline interface'
70
- email: robert.kranz@hicknhack-software.com
70
+ email: rails-disco@hicknhack-software.com
71
71
  executables:
72
72
  - drails
73
73
  extensions: []
@@ -77,11 +77,9 @@ files:
77
77
  - lib/drails/domainserver.rb
78
78
  - lib/drails/generate.rb
79
79
  - lib/drails/projectionserver.rb
80
- - lib/drails/rake.rb
81
80
  - lib/drails/server/domain_server.rb
82
81
  - lib/drails/server/projection_servers.rb
83
82
  - lib/drails/server.rb
84
- - lib/drailties.rb
85
83
  - lib/generators/drails/app/app_generator.rb
86
84
  - lib/generators/drails/app/templates/build_validations_registry.rb
87
85
  - lib/generators/drails/app/templates/create_domain.rb
@@ -99,6 +97,8 @@ files:
99
97
  - lib/generators/drails/controller/templates/controller.rb
100
98
  - lib/generators/drails/controller/templates/controller_test.rb
101
99
  - lib/generators/drails/controller/USAGE
100
+ - lib/generators/drails/domain.rb
101
+ - lib/generators/drails/event_name.rb
102
102
  - lib/generators/drails/migration/migration_generator.rb
103
103
  - lib/generators/drails/migration/templates/create_table_migration.rb
104
104
  - lib/generators/drails/migration/USAGE
@@ -106,6 +106,7 @@ files:
106
106
  - lib/generators/drails/model/templates/domain_model.rb
107
107
  - lib/generators/drails/model/templates/model.rb
108
108
  - lib/generators/drails/model/USAGE
109
+ - lib/generators/drails/processor_name.rb
109
110
  - lib/generators/drails/projection/projection_generator.rb
110
111
  - lib/generators/drails/projection/templates/domain_projection.rb
111
112
  - lib/generators/drails/projection/templates/domain_projection_test.rb
@@ -115,6 +116,9 @@ files:
115
116
  - lib/generators/drails/scaffold/scaffold_generator.rb
116
117
  - lib/generators/drails/scaffold/templates/_eventstream.js.erb
117
118
  - lib/generators/drails/scaffold/USAGE
119
+ - lib/generators/drails/use_domain_option.rb
120
+ - lib/rails-disco/railtie.rb
121
+ - lib/rails-disco/tasks.rb
118
122
  - lib/rails-disco/version.rb
119
123
  - lib/tasks/db.rake
120
124
  - lib/tasks/split.rake
data/lib/drails/rake.rb DELETED
@@ -1,17 +0,0 @@
1
- # Run rake tasks from my_gem once it's installed.
2
- #
3
- # Example:
4
- # my_gem rake some-task
5
- # my_gem rake some-task[args]
6
- #
7
- # Author:: N David Brown
8
- gem_dir = File.expand_path("..", File.dirname(__FILE__))
9
- $LOAD_PATH.unshift gem_dir # Look in gem directory for resources first.
10
- require 'rake'
11
- require 'pp'
12
- pwd = Dir.pwd
13
- Dir.chdir(gem_dir) # We'll load rakefile from the gem's dir.
14
- Rake.application.init
15
- Rake.application.load_rakefile
16
- Dir.chdir(pwd) # Revert to original pwd for any path args passed to task.
17
- Rake.application.invoke_task(ARGV.first)
data/lib/drailties.rb DELETED
@@ -1,3 +0,0 @@
1
- module Drailties
2
- # Your code goes here...
3
- end