nextgen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +143 -0
  4. data/config/generators.yml +146 -0
  5. data/exe/nextgen +13 -0
  6. data/lib/nextgen/actions/bundler.rb +62 -0
  7. data/lib/nextgen/actions/git.rb +56 -0
  8. data/lib/nextgen/actions/yarn.rb +32 -0
  9. data/lib/nextgen/actions.rb +155 -0
  10. data/lib/nextgen/cli.rb +19 -0
  11. data/lib/nextgen/commands/create.rb +312 -0
  12. data/lib/nextgen/ext/prompt/list.rb +13 -0
  13. data/lib/nextgen/ext/prompt/multilist.rb +16 -0
  14. data/lib/nextgen/generators/action_mailer.rb +26 -0
  15. data/lib/nextgen/generators/annotate.rb +2 -0
  16. data/lib/nextgen/generators/base.rb +60 -0
  17. data/lib/nextgen/generators/basic_auth.rb +5 -0
  18. data/lib/nextgen/generators/brakeman.rb +2 -0
  19. data/lib/nextgen/generators/bundler_audit.rb +2 -0
  20. data/lib/nextgen/generators/capybara_lockstep.rb +4 -0
  21. data/lib/nextgen/generators/clean_gemfile.rb +1 -0
  22. data/lib/nextgen/generators/dotenv.rb +3 -0
  23. data/lib/nextgen/generators/erb_lint.rb +11 -0
  24. data/lib/nextgen/generators/eslint.rb +24 -0
  25. data/lib/nextgen/generators/factory_bot_rails.rb +16 -0
  26. data/lib/nextgen/generators/git_safe.rb +4 -0
  27. data/lib/nextgen/generators/github_actions.rb +2 -0
  28. data/lib/nextgen/generators/good_migrations.rb +1 -0
  29. data/lib/nextgen/generators/home_controller.rb +3 -0
  30. data/lib/nextgen/generators/initial_git_commit.rb +5 -0
  31. data/lib/nextgen/generators/initial_migrations.rb +11 -0
  32. data/lib/nextgen/generators/letter_opener.rb +8 -0
  33. data/lib/nextgen/generators/node.rb +5 -0
  34. data/lib/nextgen/generators/open_browser_on_start.rb +12 -0
  35. data/lib/nextgen/generators/overcommit.rb +1 -0
  36. data/lib/nextgen/generators/pgcli_rails.rb +1 -0
  37. data/lib/nextgen/generators/rack_canonical_host.rb +8 -0
  38. data/lib/nextgen/generators/rack_mini_profiler.rb +2 -0
  39. data/lib/nextgen/generators/rspec_rails.rb +19 -0
  40. data/lib/nextgen/generators/rspec_system_testing.rb +5 -0
  41. data/lib/nextgen/generators/rubocop.rb +32 -0
  42. data/lib/nextgen/generators/shoulda.rb +6 -0
  43. data/lib/nextgen/generators/sidekiq.rb +30 -0
  44. data/lib/nextgen/generators/stylelint.rb +24 -0
  45. data/lib/nextgen/generators/thor.rb +2 -0
  46. data/lib/nextgen/generators/tomo.rb +10 -0
  47. data/lib/nextgen/generators/vite.rb +103 -0
  48. data/lib/nextgen/generators.rb +87 -0
  49. data/lib/nextgen/rails.rb +39 -0
  50. data/lib/nextgen/rails_options.rb +191 -0
  51. data/lib/nextgen/thor_extensions.rb +48 -0
  52. data/lib/nextgen/tidy_gemfile.rb +71 -0
  53. data/lib/nextgen/version.rb +3 -0
  54. data/lib/nextgen.rb +17 -0
  55. data/template/.editorconfig +14 -0
  56. data/template/.env.sample +2 -0
  57. data/template/.erb-lint.yml.tt +25 -0
  58. data/template/.eslintrc.cjs +26 -0
  59. data/template/.github/workflows/ci.yml.tt +142 -0
  60. data/template/.overcommit.yml.tt +86 -0
  61. data/template/.prettierrc.cjs +6 -0
  62. data/template/.rubocop.yml.tt +269 -0
  63. data/template/.stylelintrc.cjs +52 -0
  64. data/template/DEPLOYMENT.md +10 -0
  65. data/template/Procfile.tt +4 -0
  66. data/template/README.md.tt +52 -0
  67. data/template/Thorfile +7 -0
  68. data/template/app/controllers/concerns/basic_auth.rb +20 -0
  69. data/template/app/controllers/home_controller.rb +4 -0
  70. data/template/app/frontend/controllers/index.js +5 -0
  71. data/template/app/frontend/images/example.svg +3 -0
  72. data/template/app/frontend/stylesheets/base.css +8 -0
  73. data/template/app/frontend/stylesheets/index.css +3 -0
  74. data/template/app/frontend/stylesheets/reset.css +36 -0
  75. data/template/app/helpers/inline_svg_helper.rb +9 -0
  76. data/template/app/views/home/index.html.erb.tt +5 -0
  77. data/template/bin/setup +107 -0
  78. data/template/config/initializers/generators.rb +5 -0
  79. data/template/config/initializers/rack_mini_profiler.rb +4 -0
  80. data/template/config/initializers/sidekiq.rb +32 -0
  81. data/template/config/sidekiq.yml +5 -0
  82. data/template/lib/puma/plugin/open.rb +14 -0
  83. data/template/lib/tasks/auto_annotate_models.rake +52 -0
  84. data/template/lib/tasks/erblint.rake +11 -0
  85. data/template/lib/tasks/eslint.rake +11 -0
  86. data/template/lib/tasks/rubocop.rake +4 -0
  87. data/template/lib/tasks/stylelint.rake +11 -0
  88. data/template/lib/templates/rspec/system/system_spec.rb +10 -0
  89. data/template/lib/vite_inline_svg_file_loader.rb +25 -0
  90. data/template/package.json +6 -0
  91. data/template/postcss.config.js +3 -0
  92. data/template/spec/support/factory_bot.rb +3 -0
  93. data/template/spec/support/mailer.rb +5 -0
  94. data/template/spec/support/shoulda.rb +6 -0
  95. data/template/spec/support/system.rb +17 -0
  96. data/template/test/application_system_test_case.rb +18 -0
  97. data/template/test/helpers/inline_svg_helper_test.rb +23 -0
  98. data/template/test/support/factory_bot.rb +3 -0
  99. data/template/test/support/mailer.rb +3 -0
  100. data/template/test/support/shoulda.rb +6 -0
  101. data/template/test/support/vite.rb +5 -0
  102. metadata +220 -0
