Skip to content

thoughtbot/suspenders

Repository files navigation

Suspenders

CI

Suspenders is a Rails Engine containing generators for configuring Rails applications with these features.

It is used by thoughtbot to get a jump start on a new or existing app. Use Suspenders if you're in a rush to build something amazing; don't use it if you like missing deadlines.

Suspenders boy

Requirements

  • Rails ~> 7.0
  • Ruby >= 3.1
  • Node >= 20.0.0

Usage

Suspenders can be used to create a new Rails application, or to enhance an existing Rails application.

With New Rails Applications

This approach uses an application template to generate a new Rails application with Suspenders.

We skip the default test framework in favor of RSpec, and prefer PostgreSQL as our database.

We skip RuboCop rules by default in favor of our holistic linting rules.

Use the latest suspenders release:

rails new app_name \
 --skip-rubocop \
 --skip-test \
 -d=postgresql \
 -m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

OR use the current (possibly unreleased) main branch of suspenders:

rails new app_name \
 --suspenders-main \
 --skip-rubocop \
 --skip-test \
 -d=postgresql \
 -m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

Then run bin/setup within the newly generated application.

Alternatively, if you're using our dotfiles, then you can just run rails new app_name, or create your own railsrc file with the following configuration:

--skip-rubocop
--skip-test
--database=postgresql
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

With Existing Rails Applications

Suspenders can be used on an existing Rails application by adding it to the :development and :test group.

group :development, :test do
  gem "suspenders"
end

Once installed, you can invoke the web installation generator, which will invoke all generators.

bin/rails g suspenders:install:web

Or, you can invoke generators individually. To see a list of available generators run:

bin/rails g | grep suspenders

To learn more about a generator, run:

bin/rails g suspenders:[generator_name] --help

Available Tasks

Suspenders ships with several custom Rake tasks.

bin/rails suspenders:rake
bin/rails suspenders:db:migrate
bin/rails suspenders:cleanup:organize_gemfile

Contributing

See the CONTRIBUTING document. Thank you, contributors!

License

Suspenders is Copyright (c) thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects. We are available for hire.