Skip to content

Commit a3e5a77

Browse files
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
1 parent fc1c08e commit a3e5a77

File tree

3 files changed

+271
-225
lines changed

3 files changed

+271
-225
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ Run the setup script.
2323
Make sure the tests pass:
2424

2525
```
26-
bundle exec rake
26+
bin/rails test
2727
```
2828

29-
Make your change, with new passing tests. Follow the [style guide][style].
29+
Make sure there are no linting violations:
3030

31-
[style]: https://github.com/thoughtbot/guides/tree/master/style
31+
```
32+
bin/rails standard
33+
```
34+
35+
Make your change, with new passing tests.
3236

3337
Mention how your changes affect the project to other developers and users in the
3438
`NEWS.md` file.
@@ -42,6 +46,17 @@ This is a time for discussion and improvements,
4246
and making the necessary changes will be required before we can
4347
merge the contribution.
4448

49+
## Testing Generators
50+
51+
There is a smaller dummy application at `test/dummy`. This application is used
52+
as a mounting point for the engine, to make testing the engine extremely simple.
53+
54+
There are a number of [assertions][] and [helpers][] that make testing
55+
generators easier.
56+
57+
[assertions]: https://api.rubyonrails.org/classes/Rails/Generators/Testing/Assertions.html
58+
[helpers]: https://api.rubyonrails.org/classes/Rails/Generators/Testing/Behavior.html
59+
4560
## Publishing to RubyGems
4661

4762
When the gem is ready to be shared as a formal release, it can be

