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
- .banner ⇒ Object
-
.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
.banner ⇒ Object
107 108 109 |
# File 'lib/generators/disco/app/app_generator.rb', line 107 def self. "disco new #{arguments.map(&:usage).join(' ')} [options]" end |
.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
78 79 80 81 |
# File 'lib/generators/disco/app/app_generator.rb', line 78 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
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/generators/disco/app/app_generator.rb', line 94 def enable_concurrency return if behavior == :revoke application 'config.preload_frameworks = true' application 'config.allow_concurrency = true' rescue 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
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/generators/disco/app/app_generator.rb', line 83 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 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
71 72 73 74 75 76 |
# File 'lib/generators/disco/app/app_generator.rb', line 71 def source_paths [ File.join(Gem::Specification.find_by_name('railties').gem_dir, 'lib/rails/generators/rails/app/templates'), File.('../templates', __FILE__), ] end |