Class: Disco::Generators::AppGenerator
- Inherits:
-
Rails::Generators::AppGenerator
- Object
- Rails::Generators::AppGenerator
- Disco::Generators::AppGenerator
- Defined in:
- lib/disco/commands/application.rb,
lib/generators/disco/app/app_generator.rb
Overview
:nodoc:
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
We want to exit on failure to be kind to other libraries This is only when accessing via CLI.
Instance Method Summary collapse
- #add_event_source_route ⇒ Object
- #enable_concurrency ⇒ Object
- #enable_rake_tasks ⇒ Object
- #source_paths ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
We want to exit on failure to be kind to other libraries This is only when accessing via CLI
36 37 38 |
# File 'lib/disco/commands/application.rb', line 36 def self.exit_on_failure? true end |
Instance Method Details
#add_event_source_route ⇒ Object
76 77 78 79 |
# File 'lib/generators/disco/app/app_generator.rb', line 76 def add_event_source_route return if behavior == :revoke route "get 'event_source/:projection/:event' => 'event_source#projected', as: 'event_source'" end |
#enable_concurrency ⇒ Object
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/generators/disco/app/app_generator.rb', line 92 def enable_concurrency return if behavior == :revoke application 'config.preload_frameworks = true' application 'config.allow_concurrency = true' rescue Exception puts "Seems like you invoked it from an engine, so remember to put\n config.preload_frameworks = true config.allow_concurrency = true\n in your application.rb from the main application" end |
#enable_rake_tasks ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/generators/disco/app/app_generator.rb', line 81 def enable_rake_tasks return if behavior == :revoke content = " require 'rails-disco/tasks'" inject_into_file File.join('config/application.rb'), content, after: /require 'rails\/all'/ rescue Exception puts "Seems like you invoked it from an engine, so put\n require 'rails-disco/tasks'\n in your application.rb from the main application to have the rails disco rake tasks available" end |
#source_paths ⇒ Object
72 73 74 |
# File 'lib/generators/disco/app/app_generator.rb', line 72 def source_paths [File.join(Gem::Specification.find_by_name('railties').gem_dir, 'lib/rails/generators/rails/app/templates'), File.('../templates', __FILE__)] end |