Class: EventSourceryGenerators::Generators::Query

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/event_sourcery_generators/generators/query.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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_rakefileObject



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_projectorObject



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_queryObject



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_apiObject



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