Class: EventSourceryGenerators::Generators::Query
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- EventSourceryGenerators::Generators::Query
- Includes:
- Thor::Actions
- Defined in:
- lib/event_sourcery_generators/generators/query.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_projector_to_rakefile ⇒ Object
- #create_projector ⇒ Object
- #create_query ⇒ Object
- #inject_query_to_api ⇒ Object
Class Method Details
.source_root ⇒ Object
9 10 11 |
# File 'lib/event_sourcery_generators/generators/query.rb', line 9 def self.source_root File.join(File.dirname(__FILE__), 'templates/query') end |
Instance Method Details
#add_projector_to_rakefile ⇒ Object
27 28 29 |
# File 'lib/event_sourcery_generators/generators/query.rb', line 27 def add_projector_to_rakefile insert_into_file('Rakefile', erb_file('projector_process.tt'), after: "processors = [\n") end |
#create_projector ⇒ Object
17 18 19 |
# File 'lib/event_sourcery_generators/generators/query.rb', line 17 def create_projector template('projector.rb.tt', "app/projections/#{query_name}/projector.rb") end |
#create_query ⇒ Object
13 14 15 |
# File 'lib/event_sourcery_generators/generators/query.rb', line 13 def create_query template('query.rb.tt', "app/projections/#{query_name}/query.rb") end |
#inject_query_to_api ⇒ Object
21 22 23 24 25 |
# File 'lib/event_sourcery_generators/generators/query.rb', line 21 def inject_query_to_api insert_into_file('app/web/server.rb', after: "< Sinatra::Base\n") do erb_file('api_endpoint.rb.tt') end end |