Skip to content

Commit

Permalink
Add example Rails projects generated with Nextgen (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson authored Oct 13, 2023
1 parent f08526d commit 2a68a25
Show file tree
Hide file tree
Showing 402 changed files with 11,593 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ gemfile: false
verify_signatures: false

PreCommit:
ALL:
exclude:
- "examples/**/*"

BundleCheck:
enabled: true

Expand All @@ -14,6 +18,8 @@ PreCommit:
keywords: ["FIXME"]
exclude:
- .overcommit.yml
- template/.overcommit.yml.tt
- "examples/**/*"

LocalPathsInGemfile:
enabled: true
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AllCops:
NewCops: enable
TargetRubyVersion: 3.0
Exclude:
- "examples/**/*"
- "tmp/**/*"
- "vendor/**/*"

Expand Down
138 changes: 138 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Examples

The Rails apps in this directory were all generated by `gem exec nextgen create` with various interactive menu items chosen.

## default

[`examples/default`](./default) was created by choosing the default option for every question, and declining all optional Nextgen enhancements. This generally represents the default Rails "omakase" experience with a [base](../lib/nextgen/generators/base.rb) level of improvements.

```
What version of Rails will you use?
‣ 7.1.1
edge (7-1-stable branch)
Which database?
‣ SQLite3 (default)
PostgreSQL (recommended)
MySQL
More options...
What style of Rails app do you need?
‣ Standard, full-stack Rails (default)
API only
How will you manage frontend assets?
‣ Sprockets (default)
Propshaft
Vite
Which CSS framework will you use with the asset pipeline?
‣ None (default)
Bootstrap
Bulma
PostCSS
Sass
Tailwind
Which JavaScript bundler will you use with the asset pipeline?
‣ Importmap (default)
ESBuild
Rollup
Webpack
None
Which optional Rails frameworks do you need?
‣ ⬢ Hotwire
⬢ JBuilder
⬢ Action Mailer
⬢ Active Job
⬢ Action Cable
⬢ Active Storage
⬢ Action Text
⬢ Action Mailbox
Which test framework will you use?
‣ Minitest (default)
RSpec
None
Include system testing (capybara)?
‣ Yes (default)
No
Which optional enhancements would you like to add?
‣ ⬡ Annotate Models
⬡ BasicAuth controller concern
⬡ Brakeman
⬡ Bundler Audit
⬡ capybara-lockstep
⬡ dotenv-rails
⬡ ERB Lint
⬡ ESLint
⬡ Factory Bot
⬡ GitHub Actions
⬡ good_migrations
⬡ letter_opener
⬡ Open browser on startup
⬡ Overcommit
⬡ rack-canonical-host
⬡ rack-mini-profiler
⬡ RuboCop
⬡ shoulda
⬡ Sidekiq
⬡ Stylelint
⬡ Thor
⬡ Tomo
```

## rspec

[`examples/rspec`](./rspec) is the same as the default example, except "RSpec" was chosen when prompted to select a test framework:

```
Which test framework will you use?
Minitest (default)
‣ RSpec
None
```

## vite

[`examples/vite`](./vite) shows what is generated when "Vite" is chosen as an alternative to Sprockets.

```
How will you manage frontend assets?
Sprockets (default)
Propshaft
‣ Vite
```

## all

[`examples/all`](./all) shows what is generated when all optional Nextgen enhancements are selected, including Sidekiq, Factory Bot, GitHub Actions, RuboCop, and more than a dozen others.

```
Which optional enhancements would you like to add?
‣ ⬢ Annotate Models
⬢ BasicAuth controller concern
⬢ Brakeman
⬢ Bundler Audit
⬢ capybara-lockstep
⬢ dotenv-rails
⬢ ERB Lint
⬢ ESLint
⬢ Factory Bot
⬢ GitHub Actions
⬢ good_migrations
⬢ letter_opener
⬢ Open browser on startup
⬢ Overcommit
⬢ rack-canonical-host
⬢ rack-mini-profiler
⬢ RuboCop
⬢ shoulda
⬢ Sidekiq
⬢ Stylelint
⬢ Thor
⬢ Tomo
```
37 changes: 37 additions & 0 deletions examples/all/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
14 changes: 14 additions & 0 deletions examples/all/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab
2 changes: 2 additions & 0 deletions examples/all/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These environment variables are needed to run the app locally.
# Copy these into a file named .env to have them loaded automatically.
23 changes: 23 additions & 0 deletions examples/all/.erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
EnableDefaultLinters: true
exclude:
- "node_modules/**/*"
- "vendor/**/*"
linters:
ErbSafety:
enabled: true
Rubocop:
enabled: true
rubocop_config:
inherit_from:
- .rubocop.yml
Layout/InitialIndentation:
Enabled: false
Layout/TrailingEmptyLines:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Naming/FileName:
Enabled: false
Rails/OutputSafety:
Enabled: false
26 changes: 26 additions & 0 deletions examples/all/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @type {import("@types/eslint").Linter.Config */

module.exports = {
env: {
browser: true,
es2021: true,
},
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
plugins: ["prettier"],
rules: {
"no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"no-var": "error",
"prettier/prettier": "error",
},
extends: ["eslint:recommended", "prettier"],
};
9 changes: 9 additions & 0 deletions examples/all/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
90 changes: 90 additions & 0 deletions examples/all/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: CI
on:
pull_request:
push:
branches:
- main
env:
RAILS_ENV: test
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: yarn
- run: npx --yes ci
- run: mkdir -p ./tmp/screenshots
- run: bundle exec rake db:prepare
- run: bundle exec rake test:all
- uses: actions/upload-artifact@v3
if: failure()
with:
name: capybara-screenshots
path: ./tmp/screenshots/
retention-days: 7
if-no-files-found: ignore
erblint:
name: "Lint / erblint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bin/erblint --lint-all
eslint:
name: "Lint / eslint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: yarn
- run: npx --yes ci
- run: yarn lint:js
rubocop:
name: "Lint / rubocop"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bin/rubocop
stylelint:
name: "Lint / stylelint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: yarn
- run: npx --yes ci
- run: yarn lint:css
brakeman:
name: "Security / brakeman"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec brakeman --exit-on-warn --no-progress --color --output /dev/stdout
bundle-audit:
name: "Security / bundle-audit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec bundle-audit check --update -v
Loading

0 comments on commit 2a68a25

Please sign in to comment.