-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Suspenders 3.0.0 #1135
Suspenders 3.0.0 #1135
Commits on Oct 30, 2023
-
In an effort to improve the developer experience and reduce technical debt, we replace the existing project with the output from running: ``` rails plugin new suspenders ``` This will allow us to use existing [testing helpers][] provided by Rails. Because of this, we deliberately switch from RSpec to MiniTest. Additionally, we move away from [calver][]. Prior to that the latest major version was `1`. This feels like a good opportunity to go back to `semver` and start fresh with `3.0.0` [testing helpers]: https://edgeguides.rubyonrails.org/generators.html#testing-generators [calver]: https://calver.org
Configuration menu - View commit details
-
Copy full SHA for 0ff6cc0 - Browse repository at this point
Copy the full SHA 0ff6cc0View commit details -
All generators will affect the "test" app located in `test/dummy`. Although the "test" app contains most files for a Rails application, it does not contain everything. This means during the setup phase of our tests, we'll need to create files to ensure the generator is working correctly. These helpers aim to improve the developer experience by creating a simple API to create and delete files in the "test" app. It should be noted that any files and directories created in the setup won't be removed automatically after each test, so we introduce additional helpers to be called during the [teardown][] callback. [teardown]: https://github.com/rails/rails/blob/00dfa109d6a5f4fb13d745f83d5cc779eba3b352/railties/lib/rails/generators/testing/setup_and_teardown.rb#L13
Configuration menu - View commit details
-
Copy full SHA for 6bd58f2 - Browse repository at this point
Copy the full SHA 6bd58f2View commit details -
Use [mocha][] for mocking and stubbing. Specifically, this will aid with testing that we correctly install a gem with bundler in our generators. [mocha]: https://github.com/freerange/mocha
Configuration menu - View commit details
-
Copy full SHA for 84e0c95 - Browse repository at this point
Copy the full SHA 84e0c95View commit details
Commits on Nov 3, 2023
-
Introduce
suspenders:accessibility
generator (#1137)Ported over from #1105 Installs [capybara_accessibility_audit] and [capybara_accessible_selectors]. `./bin/rails g suspenders:accessibility` Introduces `Suspenders::Generators::APIAppUnsupported` module for generators that cannot be run in an [API only][] application. This uses a [concern][] to ensure we raise an error before the generator including the module invokes any of its methods. [capybara_accessibility_audit]: https://github.com/thoughtbot/capybara_accessibility_audit [capybara_accessible_selectors]: https://github.com/citizensadvice/capybara_accessible_selectors [API only]: https://guides.rubyonrails.org/api_app.html [concern]: https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
Configuration menu - View commit details
-
Copy full SHA for 5a6b6e4 - Browse repository at this point
Copy the full SHA 5a6b6e4View commit details
Commits on Nov 9, 2023
-
Introduce
./bin/rails
to fix broken test runner (#1139)This is a work around for an [issue][] with `vim-test`. Borrowed an [existing][] `./bin/rails` configuration from an [Engine][], which is very similar to a [plugin][]. The only difference is that we do not need the `ENGINE_ROOT` setting. [issue]: vim-test/vim-test#477 [existing]: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt [Engine]: https://guides.rubyonrails.org/engines.html [plugin]: https://guides.rubyonrails.org/plugins.html
Configuration menu - View commit details
-
Copy full SHA for 5ff19c5 - Browse repository at this point
Copy the full SHA 5ff19c5View commit details
Commits on Nov 13, 2023
-
Introduce
suspenders:inline_svg
generator (#1140)Ports the existing generator to Suspenders 3.0.
Configuration menu - View commit details
-
Copy full SHA for 47bef29 - Browse repository at this point
Copy the full SHA 47bef29View commit details -
Configuration menu - View commit details
-
Copy full SHA for dbb1f98 - Browse repository at this point
Copy the full SHA dbb1f98View commit details
Commits on Nov 14, 2023
-
Use "ruby" as the PLATFORM for Gemfile.lock (#1142)
Dorian Marié committedNov 14, 2023 Configuration menu - View commit details
-
Copy full SHA for 04ea752 - Browse repository at this point
Copy the full SHA 04ea752View commit details
Commits on Nov 17, 2023
-
Introduce
suspenders:factories
generator (#1136)Maintains functionally with the [existing generator][] while adding support for the [default Rails test suite]. With this change, the generator can be invoked on a Rails application that uses RSpec or the [default Rails test suite][]. Adds generator which adds a test to lint all Factories in an effort to improve developer experience. Additionally, we remove the generation of the `dev:prime` task as we felt that should be the responsibly of another generator. [existing generator]: https://github.com/thoughtbot/suspenders/blob/main/lib/suspenders/generators/factories_generator.rb [default Rails test suite]: https://guides.rubyonrails.org/testing.html
Configuration menu - View commit details
-
Copy full SHA for 4f20aa8 - Browse repository at this point
Copy the full SHA 4f20aa8View commit details -
Remove implementation detail from
NEWS
NEWS should only contain items relevant to the consumer. Although the module improves the developer experience, it's not relevant to someone using the gem.
Configuration menu - View commit details
-
Copy full SHA for 6f1ec09 - Browse repository at this point
Copy the full SHA 6f1ec09View commit details
Commits on Nov 28, 2023
-
Introduce
suspenders:advisories
generator (#1138)Uses the [bundler-audit][] gem to update the local security database and show any relevant issues with the app's dependencies. This generator is only responsible for installing the gem and adding the Rake task. The [original implementation][] was written in 2014, and is no longer relevant. This is because the gem ships [with a Rake task][] that can be set as the default task, which will be addressed in #1144 Also exposes `backup_file` and `restore_file` test helpers into the public API. [bundler-audit]: https://github.com/rubysec/bundler-audit [original implementation]: e23157e [with a Rake task]: https://github.com/rubysec/bundler-audit#rake-tasks
Configuration menu - View commit details
-
Copy full SHA for 74603ad - Browse repository at this point
Copy the full SHA 74603adView commit details -
Introduce
suspenders:styles
generator (#1145)Configures applications to use [PostCSS][1] or [Tailwind][2] via [cssbundling-rails][3]. Defaults to `PostCSS` with [modern-normalize][8], with the option to override via `--css=tailwind`. These options were pulled from the [supported list of options][4] in Rails. Also creates additional stylesheets if using PostCSS. We choose to use [cssbundling-rails][4] instead of [dartsass-rails][5] or [tailwindcss-rails][6] (or even just css) because we want to rely on Node to process the CSS. Although we could have chosen to avoid using Node altogether, we feel it's better to support it since we'll need it for additional generators, like [StyleLintGenerator][7], and to support [modern-normalize][8]. Updates `within_api_only_app` by allowing support to conditionally comment out the api configuration. This provided and opportunity to clean up existing setup steps. [1]: https://postcss.org [2]: https://tailwindcss.com [3]: https://github.com/rails/cssbundling-rails [4]: https://github.com/rails/rails/blob/438cad462638b02210fc48b700c29dcd0428a8b7/railties/lib/rails/generators/app_base.rb#L22 [5]: https://github.com/rails/dartsass-rails [6]: https://github.com/rails/tailwindcss-rails [7]: https://github.com/thoughtbot/suspenders/blob/main/lib/suspenders/generators/stylelint_generator.rb [8]: https://github.com/sindresorhus/modern-normalize [9]: https://tailwindcss.com/docs/functions-and-directives#layer
Configuration menu - View commit details
-
Copy full SHA for 1a03e95 - Browse repository at this point
Copy the full SHA 1a03e95View commit details -
Modify
suspenders:styles
(#1146)These modifications were not captured before merging the #1145, presumably because of an issue with GitHub CLI.
Configuration menu - View commit details
-
Copy full SHA for 6bed72e - Browse repository at this point
Copy the full SHA 6bed72eView commit details
Commits on Dec 6, 2023
-
Introduce suspenders:jobs generator (#1147)
Ports the existing generator to Suspenders 3.0.
Configuration menu - View commit details
-
Copy full SHA for cb5dff8 - Browse repository at this point
Copy the full SHA cb5dff8View commit details
Commits on Dec 11, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 81e0e68 - Browse repository at this point
Copy the full SHA 81e0e68View commit details -
Introduce 'suspenders:lint` generator (#1148)
Closes #1107 Closes #1143 Creates a holistic linting solution that covers JavaScript, CSS, Ruby and ERB. Introduces [scripts][] that leverage [@thoughtbot/eslint-config][], [@thoughtbot/stylelint-config][] and [prettier][]. Also introduces `.prettierrc` based off of our [Guides][]. We need to pin `stylelint` and `@thoughtbot/stlyelint-config` to specific versions to account for this [open issue][]. Unfortunately, running `yarn run lint:stylelint` results in deprecation warnings, which will need to be addressed separately. [scripts]: https://docs.npmjs.com/cli/v6/using-npm/scripts [@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config [@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config [prettier]: https://prettier.io [Guides]: https://github.com/thoughtbot/guides/blob/main/javascript/README.md#formatting [open issue]: thoughtbot/stylelint-config#46 Introduces `rake standard` which also runs `erblint` to lint ERB files via [better_html][], [erb_lint][] and [erblint-github][]. [better_html]: https://github.com/Shopify/better-html [erb_lint]: https://github.com/Shopify/erb-lint [erblint-github]: https://github.com/github/erblint-github A future commit will ensure these linting rules are run during CI. In an effort to support that future commit, we ensure to run `yarn run fix:prettier` and `bundle exec standard:fix_unsafely` once the generator is complete. Otherwise, CI would fail because of linting violations. We call `standard:fix_unsafely` since `standard:fix` returns an error status code on new Rails applications. Running `standard:fix_unsafely` fixes this issue and returns a success status code. It should be noted that we deliberately permit this generator to be invoked on API only applications, because those applications can still contain views, like ones used for mailers. However, a future commit could explore removing the JavaScript linters. Also improves the developer experience by introducing `with_test_suite` helper, allowing the caller to run the generator in an application using minitest or RSpec.
Configuration menu - View commit details
-
Copy full SHA for fe5fc93 - Browse repository at this point
Copy the full SHA fe5fc93View commit details
Commits on Dec 12, 2023
-
Introduce
suspenders:rake
generator (#1144)Add necessary files to make the [plugin][] an [engine][], which automatically loads Rake tasks located in `lib/tasks`. This means when the `suspenders` gem is installed, the consumer can run `bundle exec rake suspenders:rake`, and any future tasks. Because `suspenders:lint` and `suspenders:advisories` may not necessarily have been invoked, we need to check if those gems are installed. [plugin]: https://guides.rubyonrails.org/plugins.html [engine]: https://guides.rubyonrails.org/engines.html Co-authored-by: Mike Burns <mburns@thoughtbot.com>
Configuration menu - View commit details
-
Copy full SHA for 551d60b - Browse repository at this point
Copy the full SHA 551d60bView commit details -
Fix stylelint violations when using Tailwind (#1153)
When we introduced #1148 we did not test it against applications that invoked `suspenders:styles --css=tailwind`.
Configuration menu - View commit details
-
Copy full SHA for 8628dcb - Browse repository at this point
Copy the full SHA 8628dcbView commit details
Commits on Jan 10, 2024
-
Introduce
suspenders:views
generator (#1154)Configures flash messages, page titles via the [title][] gem, and sets the document [lang][]. [title]: https://github.com/calebhearth/title [lang]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang It should be noted that running `rails gscaffold` generates [views][] that contain the flash. Although we could have [overridden][] this generator, that would risk drift between our overridden generator and the one in Rails core. Additionally, we decided to remove the `FlashesHelper` introduced in [6c562b9][] since that is not a pattern we currently use. [views]: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt [overridden]: https://guides.rubyonrails.org/generators.html#overriding-rails-generator-templates [6c562b9]: 6c562b9
Configuration menu - View commit details
-
Copy full SHA for 51dcd4b - Browse repository at this point
Copy the full SHA 51dcd4bView commit details
Commits on Feb 16, 2024
-
Introduce
suspenders:setup
generator (#1157)Replaces the [default setup script][] provided by Rails. The trade-off being that the implementation is simple, but the cost is we risk drifting from Rails. After attempting to use [gsub_file][] and [insert_into_file][], it felt simpler to just override the file completely. Conditionally call [dev:prime][] to seed development data on top of [seed][] data necessary for production. A follow-up commit will re-introduce this task. Additionally, we [setup the test environment][] to avoid issues with asset compilation. [default setup script]: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/bin/setup.tt [gsub_file]: https://rubydoc.info/gems/thor/Thor/Actions#gsub_file-instance_method [insert_into_file]: https://rubydoc.info/gems/thor/Thor/Actions#insert_into_file-instance_method [dev:prime]: https://thoughtbot.com/blog/priming-the-pump [seed]: https://guides.rubyonrails.org/active_record_migrations.html#migrations-and-seed-data [setup the test environment]: https://github.com/rails/rails/pull/47719/files
Configuration menu - View commit details
-
Copy full SHA for b065ae9 - Browse repository at this point
Copy the full SHA b065ae9View commit details -
Configuration menu - View commit details
-
Copy full SHA for c16e593 - Browse repository at this point
Copy the full SHA c16e593View commit details
Commits on Feb 20, 2024
-
Introduce
suspenders:tasks
generator (#1160)Relates to #1157 For now, this generator simply creates `dev.rake` which contains [dev:prime][]. Note that we'll want this generator to run **after** `suspenders:factories`. If future application specific tasks need to be added, we can use this generator. However, this should not be confused with the existing pattern of creating tasks under the suspenders namespace, such as the existing `lib/tasks/suspenders.rake`. Tasks under this namespace cannot be edited by the consumer, whereas tasks generated by `suspenders:tasks` are intended to be edited by the consumer. [dev:prime]: https://thoughtbot.com/blog/priming-the-pump
Configuration menu - View commit details
-
Copy full SHA for 63fa9cd - Browse repository at this point
Copy the full SHA 63fa9cdView commit details -
Introduce
suspenders:db:migrate
task (#1161)Lifted from our [dotfiles][], this task runs the latest migration, rolls it back, and runs it again in an effort to ensure it's reversible. More context can be found [in these comments][]. Unfortunately, the following implementation did not work because Rake recognized that it `db:migrate` was already invoked, so it wasn't invoked a second time. ```ruby task migrate: ["db:migrate", "db:rollback", "db:migrate", "db:test:prepare"] ``` Instead, we needed to `reenable` the task manually. [dotfiles]: https://github.com/thoughtbot/dotfiles/blob/f149484269ef98e2bc80b7daa1988e214ddf8e8b/aliases#L12 [in these comments]: thoughtbot/dotfiles@4882c41#r1933964
Configuration menu - View commit details
-
Copy full SHA for 647bb4c - Browse repository at this point
Copy the full SHA 647bb4cView commit details
Commits on Feb 28, 2024
-
Introduce
suspenders:email
generator (#1162)Creates [email interceptor][] to ensure emails are sent to preconfigured addresses in non-production environments. Drops support for [Recipient Interceptor][], since this functionality is supported in Rails Core. In order to enable the interceptor, set `EMAIL_RECIPIENTS` to a comma-separated list. ```sh INTERCEPTOR_ADDRESSES="user_1@example.com,user_2@example.com" bin/rails s ``` Configures [default_url_options][] in `test` and `development` environments so that `*_url` helpers will work. Note that we do not configure `production`, since we've determined the `delivery_method` is something each project will configure independently. This means we'll just use the [default configuration][], which is `smtp`. [email interceptor]: https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails [Recipient Interceptor]: https://github.com/croaky/recipient_interceptor [default_url_options]: https://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views [default configuration]: https://guides.rubyonrails.org/configuring.html#config-action-mailer-delivery-method
Configuration menu - View commit details
-
Copy full SHA for fc8793d - Browse repository at this point
Copy the full SHA fc8793dView commit details
Commits on Mar 1, 2024
-
Update front-end linting dependencies (#1163)
After the `v4.0.0` release of [@thoughtbot/stylelint-config][], the errors mentioned in [this issue][] no longer appear. This alleviates us from having to pin these dependencies. [@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config/releases/tag/v4.0.0 [this issue]: thoughtbot/stylelint-config#46
Configuration menu - View commit details
-
Copy full SHA for 9f624b1 - Browse repository at this point
Copy the full SHA 9f624b1View commit details
Commits on Mar 8, 2024
-
Disable Turbo's InstantClick (#1164)
Turbo 8 introduced [InstantClick][]. An unintended side-effect of this feature is that page requests are [not debounced][] when a user hovers over a link. This is a concern for two reasons: 1. It creates an unnecessary burden on the server, which could affect rate limiting. 2. It can artificially inflate metrics. [InstantClick]: https://turbo.hotwired.dev/handbook/drive#prefetching-links-on-hover [not debounced]: hotwired/turbo#1181 (comment)
Configuration menu - View commit details
-
Copy full SHA for 3b3712d - Browse repository at this point
Copy the full SHA 3b3712dView commit details -
Introduce
suspenders:testing
generator (#1156)Set up projects for an in-depth test-driven development workflow. Installs and configures [rspec-rails][], [action_dispatch-testing-integration-capybara][], [shoulda-matchers][], [webdrivers][] and [webmock][]. [rspec-rails]: https://github.com/rspec/rspec-rails [action_dispatch-testing-integration-capybara]: https://github.com/thoughtbot/action_dispatch-testing-integration-capybara [shoulda-matchers]: https://github.com/thoughtbot/shoulda-matchers [webdrivers]: https://github.com/titusfortner/webdrivers [webmock]: https://github.com/bblimke/webmock ## Details Generate `spec/rails_helper.rb` and `spec/spec_helper.rb` via `rails g rspec:intall` in an effort to not drift from what RSpec recommends out of the box. ```ruby #spec/spec_helper.rb RSpec.configure do |config| config.example_status_persistence_file_path = "tmp/rspec_examples.txt" config.order = :random config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end config.shared_context_metadata_behavior = :apply_to_host_groups end WebMock.disable_net_connect!( allow_localhost: true, allow: [ /(chromedriver|storage).googleapis.com/, "googlechromelabs.github.io", ] ) ``` The only thing that differs from the existing `spec/rails_helper.rb` configuration is: ```ruby config.infer_base_class_for_anonymous_controllers = false ``` ```ruby # spec/support/chromedriver.rb require "selenium/webdriver" Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end Capybara.register_driver :headless_chrome do |app| options = ::Selenium::WebDriver::Chrome::Options.new options.headless! options.add_argument "--window-size=1680,1050" Capybara::Selenium::Driver.new app, browser: :chrome, options: options end Capybara.javascript_driver = :headless_chrome RSpec.configure do |config| config.before(:each, type: :system) do driven_by :rack_test end config.before(:each, type: :system, js: true) do driven_by Capybara.javascript_driver end end ``` ```ruby # spec/support/shoulda_matchers.rb Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end ``` ```ruby # spec/support/i18n.rb RSpec.configure do |config| config.include ActionView::Helpers::TranslationHelper end ``` ```ruby # spec/support/action_mailer.rb RSpec.configure do |config| config.before(:each) do ActionMailer::Base.deliveries.clear end end ``` ## Notable changes This commit removes the [formulaic][] dependency. A follow-up commit could explore creating a separate one-off generator for this, but for now, we're aiming for the leanest build possible. [formulaic]: https://github.com/calebhearth/formulaic
Configuration menu - View commit details
-
Copy full SHA for 0da07ad - Browse repository at this point
Copy the full SHA 0da07adView commit details
Commits on Mar 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f3f4480 - Browse repository at this point
Copy the full SHA f3f4480View commit details -
Lint Generator: Remove generated test/spec files (#1167)
Follow-up to #1148 I noticed these tests did not fail even if `bin/rails standard` raised a linting violation. Because the upcoming `suspenders:ci` generator will run our linting tasks in CI, I felt having a test to do the same was no longer warranted.
Configuration menu - View commit details
-
Copy full SHA for 39efb28 - Browse repository at this point
Copy the full SHA 39efb28View commit details -
Testing Generator: Improvements (#1168)
Follow-up to #1156 Creates parity with Rails' decision to [use a headless driver by default][headless]. This will be fixed in an [upcoming release][rspec] of rspec-rails, but I felt it was important to capture here. Additionally, it ensures the `screen_size` is the same as what is set in Rails. Removes `webdrivers` dependency in favor of `selenium-webdriver`. This generator assumes the app was generated with the `--skip-test` flag, which means we need to add the `selenium-webdriver` and `capybara` gems. Updates `action_dispatch-testing-integration-capybara` dependency to the most recent tagged release in an effort to suppress Dependabot notifications. Ensure all files under `spec/support` are loaded by uncommenting a line generated by the RSpec installation script. [headless]: rails/rails#50512 [rspec]: rspec/rspec-rails#2746
Configuration menu - View commit details
-
Copy full SHA for 8b8ecb9 - Browse repository at this point
Copy the full SHA 8b8ecb9View commit details
Commits on Mar 22, 2024
-
Styles Generator: Drop support for Tailwind (#1169)
Follow-up to #1145 and #1148 We decided it's best to limit the decisions a consumer needs to make. Even though we defaulted to PostCSS, providing an option to override this value felt like it went against the Suspenders ethos. Additionally, the current version of Suspenders uses PostCSS, so this change aligns with current behavior. Also removes linting rules around Tailwind.
Configuration menu - View commit details
-
Copy full SHA for 7866a7b - Browse repository at this point
Copy the full SHA 7866a7bView commit details -
Lint Generator: Introduce
.prettierignore
(#1170)The upcoming `suspenders:ci` generator caches Ruby dependencies in `vendor/bundle`. This commit ensures we ignore that path.
Configuration menu - View commit details
-
Copy full SHA for 87d1f5a - Browse repository at this point
Copy the full SHA 87d1f5aView commit details -
Introduce
suspenders:prerequisites
generator (#1171)Follow-up to #1148 and #1145 In #1148 and #1145, we introduce the need for yarn to manage dependencies. Those commits failed to establish a `.node-version` file, which [normally would be generated][1] by Rails if **not** using `import-maps`. This commit introduces that file, which compliments the existing `.ruby-version` file that is generated. I chose to use `.node-version` and not `.nvm` or `.tool-versions` to keep parity with Rails. The [current version][2] set by Rails is `18.15.0`, but a [future commit][3] aims to use the latest LTS value. This commit aims to use that version. This commit will also benefit a future `suspenders:ci` generator, since the `.node-version` file will be used in CI. [1]: https://github.com/rails/rails/blob/68b20b6513fe56ca80e4966628c231b4d6113bea/railties/lib/rails/generators/rails/app/app_generator.rb#L57-L59 [2]: https://github.com/rails/rails/blob/e8638c9a942e94f097dc8f37a3b58ac067a5ca16/railties/lib/rails/generators/app_base.rb#L18 [3]: rails/rails#51393
Configuration menu - View commit details
-
Copy full SHA for 52e99e9 - Browse repository at this point
Copy the full SHA 52e99e9View commit details
Commits on Mar 23, 2024
-
Introduce
suspenders:ci
generator (#1172)Creates CI template to be run via [GitHub Actions][ga] based on a [similar template][ci template] that will be generated in an upcoming Release of Rails. Also create a [Dependabot][dependabot] file based off the [the upcoming release][ci template]. Raises if the application is not using PostgreSQL, since our CI template assumes that adapter. Because this generator can be run in an existing application, we add conditional checks for some jobs. However, this generator is intended to be run as part of our holistic `suspenders:install:web` which will be introduced in #1152. Once Rails is released to contain a CI template, we will need to consider how we want to handle conflicts between its file and ours, but for now, we do not need to worry about that. [ga]: https://docs.github.com/en/actions [ci template]: rails/rails#50508 [dependabot]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot
Configuration menu - View commit details
-
Copy full SHA for 5f90074 - Browse repository at this point
Copy the full SHA 5f90074View commit details -
CI Generator: Fix indentation and linting violations. (#1173)
Follow-up to #1172 Fixes indentation ensuring a valid syntax. Also fixes linting violations raised by `yarn lint`.
Configuration menu - View commit details
-
Copy full SHA for eb6b1c1 - Browse repository at this point
Copy the full SHA eb6b1c1View commit details
Commits on Mar 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ec2e811 - Browse repository at this point
Copy the full SHA ec2e811View commit details -
Configuration menu - View commit details
-
Copy full SHA for c7d3550 - Browse repository at this point
Copy the full SHA c7d3550View commit details -
Fix missing linting violation (#1177)
Follow-up to #1176 This was missed. I'm still not sure how the code that introduced did not fail in CI.
Configuration menu - View commit details
-
Copy full SHA for 97f1883 - Browse repository at this point
Copy the full SHA 97f1883View commit details -
Lint Generator: No longer fix violations after invocation (#1174)
Supports #1152 We found that we needed to run this generator last in `suspenders:install:web` to ensure any potential violation was resolved. Instead, we'll just make that the responsibility of `suspenders:install:web`.
Configuration menu - View commit details
-
Copy full SHA for e7926f1 - Browse repository at this point
Copy the full SHA e7926f1View commit details
Commits on Mar 26, 2024
-
CI: Breakout jobs and support Ruby 3.3.0 (#1178)
Separate out lint and test jobs to make CI more clear. Drop matrix support, and instead update the local Ruby version to the latest version `3.3.0`, and use that in CI. Also updates test to ignore generated file that should have been ignored. Ran `bundle install` to rebuild `Gemfile.lock`.
Configuration menu - View commit details
-
Copy full SHA for a40d457 - Browse repository at this point
Copy the full SHA a40d457View commit details -
Lint Generator: Handling missing
package.json
(#1179)In order to avoid raising `No such file or directory`, we create a `package.json` file if one does not exist. We borrow a template from [cssbundling-rails][]. [cssbundling-rails]: https://github.com/rails/cssbundling-rails/blob/09d81cb0accf00abb77d8af5b24f5aad0b71a57a/lib/install/package.json#L3
Configuration menu - View commit details
-
Copy full SHA for f76fb25 - Browse repository at this point
Copy the full SHA f76fb25View commit details
Commits on Apr 2, 2024
-
Introduce
suspenders:cleanup:organize_gemfile
task (#1181)Introduce `Suspenders::Cleanup::OrganizeGemfile` class and corresponding task in an effort to reduce duplicate groups in the modified Gemfile. This is because the [gem_group][] method does not modify existing groups. I've opened [#49512][] in an effort to fix this, but until then, this task will suffice. This class is designed to be run after `suspenders:install:web`, and does not account for all edge cases. For example, it assumes gems are grouped by symbols (i.e. :test and not "test"), and does not account for inline syntax: ```ruby gem 'my-gem', group: [:cucumber, :test] ``` We could consider extracting this into a Gem (with a fun name, of course. Maybe "Polish"), but for now, I think this simple procedural code if just fine. Additionally, this commit removes duplicate Rake task that was generated with the plugin. [gem_group]: https://api.rubyonrails.org/classes/Rails/Generators/Actions.html#method-i-gem_group [#49512]: rails/rails#49512
Configuration menu - View commit details
-
Copy full SHA for f6c6f45 - Browse repository at this point
Copy the full SHA f6c6f45View commit details
Commits on Apr 5, 2024
-
Introduce
suspenders:production:environment
generator (#1151)Creates generator to configuration the production environment. For now, this means [requiring a master key][master key]. Drops configuration for [asset_host][], since that should be an infrastructure decision. In an effort to distinguish between the development environment configuration in #1149, we use the `production` namespace. [master key]: https://guides.rubyonrails.org/configuring.html#config-require-master-key [asset_host]: https://guides.rubyonrails.org/configuring.html#config-asset-host Co-authored-by: Steve Polito <stevepolito@hey.com>
Configuration menu - View commit details
-
Copy full SHA for 667b7ae - Browse repository at this point
Copy the full SHA 667b7aeView commit details -
Introduce
suspenders:test:environment
generator (#1182)Configures test environment. This differs from #1156 in that this commit is concerned with configuration, where that commit was concerned with generating a holistic test suite. It's also possible to run each generator independently, and the two should not rely on one another. Disables [action_dispatch.show_exceptions][] in an effort to [improve failure output][comment]. Enables [raise_on_missing_translations][] to keep parity with the same setting in development #1149 [action_dispatch.show_exceptions]: https://edgeguides.rubyonrails.org/configuring.html#config-action-dispatch-show-exceptions [comment]: #1149 (comment) [raise_on_missing_translations]: https://guides.rubyonrails.org/configuring.html#config-i18n-raise-on-missing-translations
Configuration menu - View commit details
-
Copy full SHA for 5a733e0 - Browse repository at this point
Copy the full SHA 5a733e0View commit details -
Introduce
suspenders:development:environment
generator (#1149)Creates generator to configure the development environment. Keeps parity with Rails as much as possible in an effort to avoid drift with Rails standards. It's possible a future release of Rails will alleviate us from having to do the following: - enable `active_model.i18n_customize_full_message` which is being addressed in [#50406][] - enable `active_record.query_log_tags_enabled` which is being addressed in [#51342][] [#50406]: rails/rails#50406 [#51342]: rails/rails#51342 Co-authored-by: Steve Polito <stevepolito@hey.com>
Configuration menu - View commit details
-
Copy full SHA for 7d666ca - Browse repository at this point
Copy the full SHA 7d666caView commit details -
Configuration menu - View commit details
-
Copy full SHA for 56b316c - Browse repository at this point
Copy the full SHA 56b316cView commit details -
Test Cleanup: Improve test setup (#1183)
Use `touch` test helper instead of directly working with the `File` class during the setup phase. Also create [file_fixtures][] to simplify test setup. Because the newly added file fixtures are processed with standard, I needed to adjust the testing generator to account for a minor violation. [file_fixtures]: https://api.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html#method-i-file_fixture
Configuration menu - View commit details
-
Copy full SHA for 1c9134f - Browse repository at this point
Copy the full SHA 1c9134fView commit details
Commits on Apr 8, 2024
-
AccessibilityGenerator: Update gem declaration (#1185)
In order to avoid the following failure in CI, we need to load the latest build (not release) of capybara_accessibility_audit. ``` NoMethodError: undefined method `configure' for module RSpec (NoMethodError) RSpec.configure do |config| ``` For reference, [this commit][] fixes the issue. [this commit]: thoughtbot/capybara_accessibility_audit@0ee6922
Configuration menu - View commit details
-
Copy full SHA for 8edaa4b - Browse repository at this point
Copy the full SHA 8edaa4bView commit details
Commits on Apr 9, 2024
-
Rakefile: Conditionally require local dependencies (#1186)
Prior to this commit, the Rakefile required `bundler-audit` and `standard` in all environments. This prevented Rake from running in production, because those dependencies are only loaded in `:development` and `:test`.
Configuration menu - View commit details
-
Copy full SHA for 473e483 - Browse repository at this point
Copy the full SHA 473e483View commit details
Commits on Apr 13, 2024
-
Dynamically generate README (#1187)
Create README based off the `desc` of the generators. We chose to create a custom class instead of a traditional generator because this script is intended to be run in the [application template][] as a Rake task. It is not intended to be run as a standalone generator, since it only makes sense to be run on concert with `suspenders:install:web`. Updates all generator descriptions to use Herdoc syntax to ensure consistent line breaks. A follow-up commit will update the descriptions to work better in a README. [application template]: https://guides.rubyonrails.org/rails_application_templates.html
Configuration menu - View commit details
-
Copy full SHA for 08be1dd - Browse repository at this point
Copy the full SHA 08be1ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for c694b2a - Browse repository at this point
Copy the full SHA c694b2aView commit details
Commits on Apr 14, 2024
-
Introduce
suspenders:install:web
generator and application template (……#1152) Create generator to invoke all necessary generators. We add it to the `install` namespace to provide flexibility should we add other installation options, such as ones for API Only applications. Introduces [template][] as a means to invoke `suspenders:install:web` when creating a new application. This serves as an alternative to the system executable that was removed. We call `db:prepare` in the template to ensure `bin/setup` works as expected. This is because we overrode that file to use `dev:prime`, which assume the database has been created. [template]: https://guides.rubyonrails.org/rails_application_templates.html
Configuration menu - View commit details
-
Copy full SHA for e8eb46a - Browse repository at this point
Copy the full SHA e8eb46aView commit details
Commits on Apr 19, 2024
-
Styles Generator: Install
postcss-url
(#1191)Closes #1190 When including styles from `node_modules` via `@import`, we discovered that static assets referenced in those style sheets are not loaded, resulting in console errors. Since [cssbundling-rails][] ships with [postcss-import][], we are already encouraging the use of importing styles from `node_modules`. This commit aims to solve this problem by installing and configuring [postcss-url][]. Because `postcss-url` needs a directory to copy assets to, we create `app/assets/static` as part of the generator. One thing to note is that we override the `postcss.config.js` generated by the cssbundling-rails installation script, which assumes that the following plugins have been installed. - `postcss-import` - `postcss-nesting` - `autoprefixer` Should that change, this file would be invalid, and those packages would need to be installed. [cssbundling-rails]: https://github.com/rails/cssbundling-rails [postcss-import]: https://github.com/postcss/postcss-import [postcss-url]: https://github.com/postcss/postcss-url
Configuration menu - View commit details
-
Copy full SHA for 5b133e7 - Browse repository at this point
Copy the full SHA 5b133e7View commit details -
Lint Generator: Account for breaking changes in ESLint (#1192)
The recent release of [ESLint v9.0.0][] made it so [flat config][] is the new default. Until we can update [thoughtbot/eslint-config][] to [support][] this version, we'll pin ESLint to `^8.9.0` in an effort to ship this next release of Suspenders. [ESLint v9.0.0]: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/ [flat config]: https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes [thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config [support]: thoughtbot/eslint-config#10
Configuration menu - View commit details
-
Copy full SHA for f62c516 - Browse repository at this point
Copy the full SHA f62c516View commit details -
Test Cleanup: Update bundle assertions (#1193)
Rather than stub calls on Bundler, we simply assert the output of the generator to see if `bundle install` is called.
Configuration menu - View commit details
-
Copy full SHA for 7952880 - Browse repository at this point
Copy the full SHA 7952880View commit details -
Test Cleanup: Remove generator description tests (#1194)
I no longer thing it's valuable to test if a generator has a custom description, because contributors would have to know to add these tests in the first place.
Configuration menu - View commit details
-
Copy full SHA for 5433da2 - Browse repository at this point
Copy the full SHA 5433da2View commit details
Commits on Apr 22, 2024
-
Generated README: Titleize app name (#1195)
Follow-up to #1187 Since we derive the app name from a module name, we need to [titleize][] it so it reads better in the `README`. Now `ExpectedAppName` will be rendered as `Expected App Name`. [titleize]: https://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-titleize
Configuration menu - View commit details
-
Copy full SHA for ea9553c - Browse repository at this point
Copy the full SHA ea9553cView commit details
Commits on Apr 24, 2024
-
Jobs Generator: Remove obsolete configuration (#1197)
Follow-up to #1147 The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
Configuration menu - View commit details
-
Copy full SHA for 2c8616a - Browse repository at this point
Copy the full SHA 2c8616aView commit details
Commits on Apr 26, 2024
-
Generators: Update descriptions (#1198)
Follow-up to #1187 Update descriptions so that they work well in the `README.md` generated by `suspenders:clean_up:generate_readme`. Also fixes a typo in `Suspenders::Cleanup::GenerateReadme`.
Configuration menu - View commit details
-
Copy full SHA for fc1c08e - Browse repository at this point
Copy the full SHA fc1c08eView commit details -
Documentation: Update README and CONTRIBUTING (#1199)
Simplify `README` in an effort to highlight what really matters, and remove references to each generator. Instead, we introduce `FEATURES.md` which was modified from the `README` generated by `bin/rails suspenders:cleanup:generate_readme` Updates `CONTRIBUTING` guide to account for changes in the test suite. Since this new build was generated from am [engine][], we no longer use RSpec, and instead use the default test suite. Remove reference to styleguide since the link is broken, and update link to Suspenders boy to use HTTPS. [engine]: https://guides.rubyonrails.org/engines.html
Configuration menu - View commit details
-
Copy full SHA for a3e5a77 - Browse repository at this point
Copy the full SHA a3e5a77View commit details -
Install Generator: Generate
CONTRIBUTING.md
(#1196)Generate contributing guide when suspending a new Rails application. Update generated `README.md` to point to contributing guide. Co-authored-by: Sean Doyle <sean.p.doyle24@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for f9a702a - Browse repository at this point
Copy the full SHA f9a702aView commit details
Commits on May 2, 2024
-
README: Update installation script
Indent the arguments passed to `rails new` so that the installation script can be copied and invoked without error. Point the `-m` argument to `main`, so that when this pull request is merged, the documentation will be accurate.
Configuration menu - View commit details
-
Copy full SHA for a175e7a - Browse repository at this point
Copy the full SHA a175e7aView commit details -
NEWS: Document introduction of application template
Highlight that we introduced an [application template][] in place of the system executable. [application template]: https://guides.rubyonrails.org/rails_application_templates.html
Configuration menu - View commit details
-
Copy full SHA for a38f247 - Browse repository at this point
Copy the full SHA a38f247View commit details -
LICENSE: Remove year and duplicate file
Remove [generated][] MIT-LICENSE file created when running `rails plugin new`. Also removes copyright years to be consistent with our [current templates][templates]. [generated]: https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt [templates]: thoughtbot/templates#23
Configuration menu - View commit details
-
Copy full SHA for 4def0ae - Browse repository at this point
Copy the full SHA 4def0aeView commit details
Commits on May 7, 2024
-
Prerequisites: Use system version of Node (#1201)
We were incorrectly assuming consumers had the version of Node installed that is declared in `Suspenders::NODE_LTS_VERSION`. Because of this, we were generating a `.node-version` file with a version that was not installed on the user's system. This was a problem because when subsequent generators depending on Node were invoked, they would raise the following: ``` No preset version installed for command node Please install a version by running one of the following: asdf install nodejs 20.11.1 ``` To account for this, we [borrow][] from Rails, but modify slightly. First, we look to see if `ENV["NODE_VERSION"]` is set. If not, we then look to see if Node is installed, and set the version via `node --version`. If neither of those values are present, we raise. This is because we can't use a fallback value, since the consumer does not have Node installed on their system. Removes `Suspenders::NODE_LTS_VERSION` since it's no longer used as a fallback. Introduced [climate_control][] as a development dependency in order to test this feature. [borrow]: https://github.com/rails/rails/blob/d65fec4fd2a047533408cbbd4824b248adc0e3fd/railties/lib/rails/generators/app_base.rb#L521-L529 [climate_control]: https://github.com/thoughtbot/climate_control
Configuration menu - View commit details
-
Copy full SHA for 7bf6e82 - Browse repository at this point
Copy the full SHA 7bf6e82View commit details
Commits on May 8, 2024
-
Prerequisites: Raise if Node version unsupported (#1202)
Follow-up to #1201 It's not enough to ensure Node is installed. We also need to ensure the consumer has the supported minimum version installed. Otherwise, subsequent generators will raise errors like so: ``` error stylelint-config-standard-scss@13.1.0: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "18.0.0" error Found incompatible module. ``` We select `v20.0.0` as our minimum supported version because it is slated for Active LTS, but is not bleeding edge at [this time][] We also raise when calling the template to avoid unnecessarily generating a new Rails application. [this time]: https://nodejs.org/en/about/previous-releases
Configuration menu - View commit details
-
Copy full SHA for 69e5fd7 - Browse repository at this point
Copy the full SHA 69e5fd7View commit details -
Documentation: List requirements
After requiring a minimum Node version #1202, we list this, and other system requirements` in an effort to improve the developer experience.
Configuration menu - View commit details
-
Copy full SHA for 47199bf - Browse repository at this point
Copy the full SHA 47199bfView commit details
Commits on May 9, 2024
-
It's possible that `postcss.config.js` could be deleted, even if we check for its existence. Co-authored-by: Mike Burns <mburns@thoughtbot.com>
Configuration menu - View commit details
-
Copy full SHA for 1b1795a - Browse repository at this point
Copy the full SHA 1b1795aView commit details -
Since we started working on this, `3.3.1` was [released][]. [released]: https://github.com/ruby/ruby/releases/tag/v3_3_1
Configuration menu - View commit details
-
Copy full SHA for aceb0e2 - Browse repository at this point
Copy the full SHA aceb0e2View commit details
Commits on May 10, 2024
-
Generators that invoke `yarn` can result in warning being printed during testing, such as: ``` warning " > postcss-url@10.1.3" has unmet peer dependency "postcss@^8.0.0". ``` or ``` DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. ``` Although these warnings may be legitimate, they disrupt the test output.
Configuration menu - View commit details
-
Copy full SHA for 088c1b9 - Browse repository at this point
Copy the full SHA 088c1b9View commit details -
This prepares us to merge `suspenders-3-0-0` into `main`. Once we formally release to RubyGems, we can remove the reference to GitHub.
Configuration menu - View commit details
-
Copy full SHA for 721f387 - Browse repository at this point
Copy the full SHA 721f387View commit details