Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent option defaults #45659

Merged
merged 2 commits into from Jul 26, 2022
Merged

Parent option defaults #45659

merged 2 commits into from Jul 26, 2022

Conversation

gmcgibbon
Copy link
Member

Prints default parent class for controller, job, and model generators.

Before:

% bin/rails g job
Running via Spring preloader in process 14274
Usage:
  rails generate job NAME [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
      [--skip-collision-check], [--no-skip-collision-check]  # Skip collision check
      [--queue=QUEUE]                                        # The queue name for the generated job
                                                             # Default: default
      [--parent=PARENT]                                      # The parent class for the generated job
  -t, [--test-framework=NAME]                                # Test framework to be invoked
                                                             # Default: test_unit

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Description:
    Generates a new job. Pass the job name, either CamelCased or
    under_scored, with or without the job postfix.

Examples:
    `bin/rails generate job checkout`

      Creates the the following files:

        Job:   app/jobs/checkout_job.rb
        Test:  test/jobs/checkout_job_test.rb

    `bin/rails generate job send_sms --queue=sms`

      Creates a job and test with a custom sms queue.

    `bin/rails generate job process_payment --parent=payment_job`

      Creates a job and test with a `PaymentJob` parent class.

After:

% bin/rails g job
Running via Spring preloader in process 14274
Usage:
  rails generate job NAME [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
      [--skip-collision-check], [--no-skip-collision-check]  # Skip collision check
      [--queue=QUEUE]                                        # The queue name for the generated job
                                                             # Default: default
      [--parent=PARENT]                                      # The parent class for the generated job
                                                             # Default: ApplicationJob
  -t, [--test-framework=NAME]                                # Test framework to be invoked
                                                             # Default: test_unit

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Description:
    Generates a new job. Pass the job name, either CamelCased or
    under_scored, with or without the job postfix.

Examples:
    `bin/rails generate job checkout`

      Creates the the following files:

        Job:   app/jobs/checkout_job.rb
        Test:  test/jobs/checkout_job_test.rb

    `bin/rails generate job send_sms --queue=sms`

      Creates a job and test with a custom sms queue.

    `bin/rails generate job process_payment --parent=payment_job`

      Creates a job and test with a `PaymentJob` parent class.

Also fixes a typo in the controller generator help text.

Print default parent class for controller, job, and model generators.

Before:

[--parent=PARENT]               # The parent class for the generated job

After:

[--parent=PARENT]               # The parent class for the generated job
                                # Default: ApplicationJob
@gmcgibbon gmcgibbon merged commit 8b94e87 into rails:main Jul 26, 2022
@gmcgibbon gmcgibbon deleted the parent_option_default branch July 26, 2022 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant