Class: Fx::Generators::AggregateGenerator Private

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/fx/aggregate/aggregate_generator.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/generators/fx/aggregate/aggregate_generator.rb', line 42

def self.next_migration_number(dir)
  ::ActiveRecord::Generators::Base.next_migration_number(dir)
end

Instance Method Details

#create_aggregate_definitionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
# File 'lib/generators/fx/aggregate/aggregate_generator.rb', line 19

def create_aggregate_definition
  if creating_new_aggregate?
    create_file definition.path
  else
    copy_file previous_definition.full_path, definition.full_path
  end
end

#create_aggregates_directoryObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
# File 'lib/generators/fx/aggregate/aggregate_generator.rb', line 13

def create_aggregates_directory
  unless aggregate_definition_path.exist?
    empty_directory(aggregate_definition_path)
  end
end

#create_migration_fileObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/fx/aggregate/aggregate_generator.rb', line 27

def create_migration_file
  return if skip_migration_creation?
  if updating_existing_aggregate?
    migration_template(
      "db/migrate/update_aggregate.erb",
      "db/migrate/update_aggregate_#{file_name}_to_version_#{version}.rb"
    )
  else
    migration_template(
      "db/migrate/create_aggregate.erb",
      "db/migrate/create_aggregate_#{file_name}.rb"
    )
  end
end