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 suspenders:install:web and application template #1152

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

stevepolitodesign
Copy link
Contributor

@stevepolitodesign stevepolitodesign commented Dec 12, 2023

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.

How to test this pull request

  1. Generate a new Rails application:

    rails new suspenders_qa \
    --skip-test \
    -d=postgresql \
    -m=https://raw.githubusercontent.com/thoughtbot/suspenders/suspenders-3-0-0-web-generator/lib/install/web.rb
  2. Run the setup script

    cd suspenders_qa bin/setup
  3. Generate a scaffold to create data:

    bin/rails g scaffold post title
    bin/rails suspenders:db:migrate
  4. Run rake and lint and note the output:

    bundle exec rake
    yarn run lint

To Do

  • Add README and other templates
  • Ensure generated application has a passing CI in GitHub.
  • Ensure generated application can be deployed.
  • Consider creating a "clean-up" task that organizes the Gemfile.
  • Enforce prerequisites
  • Ensure setup script works.

@stevepolitodesign stevepolitodesign changed the base branch from main to suspenders-3-0-0 December 12, 2023 20:42

after_bundle do
gem_group :development, :test do
gem "suspenders", github: "thoughtbot/suspenders", branch: "suspenders-3-0-0-web-generator"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update this once we release a new version and merge into main.

@stevepolitodesign stevepolitodesign mentioned this pull request Dec 12, 2023
17 tasks
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch from ad39dce to f823f17 Compare December 12, 2023 21:23
lib/install/web.rb Outdated Show resolved Hide resolved
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch 2 times, most recently from 81a5cee to 4c7d901 Compare March 8, 2024 17:00
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch 4 times, most recently from 5b3778b to a6e3706 Compare March 22, 2024 18:03
stevepolitodesign added a commit that referenced this pull request Mar 22, 2024
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.

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

---

**To Do**

 - [ ] Consider returning early and raising if the application is not
   using PostgreSQL.
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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.

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

---

**To Do**

 - [ ] Consider returning early and raising if the application is not
   using PostgreSQL.
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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.

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

---

**To Do**

 - [ ] Consider returning early and raising if the application is not
   using PostgreSQL.
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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.

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

---

**To Do**

 - [ ] Consider returning early and raising if the application is not
   using PostgreSQL.
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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.

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
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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.

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
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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
stevepolitodesign added a commit that referenced this pull request Mar 23, 2024
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
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch from a6e3706 to 9212177 Compare March 23, 2024 15:33
stevepolitodesign added a commit that referenced this pull request Mar 25, 2024
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`.
stevepolitodesign added a commit that referenced this pull request Mar 25, 2024
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`.
stevepolitodesign added a commit that referenced this pull request Mar 25, 2024
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`.
stevepolitodesign added a commit that referenced this pull request Mar 25, 2024
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`.
stevepolitodesign added a commit that referenced this pull request Mar 25, 2024
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`.
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch 4 times, most recently from 6c96ab8 to d20038b Compare March 26, 2024 16:42
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch 3 times, most recently from 452255d to 45bb82e Compare April 9, 2024 19:22
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch 2 times, most recently from d667618 to 412c3aa Compare April 13, 2024 15:22
@stevepolitodesign stevepolitodesign marked this pull request as ready for review April 13, 2024 15:23
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch from 412c3aa to dbe5c6e Compare April 13, 2024 16:41
generate "suspenders:email"
generate "suspenders:factories"
generate "suspenders:inline_svg"
generate "suspenders:lint"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure this out:

❯ yarn run lint
yarn run v1.22.17
$ run-p lint:eslint lint:stylelint lint:prettier
$ eslint --max-warnings=0 --no-error-on-unmatched-pattern 'app/javascript/**/*.js'
$ prettier --check '**/*' --ignore-unknown
$ stylelint 'app/assets/stylesheets/**/*.css'
Checking formatting...
.github/workflows/ci.yaml
Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Could not find config file.
    at locateConfigFileToUse (/Users/polito/Desktop/suspenders_qa_0/node_modules/eslint/lib/eslint/eslint.js:349:21)
    at async calculateConfigArray (/Users/polito/Desktop/suspenders_qa_0/node_modules/eslint/lib/eslint/eslint.js:384:49)
    at async ESLint.lintFiles (/Users/polito/Desktop/suspenders_qa_0/node_modules/eslint/lib/eslint/eslint.js:814:25)
    at async Object.execute (/Users/polito/Desktop/suspenders_qa_0/node_modules/eslint/lib/cli.js:461:23)
    at async main (/Users/polito/Desktop/suspenders_qa_0/node_modules/eslint/bin/eslint.js:165:22)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
app/assets/stylesheets/application.postcss.cssERROR: "lint:eslint" exited with 2.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relates to eslint/eslint#18287

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this commit without a solution for the above, since that can be addressed separately, and is not related to with commit.

@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch from dbe5c6e to e0f4c00 Compare April 13, 2024 16:58
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
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-web-generator branch from e0f4c00 to c7accb4 Compare April 14, 2024 19:44
@stevepolitodesign stevepolitodesign merged commit e8eb46a into suspenders-3-0-0 Apr 14, 2024
2 checks passed
@stevepolitodesign stevepolitodesign deleted the suspenders-3-0-0-web-generator branch April 14, 2024 19:50
stevepolitodesign added a commit that referenced this pull request May 10, 2024
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
stevepolitodesign added a commit that referenced this pull request May 10, 2024
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`.
stevepolitodesign added a commit that referenced this pull request May 10, 2024
…#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
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.

1 participant