suspenders 20240516.0 → 20251219.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CODEOWNERS +9 -0
  4. data/CONTRIBUTING.md +71 -0
  5. data/FEATURES.md +177 -0
  6. data/GOALS.md +65 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +808 -0
  9. data/README.md +73 -60
  10. data/RELEASING.md +18 -0
  11. data/Rakefile +7 -10
  12. data/SECURITY.md +19 -0
  13. data/exe/suspenders +38 -0
  14. data/lib/suspenders/cli.rb +64 -0
  15. data/lib/suspenders/version.rb +4 -4
  16. data/lib/suspenders.rb +5 -6
  17. data/lib/templates/Procfile +3 -0
  18. data/lib/templates/Procfile.dev +2 -0
  19. data/lib/{generators/templates/views/flashes.html.erb → templates/app/views/application/_flashes.html.erb} +4 -2
  20. data/lib/templates/app/views/application/_form_errors.html.erb +11 -0
  21. data/lib/templates/config/initializers/sidekiq.rb +14 -0
  22. data/lib/templates/lib/development/seeder.rb +21 -0
  23. data/lib/templates/lib/tasks/development.rake +15 -0
  24. data/lib/templates/spec/support/action_mailer.rb +11 -0
  25. data/lib/{generators/templates/factories/factory_bot_rspec.rb → templates/spec/support/factory_bot.rb} +0 -2
  26. data/lib/templates/web.rb +544 -0
  27. data/sig/suspenders.rbs +4 -0
  28. metadata +34 -120
  29. data/lib/generators/suspenders/accessibility_generator.rb +0 -24
  30. data/lib/generators/suspenders/advisories_generator.rb +0 -32
  31. data/lib/generators/suspenders/ci_generator.rb +0 -57
  32. data/lib/generators/suspenders/email_generator.rb +0 -56
  33. data/lib/generators/suspenders/environments/development_generator.rb +0 -50
  34. data/lib/generators/suspenders/environments/production_generator.rb +0 -27
  35. data/lib/generators/suspenders/environments/test_generator.rb +0 -39
  36. data/lib/generators/suspenders/factories_generator.rb +0 -64
  37. data/lib/generators/suspenders/inline_svg_generator.rb +0 -24
  38. data/lib/generators/suspenders/install/web_generator.rb +0 -71
  39. data/lib/generators/suspenders/jobs_generator.rb +0 -34
  40. data/lib/generators/suspenders/lint_generator.rb +0 -94
  41. data/lib/generators/suspenders/prerequisites_generator.rb +0 -19
  42. data/lib/generators/suspenders/rake_generator.rb +0 -25
  43. data/lib/generators/suspenders/setup_generator.rb +0 -14
  44. data/lib/generators/suspenders/styles_generator.rb +0 -84
  45. data/lib/generators/suspenders/tasks_generator.rb +0 -20
  46. data/lib/generators/suspenders/testing_generator.rb +0 -113
  47. data/lib/generators/suspenders/views_generator.rb +0 -38
  48. data/lib/generators/templates/ci/ci.yml.tt +0 -148
  49. data/lib/generators/templates/ci/dependabot.yml +0 -7
  50. data/lib/generators/templates/email/email_interceptor.rb +0 -11
  51. data/lib/generators/templates/factories/factories.rb +0 -2
  52. data/lib/generators/templates/factories/factories_test.rb +0 -9
  53. data/lib/generators/templates/inline_svg/inline_svg.rb +0 -3
  54. data/lib/generators/templates/install/web/CONTRIBUTING.md +0 -94
  55. data/lib/generators/templates/lint/config_better_html.yml +0 -2
  56. data/lib/generators/templates/lint/config_initializers_better_html.rb +0 -9
  57. data/lib/generators/templates/lint/erb-lint.yml +0 -63
  58. data/lib/generators/templates/lint/erblint.rake +0 -47
  59. data/lib/generators/templates/lint/eslintrc.json +0 -7
  60. data/lib/generators/templates/lint/package.json +0 -4
  61. data/lib/generators/templates/lint/prettierignore +0 -1
  62. data/lib/generators/templates/lint/prettierrc +0 -11
  63. data/lib/generators/templates/lint/rubocop.yml.tt +0 -7
  64. data/lib/generators/templates/lint/stylelintrc.json +0 -3
  65. data/lib/generators/templates/prerequisites/node-version.tt +0 -1
  66. data/lib/generators/templates/setup/bin_setup.rb +0 -39
  67. data/lib/generators/templates/styles/postcss.config.js +0 -11
  68. data/lib/generators/templates/tasks/dev.rake +0 -12
  69. data/lib/generators/templates/testing/action_mailer.rb +0 -5
  70. data/lib/install/web.rb +0 -54
  71. data/lib/suspenders/cleanup/generate_readme.rb +0 -165
  72. data/lib/suspenders/cleanup/organize_gemfile.rb +0 -134
  73. data/lib/suspenders/engine.rb +0 -5
  74. data/lib/suspenders/generators.rb +0 -126
  75. data/lib/suspenders/railtie.rb +0 -4
  76. data/lib/tasks/suspenders.rake +0 -37
  77. /data/lib/{generators/templates/factories → templates/spec}/factories_spec.rb +0 -0
  78. /data/lib/{generators/templates/testing → templates/spec/support}/driver.rb +0 -0
  79. /data/lib/{generators/templates/testing → templates/spec/support}/i18n.rb +0 -0
  80. /data/lib/{generators/templates/testing → templates/spec/support}/shoulda_matchers.rb +0 -0
