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

Features request #47

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/spec/reports/
/tmp/
/Gemfile.lock
/.idea/
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ gem exec nextgen create myapp

This will download the latest version of the `nextgen` gem and use it to create an app in the `myapp` directory. You'll be asked to configure the tech stack through several interactive prompts. If you have a `~/.railsrc` file, it will be ignored.

Options:
- `style`: control the **optional enhancements** you can choose in the generator.
- defaults to `default`, [enhancements list](config)
- presets:
- `full` (`--style=full`), [enhancements list](config/styles/full)
- your local configs: `--style=path/to/your/style_dir`

> [!TIP]
> If you get an "Unknown command exec" error, fix it by upgrading rubygems: `gem update --system`.

Expand All @@ -59,7 +66,7 @@ Check out the [examples directory](./examples) to see some Rails apps that were
On top of that foundation, Nextgen offers dozens of useful enhancements to the vanilla Rails experience. You are free to pick and choose which (if any) of these to apply to your new project. Behind the scenes, **each enhancement is applied in a separate git commit,** so that you can later see what was applied and why, and revert the suggestions if necessary.

> [!TIP]
> For the full list of what Nextgen provides, check out [config/generators.yml](https://github.com/mattbrictson/nextgen/tree/main/config/generators.yml). The source code of each generator can be found in [lib/nextgen/generators](https://github.com/mattbrictson/nextgen/tree/main/lib/nextgen/generators).
> For the full list of what Nextgen provides, check out [config/*.yml](https://github.com/mattbrictson/nextgen/tree/main/config). The source code of each generator can be found in [lib/nextgen/generators](https://github.com/mattbrictson/nextgen/tree/main/lib/nextgen/generators).

Here are some highlights of what Nextgen brings to the table:

Expand All @@ -71,6 +78,11 @@ Nextgen can optionally set up a GitHub Actions CI workflow for your app that aut

Prefer RSpec? Nextgen can set you up with RSpec, plus the gems and configuration you need for system specs (browser testing). Or stick with the Rails Minitest defaults. In either case, Nextgen will set up a good default Rake task and appropriate CI job.

### Job Backends

- [sidekiq](https://github.com/sidekiq/sidekiq)
- [solid_queue](https://github.com/basecamp/solid_queue) (`--style=full`)

### Gems

Nextgen can install and configure your choice of these recommended gems:
Expand All @@ -90,7 +102,6 @@ Nextgen can install and configure your choice of these recommended gems:
- [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler)
- [rubocop](https://github.com/rubocop/rubocop)
- [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers)
- [sidekiq](https://github.com/sidekiq/sidekiq)
- [thor](https://github.com/rails/thor)
- [tomo](https://github.com/mattbrictson/tomo)
- [vcr](https://github.com/vcr/vcr)
Expand Down
29 changes: 29 additions & 0 deletions config/basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
initial_git_commit:

base:
description: "Enhance base Rails template with better docs, etc"

clean_gemfile:
description: "Clean up Gemfile"

git_safe:

action_mailer:
description: "Improve Action Mailer support for absolute URLs and testing"
requires: action_mailer

rspec_rails:
description: "Install and configure rspec-rails"
requires: rspec

rspec_system_testing:
description: "Install capybara + selenium-webdriver and set up system specs"
requires:
- rspec
- system_testing

tailwind:
questions:
- variable: tailwind_puma__no
method: no?
question: "Integrate tailwind watch with Puma (as plugin)? *defaults to NO*"
41 changes: 41 additions & 0 deletions config/checkers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

node:
description: "Set up Node and Yarn"

brakeman:
prompt: "Brakeman"
description: "Install brakeman gem for security checks"

bundler_audit:
prompt: "Bundler Audit"
description: "Install bundler-audit gem to detect CVEs in Ruby dependencies"

erb_lint:
prompt: "ERB Lint"
description: "Install erb_lint gem and correct existing issues"
requires: frontend

eslint:
prompt: "ESLint"
description: "Install eslint + supporting packages; apply prettier format"
requires: frontend
node: true

good_migrations:
prompt: "good_migrations"
description: "Install good_migrations gem"
requires: active_record

stylelint:
prompt: "Stylelint"
description: "Install stylelint and apply prettier format to CSS"
requires: frontend
node: true

rubocop:
prompt: "RuboCop"
description: "Install rubocop gems; apply formatting rules"

overcommit:
prompt: "Overcommit"
description: "Configure overcommit pre-commit git hooks"
12 changes: 12 additions & 0 deletions config/code_snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

home_controller:
description: "Create a controller, view, and route for the home page"
requires: frontend

basic_auth:
prompt: "BasicAuth controller concern"
description: "Allow app to be secured with ENV-based basic auth credentials"

current:
prompt: "Current.user"
description: "Intro thread-isolated attributes singleton `Current`, which resets automatically before and after each request"
69 changes: 69 additions & 0 deletions config/gems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

node:
description: "Set up Node and Yarn"

vite:
description: "Replace the asset pipeline with Vite in app/frontend"
requires: vite
node: true

annotate:
prompt: "Annotate Models"
description: "Install annotate gem to auto-generate schema annotations"
requires: active_record

capybara_lockstep:
prompt: "capybara-lockstep"
description: "Install capybara-lockstep gem for less-flaky browser testing"
requires: system_testing

dotenv:
prompt: "dotenv"
description: "Install dotenv gem and add .env.sample"

factory_bot_rails:
prompt: "Factory Bot"
description: "Install and configure factory_bot_rails gem"
requires: active_record

letter_opener:
prompt: "letter_opener"
description: "Install letter_opener gem to use with Action Mailer in dev"
requires: action_mailer

open_browser_on_start:
prompt: "Open browser on startup"
description: "Configure puma to launch browser on startup in development"
requires: frontend

pgcli_rails:
prompt: "pgcli_rails"
description: "Install pgcli_rails gem to allow easy use of pgcli"
requires: postgresql

rack_canonical_host:
prompt: "rack-canonical-host"
description: "Install rack-canonical-host gem; use RAILS_HOSTNAME"

rack_mini_profiler:
prompt: "rack-mini-profiler"
description: "Install rack-mini-profiler gem in development"
requires: frontend

shoulda:
prompt: "shoulda"
description: "Install shoulda-matchers gem for concise model testing"
requires: test_framework

thor:
prompt: "Thor"
description: "Configure Thor for ease of writing Rails tasks"

tomo:
prompt: "Tomo"
description: "Install tomo gem for SSH-based deployment"

vcr:
prompt: "VCR"
description: "Install and configure vcr and webmock gems"
requires: test_framework
151 changes: 0 additions & 151 deletions config/generators.yml

This file was deleted.

5 changes: 5 additions & 0 deletions config/job_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

sidekiq:
prompt: "Sidekiq (Redis-backed)"
description: "Install sidekiq gem to use in production"
requires: active_job
Empty file added config/styles/full/checkers.yml
Empty file.
Empty file.
Empty file added config/styles/full/gems.yml
Empty file.
9 changes: 9 additions & 0 deletions config/styles/full/job_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

solid_queue:
prompt: "SolidQueue (Database-backed)"
description: "Install solid_queue as ActiveJob's backend"
requires: active_job
questions:
- variable: solid_queue_puma__no
method: no?
question: "Run the SolidQueue supervisor together with Puma (as plugin)? *defaults to NO*"
Empty file.
8 changes: 8 additions & 0 deletions config/workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

github_actions:
prompt: "GitHub Actions"
description: "Configure GitHub Actions workflow for CI"

github_pr_template:
prompt: "GitHub PR template"
description: "Add GitHub pull request template"
Loading