Class: Servus::Generators::ServiceGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/servus/service/service_generator.rb

Overview

Rails generator for creating Servus service objects.

Generates a complete service structure including:

  • Service class file
  • RSpec test file

Examples:

Generate a service

rails g servus:service namespace/do_something_helpful user amount

Generated files

app/services/namespace/do_something_helpful/service.rb
spec/services/namespace/do_something_helpful/service_spec.rb

See Also:

Instance Method Summary collapse

Instance Method Details

#create_service_filevoid

This method returns an undefined value.

Creates all service-related files.

Generates the service class and spec file from templates.

Schemas are declared inline with the schema DSL, so there are no schema files to generate — the service template scaffolds them in place.



36
37
38
39
# File 'lib/generators/servus/service/service_generator.rb', line 36

def create_service_file
  template 'service.rb.erb', service_path
  template 'service_spec.rb.erb', service_path_spec
end