Class: SyncMachineGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- SyncMachineGenerator
- Defined in:
- lib/generators/sync_machine_generator.rb
Overview
Generate SyncMachine files.
Instance Method Summary collapse
- #append_subscribe_to_initializer ⇒ Object
- #create_change_listener_file ⇒ Object
- #create_ensure_publication_worker_file ⇒ Object
- #create_find_subjects_worker_file ⇒ Object
Instance Method Details
#append_subscribe_to_initializer ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/generators/sync_machine_generator.rb', line 31 def append_subscribe_to_initializer initializer_path = "config/initializers/sync_machines.rb" create_file(initializer_path, "") unless File.exist?(initializer_path) append_to_file( initializer_path, "#{class_name}::ChangeListener.subscribe\n" ) end |
#create_change_listener_file ⇒ Object
25 26 27 28 29 |
# File 'lib/generators/sync_machine_generator.rb', line 25 def create_change_listener_file template( "change_listener.rb", "app/services/#{file_path}/change_listener.rb" ) end |
#create_ensure_publication_worker_file ⇒ Object
18 19 20 21 22 23 |
# File 'lib/generators/sync_machine_generator.rb', line 18 def create_ensure_publication_worker_file template( "ensure_publication_worker.rb", "app/workers/#{file_path}/ensure_publication_worker.rb" ) end |
#create_find_subjects_worker_file ⇒ Object
11 12 13 14 15 16 |
# File 'lib/generators/sync_machine_generator.rb', line 11 def create_find_subjects_worker_file template( "find_subjects_worker.rb", "app/workers/#{file_path}/find_subjects_worker.rb" ) end |