Class: Railsmith::Generators::PipelineGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/railsmith/pipeline/pipeline_generator.rb

Overview

Scaffolds a Railsmith::Pipeline subclass and its companion spec file.

Basic usage:

  • rails g railsmith:pipeline Checkout -> app/pipelines/checkout_pipeline.rb -> spec/pipelines/checkout_pipeline_spec.rb

Namespaced (namespace from class name):

  • rails g railsmith:pipeline Billing::Checkout -> app/pipelines/billing/checkout_pipeline.rb -> spec/pipelines/billing/checkout_pipeline_spec.rb -> module Billing; class CheckoutPipeline

Domain mode (–domain):

  • rails g railsmith:pipeline Checkout –domain=Billing -> app/domains/billing/pipelines/checkout_pipeline.rb -> spec/domains/billing/pipelines/checkout_pipeline_spec.rb -> module Billing; class CheckoutPipeline

Instance Method Summary collapse

Instance Method Details

#create_pipelineObject



49
50
51
52
53
# File 'lib/generators/railsmith/pipeline/pipeline_generator.rb', line 49

def create_pipeline
  return if skip_existing_file?(target_file)

  template "pipeline.rb.tt", target_file
end

#create_specObject



55
56
57
58
59
# File 'lib/generators/railsmith/pipeline/pipeline_generator.rb', line 55

def create_spec
  return if skip_existing_file?(spec_file)

  template "pipeline_spec.rb.tt", spec_file
end