@@ -0,0 +1,26 @@
1
+ /** @type {import("@types/eslint").Linter.Config */
2
+
3
+ module.exports = {
4
+ env: {
5
+ browser: true,
6
+ es2021: true,
7
+ },
8
+ parserOptions: {
9
+ ecmaVersion: 2022,
10
+ sourceType: "module",
11
+ },
12
+ plugins: ["prettier"],
13
+ rules: {
14
+ "no-unused-vars": [
15
+ "error",
16
+ {
17
+ args: "after-used",
18
+ argsIgnorePattern: "^_",
19
+ varsIgnorePattern: "^_",
20
+ },
21
+ ],
22
+ "no-var": "error",
23
+ "prettier/prettier": "error",
24
+ },
25
+ extends: ["eslint:recommended", "prettier"],
26
+ };
@@ -0,0 +1,142 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+ env:
8
+ RAILS_ENV: test
9
+ jobs:
10
+ <% if minitest? || rspec? -%>
11
+ test:
12
+ name: "<%= minitest? ? "Test" : "RSpec" %>"
13
+ runs-on: ubuntu-latest
14
+ <% if gems.include?("pg") -%>
15
+ env:
16
+ DATABASE_URL: postgres://postgres:postgres@localhost:5432/ci
17
+ services:
18
+ postgres:
19
+ image: postgres:16-alpine
20
+ env:
21
+ POSTGRES_DB: ci
22
+ POSTGRES_USER: postgres
23
+ POSTGRES_PASSWORD: postgres
24
+ ports:
25
+ - 5432:5432
26
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
27
+ <% end -%>
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ bundler-cache: true
33
+ <% if File.exist?("package.json") -%>
34
+ - uses: actions/setup-node@v3
35
+ with:
36
+ <% if File.exist?(".node-version") -%>
37
+ node-version-file: ".node-version"
38
+ <% else -%>
39
+ node-version: "lts/*"
40
+ <% end -%>
41
+ cache: yarn
42
+ - run: npx --yes ci
43
+ <% end -%>
44
+ <% if gems.include?("capybara") -%>
45
+ - run: mkdir -p ./tmp/screenshots
46
+ <% end -%>
47
+ <% if File.exist?("config/database.yml") -%>
48
+ - run: bundle exec rake db:prepare
49
+ <% end -%>
50
+ <% if rspec? -%>
51
+ - run: bundle exec rspec
52
+ <% else -%>
53
+ - run: bundle exec rake test:all
54
+ <% end -%>
55
+ <% if gems.include?("capybara") -%>
56
+ - uses: actions/upload-artifact@v3
57
+ if: failure()
58
+ with:
59
+ name: capybara-screenshots
60
+ path: ./tmp/screenshots/
61
+ retention-days: 7
62
+ if-no-files-found: ignore
63
+ <% end -%>
64
+ <% end -%>
65
+ <% if gems.include?("erb_lint") -%>
66
+ erblint:
67
+ name: "Lint / erblint"
68
+ runs-on: ubuntu-latest
69
+ steps:
70
+ - uses: actions/checkout@v4
71
+ - uses: ruby/setup-ruby@v1
72
+ with:
73
+ bundler-cache: true
74
+ - run: bin/erblint --lint-all
75
+ <% end -%>
76
+ <% if Dir[".eslintrc*"].any? -%>
77
+ eslint:
78
+ name: "Lint / eslint"
79
+ runs-on: ubuntu-latest
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+ - uses: actions/setup-node@v3
83
+ with:
84
+ <% if File.exist?(".node-version") -%>
85
+ node-version-file: ".node-version"
86
+ <% else -%>
87
+ node-version: "lts/*"
88
+ <% end -%>
89
+ cache: yarn
90
+ - run: npx --yes ci
91
+ - run: yarn lint:js
92
+ <% end -%>
93
+ <% if gems.include?("rubocop") -%>
94
+ rubocop:
95
+ name: "Lint / rubocop"
96
+ runs-on: ubuntu-latest
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+ - uses: ruby/setup-ruby@v1
100
+ with:
101
+ bundler-cache: true
102
+ - run: bin/rubocop
103
+ <% end -%>
104
+ <% if Dir[".stylelintrc*"].any? -%>
105
+ stylelint:
106
+ name: "Lint / stylelint"
107
+ runs-on: ubuntu-latest
108
+ steps:
109
+ - uses: actions/checkout@v4
110
+ - uses: actions/setup-node@v3
111
+ with:
112
+ <% if File.exist?(".node-version") -%>
113
+ node-version-file: ".node-version"
114
+ <% else -%>
115
+ node-version: "lts/*"
116
+ <% end -%>
117
+ cache: yarn
118
+ - run: npx --yes ci
119
+ - run: yarn lint:css
120
+ <% end -%>
121
+ <% if gems.include?("brakeman") -%>
122
+ brakeman:
123
+ name: "Security / brakeman"
124
+ runs-on: ubuntu-latest
125
+ steps:
126
+ - uses: actions/checkout@v4
127
+ - uses: ruby/setup-ruby@v1
128
+ with:
129
+ bundler-cache: true
130
+ - run: bundle exec brakeman --exit-on-warn --no-progress --color --output /dev/stdout
131
+ <% end -%>
132
+ <% if gems.include?("bundler-audit") -%>
133
+ bundle-audit:
134
+ name: "Security / bundle-audit"
135
+ runs-on: ubuntu-latest
136
+ steps:
137
+ - uses: actions/checkout@v4
138
+ - uses: ruby/setup-ruby@v1
139
+ with:
140
+ bundler-cache: true
141
+ - run: bundle exec bundle-audit check --update -v
142
+ <% end -%>
@@ -0,0 +1,86 @@
1
+ gemfile: false
2
+ verify_signatures: false
3
+
4
+ PreCommit:
5
+ BundleCheck:
6
+ enabled: true
7
+
8
+ <% if File.exist?(".erb-lint.yml") -%>
9
+ ErbLint:
10
+ enabled: true
11
+ required_executable: bundle
12
+ command: ["bundle", "exec", "erblint"]
13
+ include: "**/*.html.erb"
14
+ <% end -%>
15
+
16
+ <% if File.exist?(".eslintrc.cjs") -%>
17
+ EsLint:
18
+ enabled: true
19
+ required_executable: npx
20
+ command: ["npx", "--no-install", "eslint", "-f", "compact"]
21
+ include:
22
+ - app/assets/**/*.js
23
+ - app/assets/**/*.jsx
24
+ - app/components/**/*.js
25
+ - app/components/**/*.jsx
26
+ - app/frontend/**/*.js
27
+ - app/frontend/**/*.jsx
28
+ - app/javascript/**/*.js
29
+ - app/javascript/**/*.jsx
30
+ - app/assets/**/*.ts
31
+ - app/assets/**/*.tsx
32
+ - app/components/**/*.ts
33
+ - app/components/**/*.tsx
34
+ - app/frontend/**/*.ts
35
+ - app/frontend/**/*.tsx
36
+ - app/javascript/**/*.ts
37
+ - app/javascript/**/*.tsx
38
+ <% end -%>
39
+
40
+ FixMe:
41
+ enabled: true
42
+ keywords: ["FIXME"]
43
+ exclude:
44
+ - .overcommit.yml
45
+
46
+ LocalPathsInGemfile:
47
+ enabled: true
48
+
49
+ <% if File.exist?("config/database.yml") -%>
50
+ RailsSchemaUpToDate:
51
+ enabled: true
52
+ <% end -%>
53
+
54
+ <% if File.exist?(".rubocop.yml") -%>
55
+ RuboCop:
56
+ enabled: true
57
+ required_executable: bundle
58
+ command: ["bundle", "exec", "rubocop"]
59
+ on_warn: fail
60
+ <% end -%>
61
+
62
+ <% if File.exist?(".stylelintrc.cjs") -%>
63
+ Stylelint:
64
+ enabled: true
65
+ required_executable: npx
66
+ command: ["npx", "--no-install", "stylelint"]
67
+ include:
68
+ - app/assets/**/*.css
69
+ - app/components/**/*.css
70
+ - app/frontend/**/*.css
71
+ - app/javascript/**/*.css
72
+ <% end -%>
73
+
74
+ TrailingWhitespace:
75
+ enabled: true
76
+ exclude:
77
+ - "**/db/structure.sql"
78
+
79
+ <% if File.exist?("yarn.lock") -%>
80
+ YarnCheck:
81
+ enabled: true
82
+ <% end -%>
83
+
84
+ PostCheckout:
85
+ ALL:
86
+ quiet: true
@@ -0,0 +1,6 @@
1
+ /** @type {import("prettier").Config} */
2
+
3
+ module.exports = {
4
+ tabWidth: 2,
5
+ useTabs: false,
6
+ };
@@ -0,0 +1,269 @@
1
+ require:
2
+ <%= plugins.map { " - rubocop-#{_1}" }.join("\n") %>
3
+
4
+ inherit_mode:
5
+ merge:
6
+ - Include
7
+
8
+ AllCops:
9
+ DisplayCopNames: true
10
+ DisplayStyleGuide: true
11
+ NewCops: enable
12
+ Include:
13
+ - .tomo/**/*.rb
14
+ Exclude:
15
+ # ignore bin/* except for bin/setup
16
+ - !ruby/regexp /<%%= Regexp.quote(File.expand_path("bin", __dir__)) %>\/(?!setup).*/
17
+ - .git/**/*
18
+ - db/*schema.rb
19
+ - log/**/*
20
+ - node_modules/**/*
21
+ - public/**/*
22
+ - storage/**/*
23
+ - tmp/**/*
24
+ - vendor/**/*
25
+
26
+ Layout/ArgumentAlignment:
27
+ EnforcedStyle: with_fixed_indentation
28
+
29
+ Layout/ExtraSpacing:
30
+ AllowForAlignment: false
31
+ AllowBeforeTrailingComments: true
32
+ ForceEqualSignAlignment: false
33
+
34
+ Layout/FirstArrayElementIndentation:
35
+ EnforcedStyle: consistent
36
+
37
+ Layout/FirstArrayElementLineBreak:
38
+ Enabled: true
39
+
40
+ Layout/FirstHashElementLineBreak:
41
+ Enabled: true
42
+
43
+ Layout/FirstMethodArgumentLineBreak:
44
+ Enabled: true
45
+
46
+ Layout/HashAlignment:
47
+ EnforcedHashRocketStyle: key
48
+ EnforcedColonStyle: key
49
+ EnforcedLastArgumentHashStyle: always_inspect
50
+
51
+ Layout/LineLength:
52
+ Exclude:
53
+ - config/initializers/content_security_policy.rb
54
+
55
+ Layout/MultilineArrayLineBreaks:
56
+ Enabled: true
57
+
58
+ Layout/MultilineHashKeyLineBreaks:
59
+ Enabled: true
60
+
61
+ Layout/MultilineMethodArgumentLineBreaks:
62
+ Enabled: true
63
+
64
+ Layout/MultilineMethodCallIndentation:
65
+ EnforcedStyle: indented
66
+
67
+ Layout/MultilineOperationIndentation:
68
+ EnforcedStyle: indented
69
+
70
+ Layout/SpaceInsideHashLiteralBraces:
71
+ EnforcedStyle: no_space
72
+ EnforcedStyleForEmptyBraces: no_space
73
+
74
+ Lint/AmbiguousBlockAssociation:
75
+ Enabled: false
76
+
77
+ Lint/DuplicateBranch:
78
+ Enabled: false
79
+
80
+ Metrics/AbcSize:
81
+ Enabled: false
82
+
83
+ Metrics/BlockLength:
84
+ Max: 25
85
+ Exclude:
86
+ - config/**/*
87
+ - test/**/*
88
+
89
+ Metrics/ClassLength:
90
+ Max: 200
91
+ Exclude:
92
+ - test/**/*
93
+
94
+ Metrics/CyclomaticComplexity:
95
+ Enabled: false
96
+
97
+ Metrics/MethodLength:
98
+ Max: 25
99
+ Exclude:
100
+ - bin/setup
101
+ - db/migrate/*
102
+ - test/**/*
103
+
104
+ Metrics/ModuleLength:
105
+ Max: 200
106
+ Exclude:
107
+ - config/**/*
108
+
109
+ Metrics/ParameterLists:
110
+ Max: 6
111
+
112
+ Metrics/PerceivedComplexity:
113
+ Max: 8
114
+ Exclude:
115
+ - bin/setup
116
+
117
+ <% if plugins.include?("minitest") -%>
118
+ Minitest/AssertPredicate:
119
+ Enabled: false
120
+
121
+ Minitest/AssertTruthy:
122
+ Enabled: false
123
+
124
+ Minitest/EmptyLineBeforeAssertionMethods:
125
+ Enabled: false
126
+
127
+ Minitest/MultipleAssertions:
128
+ Enabled: false
129
+
130
+ Minitest/RefuteFalse:
131
+ Enabled: false
132
+
133
+ Minitest/RefutePredicate:
134
+ Enabled: false
135
+ <% end -%>
136
+
137
+ Naming/FileName:
138
+ Exclude:
139
+ - .tomo/plugins/*.rb
140
+
141
+ Naming/MemoizedInstanceVariableName:
142
+ Enabled: false
143
+
144
+ Naming/VariableNumber:
145
+ Enabled: false
146
+
147
+ Rails/ApplicationRecord:
148
+ Exclude:
149
+ - db/migrate/**
150
+
151
+ Rails/BulkChangeTable:
152
+ Enabled: false
153
+
154
+ Rails/DefaultScope:
155
+ Enabled: true
156
+
157
+ Rails/Delegate:
158
+ Enabled: false
159
+
160
+ Rails/EnvironmentVariableAccess:
161
+ Enabled: false
162
+
163
+ Rails/HasAndBelongsToMany:
164
+ Enabled: false
165
+
166
+ Rails/HttpStatus:
167
+ Enabled: false
168
+
169
+ Rails/I18nLocaleTexts:
170
+ Enabled: false
171
+
172
+ Rails/Inquiry:
173
+ Enabled: false
174
+
175
+ Rails/NotNullColumn:
176
+ Enabled: false
177
+
178
+ Rails/RakeEnvironment:
179
+ Enabled: false
180
+
181
+ Rails/RefuteMethods:
182
+ Enabled: false
183
+
184
+ Rails/RequireDependency:
185
+ Enabled: true
186
+
187
+ Rails/RootPathnameMethods:
188
+ Enabled: false
189
+
190
+ Rails/SkipsModelValidations:
191
+ Enabled: false
192
+
193
+ <% if Gem::Version.new(Rails.version) >= Gem::Version.new("7.1.0.beta1") -%>
194
+ Rails/UnknownEnv:
195
+ Environments:
196
+ - development
197
+ - test
198
+ - production
199
+ - local
200
+ <% end -%>
201
+
202
+ Rails/Validation:
203
+ Enabled: false
204
+
205
+ Style/Alias:
206
+ Enabled: false
207
+
208
+ Style/AsciiComments:
209
+ Enabled: false
210
+
211
+ Style/ClassAndModuleChildren:
212
+ Enabled: false
213
+
214
+ Style/Documentation:
215
+ Enabled: false
216
+
217
+ Style/DoubleNegation:
218
+ Enabled: false
219
+
220
+ Style/EmptyMethod:
221
+ EnforcedStyle: expanded
222
+
223
+ Style/FetchEnvVar:
224
+ Enabled: false
225
+
226
+ Style/FormatStringToken:
227
+ Enabled: false
228
+
229
+ Style/FrozenStringLiteralComment:
230
+ Enabled: false
231
+
232
+ Style/GuardClause:
233
+ Enabled: false
234
+
235
+ Style/IfUnlessModifier:
236
+ Enabled: false
237
+
238
+ Style/ModuleFunction:
239
+ Enabled: false
240
+
241
+ Style/NumericPredicate:
242
+ Enabled: false
243
+
244
+ Style/PerlBackrefs:
245
+ Enabled: false
246
+
247
+ Style/RescueStandardError:
248
+ EnforcedStyle: implicit
249
+
250
+ Style/SingleLineMethods:
251
+ AllowIfMethodIsEmpty: false
252
+
253
+ Style/StringConcatenation:
254
+ Enabled: false
255
+
256
+ Style/StringLiterals:
257
+ EnforcedStyle: double_quotes
258
+
259
+ Style/StringLiteralsInInterpolation:
260
+ EnforcedStyle: double_quotes
261
+
262
+ Style/SymbolArray:
263
+ Enabled: false
264
+
265
+ Style/TrivialAccessors:
266
+ AllowPredicates: true
267
+
268
+ Style/YodaExpression:
269
+ Enabled: false
@@ -0,0 +1,52 @@
1
+ module.exports = {
2
+ plugins: ["stylelint-declaration-strict-value"],
3
+ extends: ["stylelint-config-standard", "stylelint-prettier/recommended"],
4
+ rules: {
5
+ "color-hex-length": null,
6
+ "declaration-empty-line-before": null,
7
+ "declaration-no-important": true,
8
+ "import-notation": null,
9
+ "max-nesting-depth": 1,
10
+ "no-empty-source": null,
11
+ "no-invalid-position-at-import-rule": null,
12
+ "property-no-unknown": [
13
+ true,
14
+ {
15
+ // Allow property used for css-fonts-4 variable fonts
16
+ ignoreProperties: ["font-named-instance"],
17
+ },
18
+ ],
19
+ "scale-unlimited/declaration-strict-value": [
20
+ "/color/",
21
+ {
22
+ disableFix: true,
23
+ ignoreValues: [
24
+ "currentcolor",
25
+ "inherit",
26
+ "initial",
27
+ "transparent",
28
+ "unset",
29
+ ],
30
+ },
31
+ ],
32
+ "selector-class-pattern": [
33
+ // classes must be in BEM form, like this:
34
+ // my_component
35
+ // my_component--variant
36
+ // my_component__element
37
+ // my_component__element--variant
38
+ // my_component__long_element_name
39
+ // my_component__long_element_name--variant
40
+ "^[a-z]+(_[a-z]+)*(__[a-z]+(_[a-z]+)*)?(--[a-z]+(_[a-z]+)*)*$",
41
+ {
42
+ resolveNestedSelectors: true,
43
+ message:
44
+ "Classes must be in BEM form like `my_component__element--variant`",
45
+ },
46
+ ],
47
+ "selector-max-compound-selectors": 2,
48
+ "selector-max-id": 0,
49
+ "selector-no-qualifying-type": true,
50
+ "shorthand-property-no-redundant-values": null,
51
+ },
52
+ };
@@ -0,0 +1,10 @@
1
+ # Deployment
2
+
3
+ ## Environment variables
4
+
5
+ These environment variables affect how the app functions when deployed in production.
6
+
7
+ - `RAILS_DISABLE_SSL` - Disable HSTS and secure cookies
8
+ - `RAILS_MAX_THREADS` - Number of threads per Puma process (default: 5)
9
+ - **REQUIRED** `SECRET_KEY_BASE` - Unique, secret key used to encrypt and sign cookies and other sensitive data
10
+ - `WEB_CONCURRENCY` - Number of Puma processes (default: number of CPUs)
@@ -0,0 +1,4 @@
1
+ web: bundle exec puma -C config/puma.rb
2
+ <% if File.exist?("config/database.yml") -%>
3
+ release: bundle exec rake db:migrate
4
+ <% end -%>
@@ -0,0 +1,52 @@
1
+ # <%= app_name %>
2
+
3
+ This is a Rails <%= Rails::VERSION::MAJOR %>.<%= Rails::VERSION::MINOR %> app.
4
+
5
+ ## Prerequisites
6
+
7
+ This project requires:
8
+
9
+ - Ruby (see [.ruby-version](./.ruby-version)), preferably managed using [rbenv](https://github.com/rbenv/rbenv)
10
+ <% if postgres -%>
11
+ - PostgreSQL must be installed and accepting connections
12
+ <% end -%>
13
+
14
+ On macOS, these [Homebrew](http://brew.sh) packages are recommended:
15
+
16
+ ```
17
+ brew install rbenv
18
+ <% if postgres -%>
19
+ brew install postgresql@16
20
+ <% end -%>
21
+ ```
22
+
23
+ ## Getting started
24
+
25
+ ### bin/setup
26
+
27
+ Run this script to install necessary dependencies and prepare the Rails app to be started for the first time.
28
+
29
+ ```
30
+ bin/setup
31
+ ```
32
+
33
+ > [!NOTE]
34
+ > The `bin/setup` script is idempotent and is designed to be run often. You should run it every time you pull code that introduces new dependencies or makes other significant changes to the project.
35
+
36
+ ### Run the app!
37
+
38
+ Start the Rails server with this command:
39
+
40
+ ```
41
+ bin/rails s
42
+ ```
43
+
44
+ The app will be located at <http://localhost:3000/>.
45
+
46
+ ## Development
47
+
48
+ Use this command to run the full suite of automated tests:
49
+
50
+ ```
51
+ bin/rake
52
+ ```
data/template/Thorfile ADDED
@@ -0,0 +1,7 @@
1
+ require_relative "config/environment" unless %w[-h --help help -T list -v version].include?(ARGV.first)
2
+
3
+ class << Thor
4
+ def exit_on_failure?
5
+ true
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ module BasicAuth
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action :require_basic_auth
6
+ end
7
+
8
+ private
9
+
10
+ def require_basic_auth
11
+ expected_username = ENV.fetch("BASIC_AUTH_USERNAME", nil)
12
+ expected_password = ENV.fetch("BASIC_AUTH_PASSWORD", nil)
13
+ return true if expected_username.blank? || expected_password.blank?
14
+
15
+ authenticate_or_request_with_http_basic do |username, password|
16
+ ActiveSupport::SecurityUtils.secure_compare(username, expected_username) & \
17
+ ActiveSupport::SecurityUtils.secure_compare(password, expected_password)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ import { application } from "./application";
2
+ import { registerControllers } from "stimulus-vite-helpers";
3
+
4
+ const controllers = import.meta.glob("./**/*_controller.js", { eager: true });
5
+ registerControllers(application, controllers);
@@ -0,0 +1,3 @@
1
+ <svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="2" y="2" width="176" height="176" rx="6" fill="white" stroke="#CCCCCC" stroke-width="4" stroke-miterlimit="0" stroke-linecap="round"/>
3
+ </svg>