Skip to content

Commit efa9a2b

Browse files
Re-introduce system executable
Similar to the last rewrite, we generate a new gem and do a directory swap, while making sure to preserve important files like NEWS.md. This branch will serve as a new base for us to merge into while we build up an [application template][template]. This approach is largely inspired by [staples][]. [template]: https://guides.rubyonrails.org/generators.html#application-templates [staples]: https://github.com/stevepolitodesign/staples
1 parent 2cf74f1 commit efa9a2b

189 files changed

Lines changed: 365 additions & 5944 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dynamic-readme.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/dynamic-security.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Ruby
22

33
on:
44
push:
@@ -8,28 +8,78 @@ on:
88
pull_request:
99

1010
jobs:
11-
lint:
11+
build:
1212
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.4.7'
1318

1419
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up Ruby
17-
uses: ruby/setup-ruby@v1
18-
with:
19-
bundler-cache: true
20+
- uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: ${{ matrix.ruby }}
27+
bundler-cache: true
28+
- name: Run the default task
29+
run: bundle exec rake
2030

21-
- name: Lint
22-
run: bin/rails standard
23-
24-
test:
31+
test-template:
2532
runs-on: ubuntu-latest
2633

27-
steps:
28-
- uses: actions/checkout@v4
29-
- name: Set up Ruby
30-
uses: ruby/setup-ruby@v1
31-
with:
32-
bundler-cache: true
34+
services:
35+
postgres:
36+
image: postgres
37+
env:
38+
POSTGRES_USER: postgres
39+
POSTGRES_PASSWORD: postgres
40+
ports:
41+
- 5432:5432
42+
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
3343

34-
- name: Run tests
35-
run: bin/rails test
44+
steps:
45+
- name: Checkout template
46+
uses: actions/checkout@v4
47+
- name: Set up Ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '3.4.7'
51+
bundler-cache: false
52+
- name: Install Rails
53+
run: gem install rails
54+
- name: Install dependencies
55+
run: bundle install
56+
- name: Install Staples
57+
run: bundle exec rake install
58+
- name: Generate new Rails app with template
59+
run: |
60+
cd /tmp
61+
staples test_app
62+
- name: Set up generated app
63+
env:
64+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
65+
working-directory: /tmp/test_app
66+
run: |
67+
bundle install
68+
bin/setup --skip-server
69+
bin/rails db:migrate
70+
- name: Run tests in generated app
71+
env:
72+
RAILS_ENV: test
73+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
74+
working-directory: /tmp/test_app
75+
run: |
76+
bin/rails db:test:prepare
77+
bin/rails test:all
78+
- name: Verify app can start
79+
env:
80+
DATABASE_URL: postgres://postgres:postgres@localhost:5432
81+
working-directory: /tmp/test_app
82+
run: |
83+
timeout 10 bin/rails server > /dev/null 2>&1 &
84+
sleep 5
85+
curl -f http://localhost:3000 || exit 1

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
25
/doc/
3-
/log/*.log
46
/pkg/
7+
/spec/reports/
58
/tmp/
6-
/test/dummy/db/*.sqlite3
7-
/test/dummy/db/*.sqlite3-*
8-
/test/dummy/log/*.log
9-
/test/dummy/storage/
10-
/test/dummy/tmp/
11-
node_modules
9+
10+
# rspec failure tracking
11+
.rspec_status

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.standard.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
ruby_version: 3.0.5
2-
ignore:
3-
- "templates/partials/db_optimizations_configuration.rb"
4-
- "templates/partials/pull_requests_config.rb"
5-
- "templates/partials/email_smtp.rb"
1+
# For available configuration options, see:
2+
# https://github.com/standardrb/standard
3+
ruby_version: 3.2

CONTRIBUTING.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@ Run the setup script.
2020
./bin/setup
2121
```
2222

23-
Make sure the tests pass:
23+
Make sure everything passes:
2424

2525
```
26-
bin/rails test
27-
```
28-
29-
Make sure there are no linting violations:
30-
31-
```
32-
bin/rails standard
26+
bundle exec rake
3327
```
3428

3529
Make your change, with new passing tests.
@@ -46,16 +40,10 @@ This is a time for discussion and improvements,
4640
and making the necessary changes will be required before we can
4741
merge the contribution.
4842

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.
43+
## Testing the executable Locally
5644

57-
[assertions]: https://api.rubyonrails.org/classes/Rails/Generators/Testing/Assertions.html
58-
[helpers]: https://api.rubyonrails.org/classes/Rails/Generators/Testing/Behavior.html
45+
To install this gem onto your local machine, run `bundle exec rake install`.
46+
From there, you can run `suspenders <app_name>` to test the current code.
5947

6048
## Publishing to RubyGems
6149

Gemfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
2-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
34

4-
# Specify your gem's dependencies in suspenders.gemspec.
5+
# Specify your gem's dependencies in suspenders.gemspec
56
gemspec
67

7-
gem "puma"
8+
gem "irb"
9+
gem "rake", "~> 13.0"
810

9-
gem "sqlite3", ">= 2.1"
11+
gem "rspec", "~> 3.0"
1012

11-
# Start debugger with binding.b [https://github.com/ruby/debug]
12-
# gem "debug", ">= 1.0.0"
13+
gem "standard", "~> 1.3"

0 commit comments

Comments
 (0)