Class: Outbox::Generators::TransportGenerator
- Inherits:
-
NamedBase
- Object
- Rails::Generators::NamedBase
- NamedBase
- Outbox::Generators::TransportGenerator
show all
- Defined in:
- lib/generators/outbox/transport/transport_generator.rb
Constant Summary
Helpers::Values::VALUES_PATH
Helpers::Paas::APP_MANIFEST_PATH
Helpers::Initializer::OUTBOX_INITIALIZER_PATH
Helpers::Config::CONFIG_PATH
Instance Method Summary
collapse
#item_path, #namespaced_item_class_name
Instance Method Details
#check! ⇒ Object
24
25
26
|
# File 'lib/generators/outbox/transport/transport_generator.rb', line 24
def check!
check_config!
end
|
#check_item_exists! ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/generators/outbox/transport/transport_generator.rb', line 28
def check_item_exists!
return if item_exists?
raise Rails::Generators::Error, "Item `#{item_name}` does not exist in the `#{options[:kind]}_items` " \
"section of #{CONFIG_PATH}. You may insert this item by running " \
"`bin/rails g outbox:item #{item_name} --kind #{options[:kind]}`"
end
|
#check_name! ⇒ Object
18
19
20
21
22
|
# File 'lib/generators/outbox/transport/transport_generator.rb', line 18
def check_name!
return if options[:kind].in?(%w[inbox outbox])
raise Rails::Generators::Error, "Unknown transport type. Should be inbox or outbox"
end
|
#insert_transport ⇒ Object
36
37
38
39
|
# File 'lib/generators/outbox/transport/transport_generator.rb', line 36
def insert_transport
data = optimize_indentation(template, 6)
insert_into_file CONFIG_PATH, data, after: "#{item_name.underscore}:\n", force: true
end
|