bootstrap_form 5.3.2 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.devcontainer.json +38 -0
- data/.github/workflows/ruby.yml +11 -4
- data/.gitignore +27 -8
- data/.rubocop.yml +5 -6
- data/.yarnrc +1 -1
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +34 -82
- data/DOCKER.md +95 -0
- data/Gemfile +5 -1
- data/README.md +143 -80
- data/RELEASING.md +3 -8
- data/Rakefile +23 -0
- data/bootstrap_form.gemspec +1 -1
- data/compose.yml +36 -0
- data/gemfiles/7.2.gemfile +9 -0
- data/gemfiles/8.0.gemfile +9 -0
- data/gemfiles/8.1.gemfile +9 -0
- data/gemfiles/common.gemfile +1 -2
- data/gemfiles/edge.gemfile +5 -1
- data/lib/bootstrap_form/action_view_extensions/form_helper.rb +6 -6
- data/lib/bootstrap_form/components/labels.rb +4 -3
- data/lib/bootstrap_form/components/validation.rb +1 -2
- data/lib/bootstrap_form/form_builder.rb +16 -8
- data/lib/bootstrap_form/form_group.rb +3 -3
- data/lib/bootstrap_form/form_group_builder.rb +3 -3
- data/lib/bootstrap_form/helpers/bootstrap.rb +15 -12
- data/lib/bootstrap_form/inputs/base.rb +15 -6
- data/lib/bootstrap_form/inputs/check_box.rb +11 -5
- data/lib/bootstrap_form/inputs/collection_check_boxes.rb +2 -8
- data/lib/bootstrap_form/inputs/file_field.rb +1 -1
- data/lib/bootstrap_form/inputs/range_field.rb +1 -1
- data/lib/bootstrap_form/inputs/rich_text_area.rb +3 -1
- data/lib/bootstrap_form/inputs/submit.rb +1 -1
- data/lib/bootstrap_form/inputs/text_area.rb +2 -0
- data/lib/bootstrap_form/version.rb +2 -2
- data/lib/bootstrap_form.rb +0 -6
- metadata +14 -12
- data/Dockerfile +0 -21
- data/docker-compose.yml +0 -31
- data/gemfiles/6.1.gemfile +0 -4
- data/gemfiles/7.0.gemfile +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1627869d85826ca2fb85c7b4257cf66cd26adc270fabe10bc05246b248eb26a
|
|
4
|
+
data.tar.gz: 2e5ec700c4c51b92aafe31633e92470318f7377740ba2da7e9f7738197c8ffe3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3f8a72059cee34fd75e6998f47662efd59f59c47cad3e998dea936a85ea8e38f059f37dc89794ebabc324c6e86ad7f8d50458c60db5b3a94f28d18dbdfa965a
|
|
7
|
+
data.tar.gz: 7207758b1628e88675c151ffc4d59256a37cc484d27ac7ee000eca6f2b32365cc2daf48c6541867c24757fdde7bff72911390dda25d070516ceb72c3dbc6beb7
|
data/.devcontainer.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
|
|
3
|
+
{
|
|
4
|
+
"name": "bootstrap_form",
|
|
5
|
+
|
|
6
|
+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
|
|
7
|
+
"dockerComposeFile": ["compose.yml", "compose.override.yml"],
|
|
8
|
+
|
|
9
|
+
// The 'service' property is the name of the service for the container that VS Code should
|
|
10
|
+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
|
|
11
|
+
"service": "web",
|
|
12
|
+
|
|
13
|
+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
|
|
14
|
+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
|
|
15
|
+
"workspaceFolder": "/app",
|
|
16
|
+
// "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
|
|
17
|
+
|
|
18
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
19
|
+
// "features": {},
|
|
20
|
+
|
|
21
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
22
|
+
// "forwardPorts": [],
|
|
23
|
+
|
|
24
|
+
// Uncomment the next line if you want start specific services in your Docker Compose config.
|
|
25
|
+
// "runServices": [],
|
|
26
|
+
|
|
27
|
+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
|
|
28
|
+
"shutdownAction": "none"
|
|
29
|
+
|
|
30
|
+
// Uncomment the next line to run commands after the container is created.
|
|
31
|
+
// "postCreateCommand": "cat /etc/os-release",
|
|
32
|
+
|
|
33
|
+
// Configure tool-specific properties.
|
|
34
|
+
// "customizations": {},
|
|
35
|
+
|
|
36
|
+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
|
37
|
+
// "remoteUser": "reid"
|
|
38
|
+
}
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -3,19 +3,20 @@ name: Ruby
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
6
7
|
|
|
7
8
|
jobs:
|
|
8
9
|
Lint:
|
|
9
10
|
runs-on: ubuntu-latest
|
|
10
11
|
env:
|
|
11
|
-
BUNDLE_GEMFILE: gemfiles/
|
|
12
|
+
BUNDLE_GEMFILE: gemfiles/7.2.gemfile
|
|
12
13
|
steps:
|
|
13
14
|
- uses: actions/checkout@v3
|
|
14
15
|
with:
|
|
15
16
|
fetch-depth: 0
|
|
16
17
|
- uses: ruby/setup-ruby@v1
|
|
17
18
|
with:
|
|
18
|
-
ruby-version: 3.
|
|
19
|
+
ruby-version: 3.2.9
|
|
19
20
|
bundler-cache: true
|
|
20
21
|
# Disabled since it requires access not granted by GitHub Actions for PRs
|
|
21
22
|
# - name: Danger
|
|
@@ -31,8 +32,8 @@ jobs:
|
|
|
31
32
|
strategy:
|
|
32
33
|
fail-fast: false
|
|
33
34
|
matrix:
|
|
34
|
-
ruby-version: [ '3.
|
|
35
|
-
gemfile: [ '
|
|
35
|
+
ruby-version: [ '3.4', '3.3', '3.2', 'ruby-head' ]
|
|
36
|
+
gemfile: [ '8.1', '8.0', '7.2', 'edge' ]
|
|
36
37
|
env:
|
|
37
38
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
38
39
|
steps:
|
|
@@ -53,6 +54,12 @@ jobs:
|
|
|
53
54
|
with:
|
|
54
55
|
working-directory: demo
|
|
55
56
|
bundler-cache: true
|
|
57
|
+
ruby-version: 3.4.2
|
|
56
58
|
- name: Run tests
|
|
57
59
|
working-directory: demo
|
|
58
60
|
run: bundle exec rake test:all
|
|
61
|
+
# - name: Commit changed screenshots and other files
|
|
62
|
+
# if: failure()
|
|
63
|
+
# working-directory: demo
|
|
64
|
+
# run: bundle exec rake commit
|
|
65
|
+
|
data/.gitignore
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
.
|
|
1
|
+
.npm/_update-notifier-last-checked
|
|
2
|
+
.npm/_cacache/
|
|
3
|
+
.npm/_logs/
|
|
4
|
+
.npm/_npx
|
|
5
|
+
|
|
2
6
|
.idea
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
/doc/
|
|
8
|
+
/log/*.log
|
|
9
|
+
/pkg/
|
|
10
|
+
/tmp/
|
|
11
|
+
|
|
5
12
|
demo/db/*.sqlite3
|
|
13
|
+
demo/db/*.sqlite3-shm
|
|
14
|
+
demo/db/*.sqlite3-wal
|
|
6
15
|
demo/doc/screenshots/**/*.diff.png
|
|
16
|
+
demo/doc/screenshots/**/*.base.png
|
|
7
17
|
demo/log/*.log
|
|
18
|
+
demo/storage
|
|
8
19
|
demo/tmp/
|
|
20
|
+
|
|
21
|
+
test/dummy/
|
|
22
|
+
|
|
9
23
|
*.gem
|
|
10
24
|
.rbenv-gemsets
|
|
11
25
|
*.swp
|
|
@@ -21,10 +35,6 @@ Vagrantfile
|
|
|
21
35
|
|
|
22
36
|
# For the demo app.
|
|
23
37
|
|
|
24
|
-
# Ignore uploaded files in development.
|
|
25
|
-
demo/storage/*
|
|
26
|
-
!demo/storage/.keep
|
|
27
|
-
|
|
28
38
|
demo/public/assets
|
|
29
39
|
**/.byebug_history
|
|
30
40
|
|
|
@@ -41,13 +51,14 @@ demo/.yarn-integrity
|
|
|
41
51
|
demo/vendor/bundle
|
|
42
52
|
|
|
43
53
|
# For stuff that gets created if using the Dockerfile image
|
|
44
|
-
|
|
54
|
+
/.bundle/
|
|
45
55
|
.cache/
|
|
46
56
|
vendor/bundle
|
|
47
57
|
|
|
48
58
|
# or .local/share/pry/pry_history if you need to be more exact
|
|
49
59
|
.local/
|
|
50
60
|
.irb_history
|
|
61
|
+
.rdbg_history
|
|
51
62
|
.byebug_history
|
|
52
63
|
# For Debian images with Bash
|
|
53
64
|
.bash_history
|
|
@@ -55,4 +66,12 @@ vendor/bundle
|
|
|
55
66
|
.ash_history
|
|
56
67
|
.sqlite_history
|
|
57
68
|
|
|
69
|
+
compose.override.yml
|
|
58
70
|
docker-compose.override.yml
|
|
71
|
+
|
|
72
|
+
.vscode-server/
|
|
73
|
+
.dotnet/
|
|
74
|
+
.gnupg/
|
|
75
|
+
.ssh/
|
|
76
|
+
.gitconfig
|
|
77
|
+
.gk/
|
data/.rubocop.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
2
|
- rubocop-performance
|
|
3
3
|
- rubocop-rails
|
|
4
4
|
|
|
5
5
|
AllCops:
|
|
6
6
|
DisplayCopNames: true
|
|
7
7
|
DisplayStyleGuide: true
|
|
8
|
-
TargetRubyVersion: 3.
|
|
9
|
-
TargetRailsVersion:
|
|
8
|
+
TargetRubyVersion: 3.2
|
|
9
|
+
TargetRailsVersion: 7.1
|
|
10
10
|
NewCops: enable
|
|
11
11
|
Exclude:
|
|
12
12
|
- bin/*
|
|
@@ -39,12 +39,11 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
|
|
39
39
|
|
|
40
40
|
Metrics/AbcSize:
|
|
41
41
|
Max: 18
|
|
42
|
-
|
|
43
|
-
- "demo/test/**/*"
|
|
44
|
-
- "test/**/*"
|
|
42
|
+
Enabled: false
|
|
45
43
|
|
|
46
44
|
Metrics/BlockLength:
|
|
47
45
|
Exclude:
|
|
46
|
+
- "lib/bootstrap_form/inputs/base.rb"
|
|
48
47
|
- "demo/config/**/*"
|
|
49
48
|
- "demo/test/**/*"
|
|
50
49
|
- "test/**/*"
|
data/.yarnrc
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ https://github.com/bootstrap-ruby/bootstrap_form/releases
|
|
|
6
6
|
|
|
7
7
|
## Diffs
|
|
8
8
|
|
|
9
|
+
- [5.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.4.0...v5.5.0)
|
|
10
|
+
[Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-10-30T00A00..2025-10-30T00)
|
|
11
|
+
- [5.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.2...v5.4.0)
|
|
12
|
+
[Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-09-15T21%3A00..2023-10-30T00)
|
|
9
13
|
- [5.3.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.1...v5.3.2)
|
|
10
14
|
[Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-09-15T15%3A00..2023-09-15T21%3A00)
|
|
11
15
|
- [5.3.1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.0...v5.3.1)
|
|
@@ -55,6 +59,7 @@ The tooling to support our old way of doing the change log doesn't work anymore,
|
|
|
55
59
|
* [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
|
|
56
60
|
|
|
57
61
|
* [#215](https://github.com/bootstrap-ruby/bootstrap_form/issues/215): Add `include_hidden` option to `check_box`
|
|
62
|
+
|
|
58
63
|
### Bugfixes
|
|
59
64
|
|
|
60
65
|
* [#582](https://github.com/bootstrap-ruby/bootstrap_form/issues/582): Fix tests in bootstrap-5 branch, removes Rubocop offenses, and adds testing with Rails 6.1.
|
data/CONTRIBUTING.md
CHANGED
|
@@ -50,6 +50,36 @@ You may find the [demo application](#the-demo-application) useful for developmen
|
|
|
50
50
|
- If your PR fixes an issues, be sure to put "Fixes #nnn" in the description of the PR (where `nnn` is the issue number). Github will automatically close the issue when the PR is merged.
|
|
51
51
|
- When the PR is submitted, check if GitHub Actions ran all the tests successfully, and didn't raise any issues.
|
|
52
52
|
|
|
53
|
+
When you create or update a pull request, GitHub automatically runs tests that generate the screenshots in the [`README.md`](/README.md). If any of the screenshots change, GitHub will add an additional commit to your branch, with the updated screenshots.
|
|
54
|
+
|
|
55
|
+
Normally, the screenshots should _not_ change. If the screenshots changed, please review them _carefully_. Some clear reasons why you would want to keep the changed screenshots:
|
|
56
|
+
|
|
57
|
+
- Your PR was fixing behaviour that was wrong in the screenshot.
|
|
58
|
+
- You added new examples in the documentation, so there are new screenshots.
|
|
59
|
+
- A change to the images used by GitHub in their actions changes the behaviour of Chrome, although if you think it's this you should probably prepare a separate PR that _only_ updates the screenshots, so it's clear what the change is and why we're making the change.
|
|
60
|
+
|
|
61
|
+
Unless you have one of the above reasons, or you have a good explanation for why the screenshots have changed with your PR, you need to get rid of the changed screenshots (i.e. revert the last commit) and fix your PR so the screenshots don't change. (The reason you should revert the commit with the screenshots is so that the next time you push, GitHub will compare against the original screenshots, not the ones changed by your previous push.) Here's how to get rid of the changed screenshots:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git pull # to bring the additional commit to your local branch.
|
|
65
|
+
git revert HEAD # to remove the changes.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then fix the code and push your branch again.
|
|
69
|
+
|
|
70
|
+
If the change was intended, a comment in the PR explaing why the change is expected would be very much appreciated. More than appreciated. It will avoid us having to ask you for an explanation.
|
|
71
|
+
|
|
72
|
+
You can run the tests that generate the screenshots locally, but unless your environment is very much like the GitHub CI environment -- Ubuntu running Chrome with default fonts -- all the screenshots will be reported as having changed. To generate the screenshots:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd demo
|
|
76
|
+
bundle exec rails test:all # or test:system
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The [Docker development environment](#developing-with-docker) appears to generate screenshots that are the same as what GitHub generates.
|
|
80
|
+
|
|
81
|
+
Finally, maintainers may sometimes push changes directly to `main` or use other workflows to update the code. If pushing to `main` generates a commit for screenshot changes, please consider reverting your change immediately by executing the above `pull` and `revert` and another `push`, for the sanity of users who are using the edge (`main` branch) version of the gem. At any rate, review the changes promptly and use your judgement.
|
|
82
|
+
|
|
53
83
|
### 7. Done
|
|
54
84
|
|
|
55
85
|
Somebody will shortly review your pull request and if everything is good, it will be
|
|
@@ -74,89 +104,11 @@ The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/mainte
|
|
|
74
104
|
|
|
75
105
|
### Developing with Docker
|
|
76
106
|
|
|
77
|
-
This repository offers experimental support
|
|
78
|
-
|
|
79
|
-
- Using `docker-compose`. This way is less tested, and is an attempt to make the Docker container a more complete environment where you can conveniently develop and release the gem.
|
|
80
|
-
- Using just a simple Dockerfile. This way works for simple testing, but doesn't make it easy to release the gem, among other things.
|
|
81
|
-
|
|
82
|
-
Docker is _not_ required to work on this gem.
|
|
83
|
-
|
|
84
|
-
#### Using `docker-compose`
|
|
85
|
-
|
|
86
|
-
The `docker-compose` approach should link to enough of your networking configuration that you can release the gem.
|
|
87
|
-
However, you have to do some of the configuration yourself, because it's dependent on your host operating system.
|
|
88
|
-
You can run a shell in a Docker container that pretty much should behave like a Debian distribution with:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
docker-compose run --service-ports shell
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
(`--service-ports` exposes port 3000 so you can browse to the demo app on `localhost:3000`. If you just want to run a on-off command, or run the test suite, leave off the `--service-ports`.)
|
|
95
|
-
|
|
96
|
-
The following instructions work for an Ubuntu host, and will probably work for other common Linux distributions.
|
|
97
|
-
|
|
98
|
-
Add a `docker-compose.override.yml` in the local directory, that looks like this:
|
|
99
|
-
|
|
100
|
-
```docker-compose.yml
|
|
101
|
-
version: '3.3'
|
|
102
|
-
|
|
103
|
-
# https://blog.giovannidemizio.eu/2021/05/24/how-to-set-user-and-group-in-docker-compose/
|
|
104
|
-
|
|
105
|
-
services:
|
|
106
|
-
shell:
|
|
107
|
-
# You have to set the user and group for this process, because you're going to be
|
|
108
|
-
# creating all kinds of files from inside the container, that need to persist
|
|
109
|
-
# outside the container.
|
|
110
|
-
# Change `1000:1000` to the user and default group of your laptop user.
|
|
111
|
-
user: 1000:1000
|
|
112
|
-
volumes:
|
|
113
|
-
- /etc/passwd:/etc/passwd:ro
|
|
114
|
-
- ~/.gem/credentials:/app/.gem/credentials:ro
|
|
115
|
-
# $HOME here is your host computer's `~`, e.g. `/home/reid`.
|
|
116
|
-
# `ssh` explicitly looks for its config in the home directory from `/etc/passwd`,
|
|
117
|
-
# so the target for this has to look like your home directory on the host.
|
|
118
|
-
- ~/.ssh:${HOME}/.ssh:ro
|
|
119
|
-
- ${SSH_AUTH_SOCK}:/ssh-agent
|
|
120
|
-
environment:
|
|
121
|
-
- SSH_AUTH_SOCK=/ssh-agent
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
You may have to change the `1000:1000` to the user and group IDs of your laptop. You may also have to change the `version` parameter to match the version of the `docker-compose.yml` file.
|
|
125
|
-
|
|
126
|
-
Adapting the above `docker-compose.override.yml` for MacOS should be relatively straight-forward. Windows users, I'm afraid you're on your own.
|
|
127
|
-
|
|
128
|
-
#### Simple Dockerfile
|
|
129
|
-
|
|
130
|
-
This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
docker build --tag bootstrap_form .
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
This builds an image called `bootstrap_form`. You can change that to any tag you wish. Just make sure you use the same tag name in the `docker run` command.
|
|
137
|
-
|
|
138
|
-
If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
docker build --build-arg "RUBY_VERSION=3.0" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Then run the container you built with the shell, and create the bundle:
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -it bootstrap_form /bin/bash
|
|
148
|
-
bundle install
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
You can run tests in the container as normal, with `rake test`.
|
|
152
|
-
|
|
153
|
-
(Some of that command line is need for Linux hosts, to run the container as the current user.)
|
|
154
|
-
|
|
155
|
-
One of the disadvantages of this approach is that you can't release the gem from here, because the Docker container doesn't have access to your SSH credentials, or the right user name, or perhaps other things needed to release a gem. But for simple testing, it works.
|
|
107
|
+
This repository offers experimental support for development using Docker. Docker is _not_ required to do development work on this gem.
|
|
156
108
|
|
|
157
|
-
|
|
109
|
+
One advantage of the Docker environment is that it allows you to generate and compare the screenshots with the expected screenshots in the repo. It also allows you to develop in an environment that is isolated from your own computer's set-up, so there's less risk of breaking other things you might be doing with your computer.
|
|
158
110
|
|
|
159
|
-
|
|
111
|
+
If you're intested in trying the Docker approach, read the [documentation](DOCKER.md).
|
|
160
112
|
|
|
161
113
|
### The Demo Application
|
|
162
114
|
|
|
@@ -199,7 +151,7 @@ Please try to keep the checked-in `.ruby-version` set to the oldest supported ve
|
|
|
199
151
|
For the record, the demo app is set up as if the Rails app had been created with:
|
|
200
152
|
|
|
201
153
|
```sh
|
|
202
|
-
rails new
|
|
154
|
+
rails new -d sqlite --edge -j esbuild -c bootstrap .
|
|
203
155
|
```
|
|
204
156
|
|
|
205
157
|
This means it's using `esbuild` to pre-process the JavaScript and (S)CSS, and that it's using [`jsbunding-rails`](https://github.com/rails/jsbundling-rails) and [`cssbundling-rails`](https://github.com/rails/cssbundling-rails) to put the assets in `app/assets/builds`, before the Sprockets assets pipeline serves them in development, or pre-compiles them in production.
|
data/DOCKER.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Working With Docker
|
|
2
|
+
|
|
3
|
+
This repository offers experimental support support for developing using Docker, if you're interested. Docker is _not_ required to work on this gem.
|
|
4
|
+
|
|
5
|
+
The `docker compose` approach should link to enough of your networking configuration that you can release the gem.
|
|
6
|
+
However, you have to do some of the configuration yourself, because it's dependent on your host operating system.
|
|
7
|
+
|
|
8
|
+
## Set-Up
|
|
9
|
+
|
|
10
|
+
Put your personal and OS-specific configuration in a `compose.override.yml` file.
|
|
11
|
+
|
|
12
|
+
The following instructions work for an Ubuntu host, and will probably work for other common Linux distributions. Add a `compose.override.yml` in the local directory, that looks like this:
|
|
13
|
+
|
|
14
|
+
```compose.override.yml
|
|
15
|
+
# https://blog.giovannidemizio.eu/2021/05/24/how-to-set-user-and-group-in-docker compose/
|
|
16
|
+
|
|
17
|
+
services:
|
|
18
|
+
web:
|
|
19
|
+
# You have to set the user and group for this process, because you're going to be
|
|
20
|
+
# creating all kinds of files from inside the container, that need to persist
|
|
21
|
+
# outside the container.
|
|
22
|
+
# Change `1000:1000` to the user and default group of your laptop user.
|
|
23
|
+
user: 1000:1000
|
|
24
|
+
volumes:
|
|
25
|
+
- /etc/passwd:/etc/passwd:ro
|
|
26
|
+
- ~/.gem/credentials:/app/.gem/credentials:ro
|
|
27
|
+
# $HOME here is your host computer's `~`, e.g. `/home/reid`.
|
|
28
|
+
# `ssh` explicitly looks for its config in the home directory from `/etc/passwd`,
|
|
29
|
+
# so the target for this has to look like your home directory on the host.
|
|
30
|
+
- ~/.ssh:${HOME}/.ssh:ro
|
|
31
|
+
- ${SSH_AUTH_SOCK}:/ssh-agent
|
|
32
|
+
environment:
|
|
33
|
+
- SSH_AUTH_SOCK=/ssh-agent
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You may have to change the `1000:1000` to the user and group IDs of your laptop. You may also have to change the `version` parameter to match the version of the `docker compose.yml` file.
|
|
37
|
+
|
|
38
|
+
Adapting the above `compose.override.yml` for MacOS should be relatively straight-forward. Windows users, I'm afraid you're on your own. If you figure this out, a PR documenting how to do it would be most welcome.
|
|
39
|
+
|
|
40
|
+
## Running
|
|
41
|
+
|
|
42
|
+
Start the containers:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
docker compose up -d
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You may need to install or update the gems:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
docker compose exec web bundle install
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
To get a shell in the container:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
docker compose exec web /bin/bash
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Once in the shell, run tests:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
bundle exec rake test
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Run the demo app and browse to it:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd demo
|
|
70
|
+
bin/dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
On the host, not the Docker container, get the port number(s) you can use in the browser to access the test app running in the Docker container:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
docker compose port web 3001 | cut -d: -f 2 # Browser
|
|
77
|
+
docker compose port web 7900 | cut -d: -f 2 # To watch the browser execute system tests.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Browse to `localhost:<port number from above>`.
|
|
81
|
+
|
|
82
|
+
Run system tests:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd demo
|
|
86
|
+
bundle exec rails test:system
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Note that this system test approach is highly experimental and has some rough edges. The docker compose file and/or steps to run system tests may change.
|
|
90
|
+
|
|
91
|
+
## Troubleshooting Docker
|
|
92
|
+
|
|
93
|
+
- With the above configuration, the gems are kept in `vendor/bundle` on your hosts, which is `$GEM_HOME` or `/app/vendor/bundle` in the running Docker container. If you're having permission problems when switching versions of Ruby or Rails, you can try `sudo rm -rf vendor/bundle` on the host, then run `BUNDLE_GEMFILES=gemfiles/7.0.gemfile bundle update` in the Docker container to re-install all the gems with the right permissions.
|
|
94
|
+
- Sometimes, on shutdown, the Rails server PID file isn't removed, and so the above will fail. `rm demo/tmp/pids/server.pid` will fix it.
|
|
95
|
+
|
data/Gemfile
CHANGED
|
@@ -3,5 +3,9 @@ eval File.read(gems), binding, gems # rubocop: disable Security/Eval
|
|
|
3
3
|
|
|
4
4
|
require "#{__dir__}/lib/bootstrap_form/version"
|
|
5
5
|
|
|
6
|
+
gem "bigdecimal" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0")
|
|
7
|
+
gem "drb" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0")
|
|
8
|
+
gem "mutex_m" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0")
|
|
6
9
|
gem "rails", BootstrapForm::REQUIRED_RAILS_VERSION
|
|
7
|
-
gem "
|
|
10
|
+
gem "propshaft"
|
|
11
|
+
gem "sqlite3"
|