Skip to content
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

Introduce railsrc #728

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Introduce railsrc #728

merged 1 commit into from
Oct 20, 2023

Conversation

stevepolitodesign
Copy link
Contributor

@stevepolitodesign stevepolitodesign commented Oct 6, 2023

Introduces railsrc in an effort to prepare for the eventual removal of the
suspenders executable
.

With this change, calling rails new will automatically set the following
options:

--database=postgresql

If you need to use another database, you can override this value like so: rails new my_app --database=mysql or rails new my_app --no_rc to skip this file all
together

railsrc Outdated Show resolved Hide resolved
@JoelQ
Copy link
Contributor

JoelQ commented Oct 10, 2023

Would this make it more challenging to generate a Rails app that deviates from this standard? Since now it wouldn't just be picking a different generator or setting a command-line flag but would require modifying a dotfile (or potentially adding a local .railsrc?)

@JoelQ
Copy link
Contributor

JoelQ commented Oct 10, 2023

Perhaps out of scope for this PR but I wonder if there are other flags we'd want to set here? I know when I've generated new Rails apps I've always set the test framework to RSpec but IIRC @seanpdoyle might be trying to change that convention.

@mike-burns
Copy link
Contributor

Would this make it more challenging to generate a Rails app that deviates from this standard?

I'm pretty sure a command line flag overrides the dotfile.

@brian-penguin
Copy link
Contributor

Personally, I don't like Tailwind and I wouldn't reach for it by default. I think especially since you need to also run a build process for Tailwind

@LkeMitchll
Copy link

I also wouldn't use tailwind by default. Tailwind can be useful later as a progressive enhancement:

https://andy-bell.co.uk/i-used-tailwind-for-the-u-in-cube-css-and-i-liked-it/

But at the very start of a project I would be looking to disable it or remove it somehow to decrease dependencies, and speed up the build process.

I'm not sure what this new tool is capable of scaffolding for us, but something I always do is create a folder structure under /app/assets/stylesheets

With something like:

base/
components/
utilities/
app.scss

...as children, plus a CSS reset. It doesn't have to be exactly this, but folders are much easier to remove or ignore than tailwind boilerplate.

@stevepolitodesign
Copy link
Contributor Author

@JoelQ

Would this make it more challenging to generate a Rails app that deviates from this standard?

I'm pretty sure a command line flag overrides the dotfile.

Just confirming this is true. Running rails new my_app --database=mysql would override postgresql. However, there's no option to "unset" the CSS.

However, there's always the option to run rails new my_app --no-rc to skip the .railsrc all together.

@stevepolitodesign
Copy link
Contributor Author

@LkeMitchll

I also wouldn't use tailwind by default. Tailwind can be useful later as a progressive enhancement:

https://andy-bell.co.uk/i-used-tailwind-for-the-u-in-cube-css-and-i-liked-it/

But at the very start of a project I would be looking to disable it or remove it somehow to decrease dependencies, and speed up the build process.

I'm not sure what this new tool is capable of scaffolding for us, but something I always do is create a folder structure under /app/assets/stylesheets

With something like:

base/
components/
utilities/
app.scss

...as children, plus a CSS reset. It doesn't have to be exactly this, but folders are much easier to remove or ignore than tailwind boilerplate.

This could be a responsibility of suspenders, and captured in a generator which would be called on existing applications. I'll make a note of it when I started building it out.

Introduces [railsrc][1] in an effort to prepare for the eventual
[removal of the suspenders executable][2].

With this change, calling `rails new` will automatically set the
following options:

```
--database=postgresql
```

If you need to use another database, you can override this value like
so: `rails new my_app --database=mysql` or `rails new my_app --no_rc` to
skip this file all together

[1]: https://github.com/rails/rails/blob/7f7f9df8641e35a076fe26bd097f6a1b22cb4e2d/railties/lib/rails/generators/rails/app/USAGE#L5C1-L7
[2]: https://github.com/thoughtbot/suspenders/blob/main/GOALS.md#from-here-to-there
@stevepolitodesign stevepolitodesign merged commit 5339ddd into main Oct 20, 2023
@stevepolitodesign stevepolitodesign deleted the sp-railsrc branch October 20, 2023 16:57
stevepolitodesign added a commit that referenced this pull request Apr 29, 2024
Follow-up to #728

In an effort to create parity with the [upcoming release of
Suspenders][1], we pass the `--skip-test` argument when running [rails
new][2].

This means if you're using our `railsrc` file, you would just need to
pass the `-m` argument when generating a new Rails application.

[1]: thoughtbot/suspenders#1135
[2]: https://guides.rubyonrails.org/command_line.html#rails-new
stevepolitodesign added a commit that referenced this pull request May 2, 2024
Follow-up to #728

In an effort to create parity with the [upcoming release of
Suspenders][1], we pass the `--skip-test` argument when running [rails
new][2].

This means if you're using our `railsrc` file, you would just need to
pass the `-m` argument when generating a new Rails application.

[1]: thoughtbot/suspenders#1135
[2]: https://guides.rubyonrails.org/command_line.html#rails-new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants