Sha256: 82da436a012fd49c269fb7437a36fcf6f94a2e55349aa0c3f8eac78fe24e7f8a
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
class DispatchJob < Rails::Generators::Base class Publisher < Rails::Generators::Base source_root File.expand_path('../templates/publisher', __FILE__) argument :handler_name, type: :string, required: true argument :publisher_name, type: :string, required: true class Rspec < Rails::Generators::Base source_root File.expand_path('../templates/publisher', __FILE__) argument :handler_name, type: :string, required: true argument :publisher_name, type: :string, required: true def generate_publisher_spec template "publisher_spec.rb.erb", "spec/publishers/#{publisher_name}_spec.rb" end end def generate_publisher template "publisher.rb.erb", "app/publishers/#{publisher_name}.rb" end hook_for :test_framework, in: "dispatch_job:publisher" end class Handler < Rails::Generators::Base source_root File.expand_path('../templates/handler', __FILE__) argument :handler_name, type: :string, required: true class Rspec < Rails::Generators::Base source_root File.expand_path('../templates/handler', __FILE__) argument :handler_name, type: :string, required: true def generate_handler_spec template "handler_spec.rb.erb", "spec/handlers/#{handler_name}_spec.rb" end end def generate_handler template "handler.rb.erb", "app/handlers/#{handler_name}.rb" end hook_for :test_framework, in: "dispatch_job:handler" end # source_root File.expand_path('../templates', __FILE__) class_option :publisher, default: :publisher, hide: true class_option :handler, default: :handler, hide: true argument :handler_name, type: :string hook_for :publisher do |publisher| invoke publisher, [handler_name, handler_name.underscore + "_publisher"] end hook_for :handler do |handler| invoke handler, [handler_name] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dispatch-rider-2.1.0 | lib/generators/dispatch_rider/job/dispatch_job_generator.rb |
dispatch-rider-2.0.0 | lib/generators/dispatch_rider/job/dispatch_job_generator.rb |