FEATURES.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Features
2+
3+
## Local Development
4+
5+
### Seed Data
6+
7+
- Use `db/seeds.rb` to create records that need to exist in all environments.
8+
- Use `lib/tasks/dev.rake` to create records that only need to exist in development.
9+
10+
Running `bin/setup` will run `dev:prime`.
11+
12+
### Tasks
13+
14+
- Use `bin/rails suspenders:db:migrate` to run [database migrations][]. This script ensures they are [reversible][].
15+
- Use `bin/rails suspenders:cleanup:organize_gemfile` to automatically organize the project's Gemfile.
16+
- Use `bin/rails default` to run the default Rake task. This will do the following:
17+
- Run the test suite.
18+
- Run a Ruby and ERB linter.
19+
- Scan the Ruby codebase for any dependency vulnerabilities.
20+
21+
[database migrations]: https://edgeguides.rubyonrails.org/active_record_migrations.html#running-migrations
22+
[reversible]: https://edgeguides.rubyonrails.org/active_record_migrations.html#making-the-irreversible-possible
23+
24+
## Configuration
25+
26+
### Test
27+
28+
- Enables [raise_on_missing_translations][].
29+
- Disables [action_dispatch.show_exceptions][].
30+
31+
[raise_on_missing_translations]: https://guides.rubyonrails.org/configuring.html#config-i18n-raise-on-missing-translations
32+
[action_dispatch.show_exceptions]: https://edgeguides.rubyonrails.org/configuring.html#config-action-dispatch-show-exceptions
33+
34+
### Development
35+
36+
- Enables [raise_on_missing_translations][].
37+
- Enables [annotate_rendered_view_with_filenames][].
38+
- Enables [i18n_customize_full_message][].
39+
- Enables [query_log_tags_enabled][].
40+
41+
[raise_on_missing_translations]: https://guides.rubyonrails.org/configuring.html#config-i18n-raise-on-missing-translations
42+
[annotate_rendered_view_with_filenames]: https://guides.rubyonrails.org/configuring.html#config-action-view-annotate-rendered-view-with-filenames
43+
[i18n_customize_full_message]: https://guides.rubyonrails.org/configuring.html#config-active-model-i18n-customize-full-message
44+
[query_log_tags_enabled]: https://guides.rubyonrails.org/configuring.html#config-active-record-query-log-tags-enabled
45+
46+
### Production
47+
48+
- Enables [require_master_key][].
49+
50+
[require_master_key]: https://guides.rubyonrails.org/configuring.html#config-require-master-key
51+
52+
### Linting
53+
54+
- Uses [@thoughtbot/eslint-config][] for JavaScript linting.
55+
- Uses [@thoughtbot/stylelint-config][] for CSS linting.
56+
- Uses [prettier][] for additional linting.
57+
- Uses [better_html][], [erb_lint][], and [erblint-github][] for ERB linting.
58+
- Uses [standard][] for Ruby linting.
59+
60+
**Available Commands**
61+
62+
- Run `yarn lint` to lint front-end code.
63+
- Run `yarn fix:prettier` to automatically fix prettier violations.
64+
- Run `bin/rails standard` to lint ERB and Ruby code.
65+
- Run `bundle exec standardrb --fix` to fix standard violations.
66+
67+
[@thoughtbot/eslint-config]: https://github.com/thoughtbot/eslint-config
68+
[@thoughtbot/stylelint-config]: https://github.com/thoughtbot/stylelint-config
69+
[prettier]: https://prettier.io
70+
[better_html]: https://github.com/Shopify/better-html
71+
[erb_lint]: https://github.com/Shopify/erb-lint
72+
[erblint-github]: https://github.com/github/erblint-github
73+
[standard]: https://github.com/standardrb/standard
74+
75+
## Testing
76+
77+
Uses [RSpec][] and [RSpec Rails][] in favor of the [default test suite][].
78+
79+
The test suite can be run with `bin/rails spec`.
80+
81+
Configuration can be found in the following files:
82+
83+
```
84+
spec/rails_helper.rb
85+
spec/spec_helper.rb
86+
spec/support/action_mailer.rb
87+
spec/support/driver.rb
88+
spec/support/i18n.rb
89+
spec/support/should_matchers.rb
90+
```
91+
92+
- Uses [action_dispatch-testing-integration-capybara][] to introduce Capybara assertions into Request specs.
93+
- Uses [should-matchers][] for simple one-liner tests for common Rails functionality.
94+
- Uses [webmock][] for stubbing and setting expectations on HTTP requests in Ruby.
95+
96+
[RSpec]: http://rspec.info
97+
[RSpec Rails]: https://github.com/rspec/rspec-rails
98+
[default test suite]: https://guides.rubyonrails.org/testing.html
99+
[action_dispatch-testing-integration-capybara]: https://github.com/thoughtbot/action_dispatch-testing-integration-capybara
100+
[should-matchers]: https://github.com/thoughtbot/shoulda-matchers
101+
[webmock]: https://github.com/bblimke/webmock
102+
103+
### Factories
104+
105+
Uses [FactoryBot][] as an alternative to [Fixtures][] to help you define
106+
dummy and test data for your test suite. The `create`, `build`, and
107+
`build_stubbed` class methods are directly available to all tests.
108+
109+
Place FactoryBot definitions in `spec/factories.rb`, at least until it
110+
grows unwieldy. This helps reduce confusion around circular dependencies and
111+
makes it easy to jump between definitions.
112+
113+
[FactoryBot]: https://github.com/thoughtbot/factory_bot
114+
[Fixtures]: https://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures
115+
116+
## Accessibility
117+
118+
Uses [capybara_accessibility_audit][] and
119+
[capybara_accessible_selectors][] to encourage and enforce accessibility best
120+
practices.
121+
122+
[capybara_accessibility_audit]: https://github.com/thoughtbot/capybara_accessibility_audit
123+
[capybara_accessible_selectors]: https://github.com/citizensadvice/capybara_accessible_selectors
124+
125+
## Advisories
126+
127+
Uses [bundler-audit][] to update the local security database and show
128+
any relevant issues with the app's dependencies via a Rake task.
129+
130+
[bundler-audit]: https://github.com/rubysec/bundler-audit
131+
132+
## Mailers
133+
134+
[Intercept][] emails in non-production environments by setting `INTERCEPTOR_ADDRESSES`.
135+
136+
```sh
137+
INTERCEPTOR_ADDRESSES="[email protected],[email protected]" bin/rails s
138+
```
139+
140+
Configuration can be found at `config/initializers/email_interceptor.rb`.
141+
142+
Interceptor can be found at `app/mailers/email_interceptor.rb`.
143+
144+
[Intercept]: https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
145+
146+
## Jobs
147+
148+
Uses [Sidekiq][] for [background job][] processing.
149+
150+
Configures the `test` environment to use the [inline][] adapter.
151+
152+
[Sidekiq]: https://github.com/sidekiq/sidekiq
153+
[background job]: https://guides.rubyonrails.org/active_job_basics.html
154+
[inline]: https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html
155+
156+
## Layout and Assets
157+
158+
### Stylesheets
159+
160+
- Uses [PostCSS][] via [cssbundling-rails][].
161+
- Uses [modern-normalize][] to normalize browsers' default style.
162+
163+
Configuration can be found at `postcss.config.js`.
164+
165+
Adds the following stylesheet structure.
166+
167+
```
168+
app/assets/stylesheets/base.css
169+
app/assets/stylesheets/components.css
170+
app/assets/stylesheets/utilities.css
171+
```
172+
173+
Adds `app/assets/static` so that [postcss-url][] has a directory to copy
174+
assets to.
175+
176+
[PostCSS]: https://postcss.org
177+
[cssbundling-rails]: https://github.com/rails/cssbundling-rails
178+
[modern-normalize]: https://github.com/sindresorhus/modern-normalize
179+
[postcss-url]: https://github.com/postcss/postcss-url
180+
181+
### Inline SVG
182+
183+
Uses [inline_svg][] for embedding SVG documents into views.
184+
185+
Configuration can be found at `config/initializers/inline_svg.rb`
186+
187+
[inline_svg]: https://github.com/jamesmartin/inline_svg
188+
189+
### Layout
190+
191+
- A [partial][] for [flash messages][] is located in `app/views/application/_flashes.html.erb`.
192+
- Sets [lang][] attribute on `<html>` element to `en` via `I18n.local`.
193+
- Dynamically sets `<title>` via the [title][] gem.
194+
- Disables Turbo's [Prefetch][] in an effort to reduce unnecessary network requests.
195+
196+
[partial]: https://guides.rubyonrails.org/layouts_and_rendering.html#using-partials
197+
[flash messages]: https://guides.rubyonrails.org/action_controller_overview.html#the-flash
198+
[lang]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
199+
[title]: https://github.com/calebhearth/title
200+
[Prefetch]: https://turbo.hotwired.dev/handbook/drive#prefetching-links-on-hover

0 commit comments

Comments
 (0)