@@ -1,94 +0,0 @@
1
- # Contributing
2
-
3
- ## Accessibility Tooling
4
-
5
- Building accessible applications is a complex, multi-faceted, and mission critical endeavor. While tooling cannot guarantee an accessible experience, it can help raise the bar for the baseline experience in important ways.
6
-
7
- In addition to the W3C's [WAI Overview][], [WAI Authoring Practices Guide][], and [WAI-ARIA Specification][], along with MDN's [Accessibility Documentation][], the [thoughtbot handbook][] includes some high-level technical guidance.
8
-
9
- [WAI Overview]: https://www.w3.org/WAI/standards-guidelines/aria/
10
- [WAI Authoring Practices Guide]: https://www.w3.org/WAI/ARIA/apg/
11
- [WAI-ARIA Specification]: https://www.w3.org/TR/wai-aria/
12
- [Accessibility Documentation]: https://developer.mozilla.org/en-US/docs/Web/Accessibility
13
- [thoughtbot guides]: https://github.com/thoughtbot/guides/blob/main/accessibility/README.md#development
14
-
15
- ### Capybara and the System Test Suite
16
-
17
- [Capybara][] is responsible for driving the application's [System Test][] suite through Real Life browser sessions.
18
-
19
- Capybara drives the page and makes assertions about its state and content through utilities called [Selectors][]. They're a layer of abstraction that's a blend of HTML tag names and ARIA role semantics. For example, Capybara uses the `:link` selector whether it needs to locate and click on an `<a>` element through a call to [click_link][] or make an assertion about the presence and content of an `<a>` element through a call to [assert_link][].
20
-
21
- Out of the box, Capybara provides a wide range of [built-in selectors][] that cover the majority of a System Test harness' needs. In addition to the out of the box selectors, this project also depends on the [capybara_accessible_selectors][] gem to expand Capybara's set of selectors.
22
-
23
- If you find yourself in a situation where you're reaching for CSS selectors or other means of resolving nodes, you might benefit from a built-in selector or one provided by `capybara_accessible_selectors`. Take this test block, for example:
24
-
25
- ```ruby
26
- # <fieldset class="some-css selector-chain">
27
- # <legend>Some fields</legend>
28
- #
29
- # <button class="my-button">Click me</button>
30
- #
31
- # <label>
32
- # Fill me in
33
- # <input class=".my-text-field">
34
- # </label>
35
- # </fieldset>
36
-
37
- # BEFORE
38
- within ".some-css .selector-chain" do
39
- find(".my-button").click
40
- find(".my-text-field").set "Hello, world"
41
- end
42
-
43
- # AFTER
44
- within :fieldset, "Some field" do
45
- click_button "Click me"
46
- fill_in "Fill me in", with: "Hello, world"
47
- end
48
- ```
49
-
50
- The [Testing RSpec][] section of the `thoughtbot/guides` provides some general guidance for automated Acceptance Testing.
51
-
52
- [Capybara]: https://rubydoc.info/github/teamcapybara/capybara/master/
53
- [System Test]: https://guides.rubyonrails.org/testing.html#system-testing
54
- [Selectors]: https://rubydoc.info/github/teamcapybara/capybara/master#selectors
55
- [click_link]: https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Node/Actions:click_link
56
- [assert_link]: https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Minitest/Assertions:assert_link
57
- [built-in selectors]: https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Selector#built-in-selectors
58
- [capybara_accessible_selectors]: https://github.com/citizensadvice/capybara_accessible_selectors
59
- [Testing RSpec]: https://github.com/thoughtbot/guides/blob/main/testing-rspec/README.md#acceptance-tests
60
-
61
- ### `capybara_accessibility_audit` and `axe.js`
62
-
63
- This project depends on the [capybara_accessibility_audit][] gem to enhance the application's System Test suite to audit the browser's DOM for statically detectable accessibility violations. Under the hood, `capybara_accessibility_audit` utilizes [axe.js][] for auditing.
64
-
65
- The categories of violation that `capybara_accessibility_audit` can detect span a wide range from insufficient [color contrast][] to invalid or insufficient [landmark-based information hierarchy][landmark], to [unnamed form controls][] and beyond.
66
-
67
- Out of the box, `capybara_accessibility_audit` will extend Capybara to conduct an accessibility audit after a variety of actions like `visit` and `click_link`. That project can [be configured to suit this application's needs][capybara_accessibility_audit-configuration].
68
-
69
- If you can integrate `capybara_accessibility_audit` from the project's inception, you can start with (and maintain!) accessibility violation bankruptcy.
70
-
71
- [capybara_accessibility_audit]: https://github.com/thoughtbot/capybara_accessibility_audit
72
- [capybara_accessibility_audit-configuration]: https://github.com/thoughtbot/capybara_accessibility_audit?tab=readme-ov-file#frequently-asked-questions
73
- [axe.js]: https://www.deque.com/axe/
74
- [color contrast]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast
75
- [landmark]: https://developer.mozilla.org/en-US/blog/aria-accessibility-html-landmark-roles/
76
- [unnamed form controls]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Text_labels_and_names#form_elements_must_be_labeled
77
-
78
- ### VoiceOver on macos
79
-
80
- VoiceOver is a screen reader integrated directly into the macOS operating system. You can learn more from [Apple's Accessibility Support][].
81
-
82
- VoiceOver and Safari are tightly integrated. If you're developing this
83
- application on a Mac, you should familiarize yourself with how to navigate in
84
- Safari using VoiceOver. You can learn more about how to use VoiceOver from the
85
- [Get started with VoiceOver on Mac][]. You might also enjoy [Screen Reader
86
- Basics: VoiceOver][] in the A11ycasts series of videos from the "Chrome for Developers" YouTube channel.
87
-
88
- [![Watch Screen Reader Basics: VoiceOver](https://img.youtube.com/vi/5R-6WvAihms/maxresdefault.jpg)](https://www.youtube.com/watch?v=5R-6WvAihms)
89
-
90
- After you've written a System Test or have completed a feature, it can be **extremely** valuable to navigate to that part of the application and try your best to recreate the experience based on keyboard navigation and screen reader announcements alone.
91
-
92
- [Apple's Accessibility Support]: https://support.apple.com/accessibility
93
- [Get started with VoiceOver on Mac]: https://support.apple.com/guide/voiceover/get-started-vo4be8816d70/10/mac/14.0
94
- [Screen Reader Basics: VoiceOver]: https://www.youtube.com/watch?v=5R-6WvAihms
@@ -1,2 +0,0 @@
1
- ---
2
- allow_single_quoted_attributes: false
@@ -1,9 +0,0 @@
1
- Rails.configuration.to_prepare do
2
- if Rails.env.test?
3
- require "better_html"
4
-
5
- BetterHtml.config = BetterHtml::Config.new(Rails.configuration.x.better_html)
6
-
7
- BetterHtml.config.template_exclusion_filter = proc { |filename| !filename.start_with?(Rails.root.to_s) }
8
- end
9
- end
@@ -1,63 +0,0 @@
1
- ---
2
- glob: "app/views/**/*.{html,turbo_stream}{+*,}.erb"
3
-
4
- linters:
5
- AllowedScriptType:
6
- enabled: true
7
- allowed_types:
8
- - "module"
9
- - "text/javascript"
10
- ErbSafety:
11
- enabled: true
12
- better_html_config: "config/better_html.yml"
13
- GitHub::Accessibility::AvoidBothDisabledAndAriaDisabledCounter:
14
- enabled: true
15
- GitHub::Accessibility::AvoidGenericLinkTextCounter:
16
- enabled: true
17
- GitHub::Accessibility::DisabledAttributeCounter:
18
- enabled: true
19
- GitHub::Accessibility::IframeHasTitleCounter:
20
- enabled: true
21
- GitHub::Accessibility::ImageHasAltCounter:
22
- enabled: true
23
- GitHub::Accessibility::LandmarkHasLabelCounter:
24
- enabled: true
25
- GitHub::Accessibility::LinkHasHrefCounter:
26
- enabled: true
27
- GitHub::Accessibility::NestedInteractiveElementsCounter:
28
- enabled: true
29
- GitHub::Accessibility::NoAriaLabelMisuseCounter:
30
- enabled: true
31
- GitHub::Accessibility::NoPositiveTabIndexCounter:
32
- enabled: true
33
- GitHub::Accessibility::NoRedundantImageAltCounter:
34
- enabled: true
35
- GitHub::Accessibility::NoTitleAttributeCounter:
36
- enabled: true
37
- GitHub::Accessibility::SvgHasAccessibleTextCounter:
38
- enabled: true
39
- Rubocop:
40
- enabled: true
41
- rubocop_config:
42
- inherit_from:
43
- - .rubocop.yml
44
-
45
- Lint/EmptyBlock:
46
- Enabled: false
47
- Layout/InitialIndentation:
48
- Enabled: false
49
- Layout/TrailingEmptyLines:
50
- Enabled: false
51
- Layout/TrailingWhitespace:
52
- Enabled: false
53
- Layout/LeadingEmptyLines:
54
- Enabled: false
55
- Style/FrozenStringLiteralComment:
56
- Enabled: false
57
- Style/MultilineTernaryOperator:
58
- Enabled: false
59
- Lint/UselessAssignment:
60
- Exclude:
61
- - "app/views/**/*"
62
-
63
- EnableDefaultLinters: true
@@ -1,47 +0,0 @@
1
- module ERBLint
2
- module RakeSupport
3
- # Allow command line flags set in STANDARDOPTS (like MiniTest's TESTOPTS)
4
- def self.argvify
5
- if ENV["ERBLINTOPTS"]
6
- ENV["ERBLINTOPTS"].split(/\s+/)
7
- else
8
- []
9
- end
10
- end
11
-
12
- # DELETE THIS FILE AFTER MERGE:
13
- #
14
- # * https://github.com/Shopify/better-html/pull/95
15
- #
16
- def self.backport!
17
- BetterHtml::TestHelper::SafeErb::AllowedScriptType::VALID_JAVASCRIPT_TAG_TYPES.push("module")
18
- end
19
- end
20
- end
21
-
22
- desc "Lint templates with erb_lint"
23
- task "erblint" do
24
- require "erb_lint/cli"
25
- require "erblint-github/linters"
26
-
27
- ERBLint::RakeSupport.backport!
28
-
29
- cli = ERBLint::CLI.new
30
- success = cli.run(ERBLint::RakeSupport.argvify + ["--lint-all", "--format=compact"])
31
- fail unless success
32
- end
33
-
34
- desc "Lint and automatically fix templates with erb_lint"
35
- task "erblint:autocorrect" do
36
- require "erb_lint/cli"
37
- require "erblint-github/linters"
38
-
39
- ERBLint::RakeSupport.backport!
40
-
41
- cli = ERBLint::CLI.new
42
- success = cli.run(ERBLint::RakeSupport.argvify + ["--lint-all", "--autocorrect"])
43
- fail unless success
44
- end
45
-
46
- task "standard" => "erblint"
47
- task "standard:fix" => "erblint:autocorrect"
@@ -1,7 +0,0 @@
1
- {
2
- "extends": ["@thoughtbot/eslint-config/prettier"],
3
- "parserOptions": {
4
- "ecmaVersion": "latest",
5
- "sourceType": "module"
6
- }
7
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "app",
3
- "private": "true"
4
- }
@@ -1 +0,0 @@
1
- vendor/bundle/**
@@ -1,11 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "overrides": [
4
- {
5
- "files": ["**/*.css", "**/*.scss", "**/*.html"],
6
- "options": {
7
- "singleQuote": false
8
- }
9
- }
10
- ]
11
- }
@@ -1,7 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: <%= RUBY_VERSION %>
3
-
4
- require: standard
5
-
6
- inherit_gem:
7
- standard: config/base.yml
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@thoughtbot/stylelint-config"
3
- }
@@ -1 +0,0 @@
1
- <%= node_version %>
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "fileutils"
3
- require "bundler"
4
-
5
- # path to your application root.
6
- APP_ROOT = File.expand_path("..", __dir__)
7
-
8
- def system!(*args)
9
- system(*args, exception: true)
10
- end
11
-
12
- def using_node?
13
- File.exist? "package.json"
14
- end
15
-
16
- FileUtils.chdir APP_ROOT do
17
- puts "== Installing dependencies =="
18
- system! "gem install bundler --conservative"
19
- system("bundle check") || system!("bundle install")
20
- system("yarn install --check-files") if using_node?
21
-
22
- puts "\n== Preparing database and adding development seed data =="
23
- if File.exist? "lib/tasks/dev.rake"
24
- system! "bin/rails dev:prime"
25
- else
26
- system! "bin/rails db:prepare"
27
- end
28
-
29
- if Bundler.rubygems.find_name("sprockets")
30
- puts "\n== Generating assets =="
31
- system! "bin/rails assets:clobber assets:precompile"
32
- end
33
-
34
- puts "\n== Removing old logs and tempfiles =="
35
- system! "bin/rails log:clear tmp:clear"
36
-
37
- puts "\n== Restarting application server =="
38
- system! "bin/rails restart"
39
- end
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- plugins: [
3
- require('postcss-import'),
4
- require('postcss-nesting'),
5
- require('autoprefixer'),
6
- require('postcss-url')({
7
- url: 'copy',
8
- assetsPath: 'app/assets/static'
9
- })
10
- ],
11
- }
@@ -1,12 +0,0 @@
1
- if Rails.env.development? || Rails.env.test?
2
- require "factory_bot"
3
-
4
- namespace :dev do
5
- desc "Sample data for local development environment"
6
- task prime: "db:setup" do
7
- include FactoryBot::Syntax::Methods
8
-
9
- # create(:user, email: "user@example.com", password: "password")
10
- end
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before(:each) do
3
- ActionMailer::Base.deliveries.clear
4
- end
5
- end
data/lib/install/web.rb DELETED
@@ -1,54 +0,0 @@
1
- def node_version
2
- ENV["NODE_VERSION"] || `node --version`[/\d+\.\d+\.\d+/]
3
- end
4
-
5
- def node_not_installed?
6
- !node_version.present?
7
- end
8
-
9
- def node_version_unsupported?
10
- node_version < "20.0.0"
11
- end
12
-
13
- def apply_template!
14
- if node_not_installed? || node_version_unsupported?
15
- message = <<~ERROR
16
-
17
-
18
- === Node version unsupported ===
19
-
20
- Suspenders requires Node >= 20.0.0
21
- ERROR
22
-
23
- fail Rails::Generators::Error, message
24
- end
25
- if options[:database] == "postgresql" && options[:skip_test]
26
- after_bundle do
27
- gem_group :development, :test do
28
- gem "suspenders", github: "thoughtbot/suspenders"
29
- end
30
-
31
- run "bundle install"
32
-
33
- generate "suspenders:install:web"
34
- rails_command "db:prepare"
35
-
36
- say "\nCongratulations! You just pulled our suspenders."
37
- end
38
- else
39
- message = <<~ERROR
40
-
41
-
42
- === Please use the correct options ===
43
-
44
- rails new <app_name> \\
45
- --skip-test \\
46
- -d=postgresql \\
47
- -m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
48
- ERROR
49
-
50
- fail Rails::Generators::Error, message
51
- end
52
- end
53
-
54
- apply_template!
@@ -1,165 +0,0 @@
1
- require "rails/generators"
2
- require_relative "../../generators/suspenders/environments/development_generator"
3
- require_relative "../../generators/suspenders/environments/test_generator"
4
- require_relative "../../generators/suspenders/environments/production_generator"
5
- require_relative "../../generators/suspenders/accessibility_generator"
6
- require_relative "../../generators/suspenders/advisories_generator"
7
- require_relative "../../generators/suspenders/email_generator"
8
- require_relative "../../generators/suspenders/factories_generator"
9
- require_relative "../../generators/suspenders/inline_svg_generator"
10
- require_relative "../../generators/suspenders/jobs_generator"
11
- require_relative "../../generators/suspenders/lint_generator"
12
- require_relative "../../generators/suspenders/styles_generator"
13
- require_relative "../../generators/suspenders/testing_generator"
14
- require_relative "../../generators/suspenders/views_generator"
15
-
16
- module Suspenders
17
- module Cleanup
18
- class GenerateReadme
19
- include Suspenders::Generators::Helpers
20
-
21
- def self.perform(readme, app_name)
22
- new(readme, app_name).perform
23
- end
24
-
25
- attr_reader :readme, :app_name
26
-
27
- def initialize(readme, app_name)
28
- @readme = readme
29
- @app_name = app_name
30
- end
31
-
32
- def perform
33
- File.open(readme, "w+") do |file|
34
- @file = file
35
-
36
- heading app_name.titleize, level: 1
37
-
38
- prerequisites
39
-
40
- local_development
41
-
42
- heading "Configuration", level: 2
43
-
44
- heading "Test", level: 3
45
- description_for Suspenders::Generators::Environments::TestGenerator
46
-
47
- heading "Development", level: 3
48
- description_for Suspenders::Generators::Environments::DevelopmentGenerator
49
-
50
- heading "Production", level: 3
51
- description_for Suspenders::Generators::Environments::ProductionGenerator
52
-
53
- heading "Linting", level: 3
54
- description_for Suspenders::Generators::LintGenerator
55
-
56
- heading "Testing", level: 2
57
- description_for Suspenders::Generators::TestingGenerator
58
-
59
- heading "Factories", level: 3
60
- description_for Suspenders::Generators::FactoriesGenerator
61
-
62
- heading "Accessibility", level: 2
63
- description_for Suspenders::Generators::AccessibilityGenerator
64
- content <<~MARKDOWN
65
- For more information, review the [Accessibility Tooling][] section in
66
- the [CONTRIBUTING][] guide.
67
-
68
- [Accessibility Tooling]: ./CONTRIBUTING.md#accessibility-tooling
69
- [CONTRIBUTING]: ./CONTRIBUTING.md
70
- MARKDOWN
71
- new_line
72
-
73
- heading "Advisories", level: 2
74
- description_for Suspenders::Generators::AdvisoriesGenerator
75
-
76
- heading "Mailers", level: 2
77
- description_for Suspenders::Generators::EmailGenerator
78
-
79
- heading "Jobs", level: 2
80
- description_for Suspenders::Generators::JobsGenerator
81
-
82
- heading "Layout and Assets", level: 2
83
-
84
- heading "Stylesheets", level: 3
85
- description_for Suspenders::Generators::StylesGenerator
86
-
87
- heading "Inline SVG", level: 3
88
- description_for Suspenders::Generators::InlineSvgGenerator
89
-
90
- heading "Layout", level: 3
91
- description_for Suspenders::Generators::ViewsGenerator
92
- end
93
- end
94
-
95
- private
96
-
97
- def content(text)
98
- @file.write text
99
- end
100
-
101
- def new_line
102
- @file.write "\n"
103
- end
104
-
105
- def heading(text, level:)
106
- @file.write "#{"#" * level} #{text}\n"
107
- new_line
108
- end
109
-
110
- def description_for(generator)
111
- @file.write generator.desc
112
- new_line
113
- end
114
-
115
- def local_development
116
- @file.write <<~MARKDOWN
117
- ## Local Development
118
-
119
- ### Initial Setup
120
-
121
- ```
122
- bin/setup
123
- ```
124
-
125
- ### Running the Development Server
126
-
127
- ```
128
- bin/rails dev
129
- ```
130
-
131
- ### Seed Data
132
-
133
- - Use `db/seeds.rb` to create records that need to exist in all environments.
134
- - Use `lib/tasks/dev.rake` to create records that only need to exist in development.
135
-
136
- Running `bin/setup` will run `dev:prime`.
137
-
138
- ### Tasks
139
-
140
- - Use `bin/rails suspenders:db:migrate` to run [database migrations][]. This script ensures they are [reversible][].
141
- - Use `bin/rails suspenders:cleanup:organize_gemfile` to automatically organize the project's Gemfile.
142
- - Use `bin/rails default` to run the default Rake task. This will do the following:
143
- - Run the test suite.
144
- - Run a Ruby and ERB linter.
145
- - Scan the Ruby codebase for any dependency vulnerabilities.
146
-
147
- [database migrations]: https://edgeguides.rubyonrails.org/active_record_migrations.html#running-migrations
148
- [reversible]: https://edgeguides.rubyonrails.org/active_record_migrations.html#making-the-irreversible-possible
149
-
150
- MARKDOWN
151
- end
152
-
153
- def prerequisites
154
- heading "Prerequisites", level: 2
155
-
156
- @file.write <<~MARKDOWN
157
- Ruby: `#{Suspenders::MINIMUM_RUBY_VERSION}`
158
- Node: `#{node_version}`
159
- MARKDOWN
160
-
161
- new_line
162
- end
163
- end
164
- end
165
- end