bootstrap_form 5.4.0 → 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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer.json +38 -0
  3. data/.github/workflows/ruby.yml +11 -4
  4. data/.gitignore +20 -7
  5. data/.rubocop.yml +4 -6
  6. data/.yarnrc +1 -1
  7. data/CHANGELOG.md +3 -0
  8. data/CONTRIBUTING.md +33 -108
  9. data/DOCKER.md +95 -0
  10. data/Gemfile +5 -1
  11. data/README.md +135 -72
  12. data/RELEASING.md +2 -9
  13. data/Rakefile +23 -0
  14. data/bootstrap_form.gemspec +1 -1
  15. data/compose.yml +36 -0
  16. data/gemfiles/7.2.gemfile +9 -0
  17. data/gemfiles/8.0.gemfile +9 -0
  18. data/gemfiles/8.1.gemfile +9 -0
  19. data/gemfiles/common.gemfile +1 -2
  20. data/gemfiles/edge.gemfile +5 -1
  21. data/lib/bootstrap_form/action_view_extensions/form_helper.rb +6 -6
  22. data/lib/bootstrap_form/components/labels.rb +2 -2
  23. data/lib/bootstrap_form/components/validation.rb +0 -1
  24. data/lib/bootstrap_form/form_builder.rb +12 -6
  25. data/lib/bootstrap_form/form_group.rb +3 -3
  26. data/lib/bootstrap_form/form_group_builder.rb +2 -2
  27. data/lib/bootstrap_form/helpers/bootstrap.rb +6 -6
  28. data/lib/bootstrap_form/inputs/base.rb +8 -6
  29. data/lib/bootstrap_form/inputs/check_box.rb +11 -5
  30. data/lib/bootstrap_form/inputs/collection_check_boxes.rb +2 -8
  31. data/lib/bootstrap_form/inputs/file_field.rb +1 -1
  32. data/lib/bootstrap_form/inputs/range_field.rb +1 -1
  33. data/lib/bootstrap_form/inputs/rich_text_area.rb +2 -0
  34. data/lib/bootstrap_form/inputs/submit.rb +1 -1
  35. data/lib/bootstrap_form/inputs/text_area.rb +2 -0
  36. data/lib/bootstrap_form/version.rb +2 -2
  37. data/lib/bootstrap_form.rb +0 -10
  38. metadata +17 -17
  39. data/Dockerfile +0 -22
  40. data/docker-compose-system-test.yml +0 -45
  41. data/docker-compose.yml +0 -29
  42. data/gemfiles/6.1.gemfile +0 -4
  43. data/gemfiles/7.0.gemfile +0 -5
  44. data/gemfiles/7.1.gemfile +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f83f141afb358e5297da435acb97a61de05d38ba70493ce820a0679f002eab41
4
- data.tar.gz: edf0410f0a0239f36c0ea4a779e235cc5ee494a2efa2d9ecda2875222c1ba1fe
3
+ metadata.gz: f1627869d85826ca2fb85c7b4257cf66cd26adc270fabe10bc05246b248eb26a
4
+ data.tar.gz: 2e5ec700c4c51b92aafe31633e92470318f7377740ba2da7e9f7738197c8ffe3
5
5
  SHA512:
6
- metadata.gz: 714e076f29f7067163d28e28e373db2adb41da65d60ee41b90cdabbdd0516d337ed8353e06fad10b86138d6fcd0bc2a14ea21cf6370ef2b74e8a56e2d93052d5
7
- data.tar.gz: edf5fa822ad030d78df3a4c7b2f702406e34d956f9a8c02c0ac034fa94589fda0d0ef2a8ff2755a5fecdb15d5c9cdf27e5fdd189d2bf9d91625189681dfcd00e
6
+ metadata.gz: d3f8a72059cee34fd75e6998f47662efd59f59c47cad3e998dea936a85ea8e38f059f37dc89794ebabc324c6e86ad7f8d50458c60db5b3a94f28d18dbdfa965a
7
+ data.tar.gz: 7207758b1628e88675c151ffc4d59256a37cc484d27ac7ee000eca6f2b32365cc2daf48c6541867c24757fdde7bff72911390dda25d070516ceb72c3dbc6beb7
@@ -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
+ }
@@ -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/6.1.gemfile
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.0.6
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.2', '3.1', '3.0', 'ruby-head' ]
35
- gemfile: [ '7.1', '7.0', '6.1', 'edge' ]
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
@@ -4,14 +4,22 @@
4
4
  .npm/_npx
5
5
 
6
6
  .idea
7
- log/*.log
8
- pkg/
7
+ /doc/
8
+ /log/*.log
9
+ /pkg/
10
+ /tmp/
11
+
9
12
  demo/db/*.sqlite3
10
13
  demo/db/*.sqlite3-shm
11
14
  demo/db/*.sqlite3-wal
12
15
  demo/doc/screenshots/**/*.diff.png
16
+ demo/doc/screenshots/**/*.base.png
13
17
  demo/log/*.log
18
+ demo/storage
14
19
  demo/tmp/
20
+
21
+ test/dummy/
22
+
15
23
  *.gem
16
24
  .rbenv-gemsets
17
25
  *.swp
@@ -27,10 +35,6 @@ Vagrantfile
27
35
 
28
36
  # For the demo app.
29
37
 
30
- # Ignore uploaded files in development.
31
- demo/storage/*
32
- !demo/storage/.keep
33
-
34
38
  demo/public/assets
35
39
  **/.byebug_history
36
40
 
@@ -47,13 +51,14 @@ demo/.yarn-integrity
47
51
  demo/vendor/bundle
48
52
 
49
53
  # For stuff that gets created if using the Dockerfile image
50
- .bundle/
54
+ /.bundle/
51
55
  .cache/
52
56
  vendor/bundle
53
57
 
54
58
  # or .local/share/pry/pry_history if you need to be more exact
55
59
  .local/
56
60
  .irb_history
61
+ .rdbg_history
57
62
  .byebug_history
58
63
  # For Debian images with Bash
59
64
  .bash_history
@@ -61,4 +66,12 @@ vendor/bundle
61
66
  .ash_history
62
67
  .sqlite_history
63
68
 
69
+ compose.override.yml
64
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
- require:
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.0
9
- TargetRailsVersion: 6.1
8
+ TargetRubyVersion: 3.2
9
+ TargetRailsVersion: 7.1
10
10
  NewCops: enable
11
11
  Exclude:
12
12
  - bin/*
@@ -39,9 +39,7 @@ Layout/SpaceAroundEqualsInParameterDefault:
39
39
 
40
40
  Metrics/AbcSize:
41
41
  Max: 18
42
- Exclude:
43
- - "demo/test/**/*"
44
- - "test/**/*"
42
+ Enabled: false
45
43
 
46
44
  Metrics/BlockLength:
47
45
  Exclude:
data/.yarnrc CHANGED
@@ -2,4 +2,4 @@
2
2
  # yarn lockfile v1
3
3
 
4
4
 
5
- lastUpdateCheck 1698606246341
5
+ lastUpdateCheck 1761786460258
data/CHANGELOG.md CHANGED
@@ -6,6 +6,8 @@ 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)
9
11
  - [5.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.2...v5.4.0)
10
12
  [Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-09-15T21%3A00..2023-10-30T00)
11
13
  - [5.3.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.1...v5.3.2)
@@ -57,6 +59,7 @@ The tooling to support our old way of doing the change log doesn't work anymore,
57
59
  * [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
58
60
 
59
61
  * [#215](https://github.com/bootstrap-ruby/bootstrap_form/issues/215): Add `include_hidden` option to `check_box`
62
+
60
63
  ### Bugfixes
61
64
 
62
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,140 +50,65 @@ 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
- ### 7. Done
54
-
55
- Somebody will shortly review your pull request and if everything is good, it will be
56
- merged into the main branch. Eventually the gem will be published with your changes.
57
-
58
- ### Coding guidelines
59
-
60
- This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding
61
- guidelines.
62
-
63
- - Test that your contribution passes with `rake rubocop`.
64
- - RuboCop is also run as part of the full test suite with `bundle exec rake`.
65
- - Note the Travis build will fail and your PR cannot be merged if RuboCop finds offences.
66
-
67
- Note that most editors have plugins to run RuboCop as you type, or when you save a file. You may find it well worth your time to install and configure the RuboCop plugin for your editor. Read the [RuboCop documentation](https://rubocop.readthedocs.io/en/latest/integration_with_other_tools/).
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.
68
54
 
69
- ### Supported Versions of Ruby and Rails
70
-
71
- The goal of `bootstrap_form` is to support all versions of Rails currently supported for bug fixes and security issues. We do not test against versions supported for severe security issues. We test against the minimum [version of Ruby required](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#ruby-versions) for those versions of Rails.
72
-
73
- The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/maintenance_policy.html).
74
-
75
- ### Developing with Docker
76
-
77
- This repository offers experimental support support for a couple of ways to develop using Docker, if you're interested:
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:
78
56
 
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.
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.
81
60
 
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
-
89
- First, build the image for whatever version of Ruby you need (typically either the earliest supported version or the latest):
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:
90
62
 
91
63
  ```bash
92
- RUBY_VERSION=3.2 docker-compose build
64
+ git pull # to bring the additional commit to your local branch.
65
+ git revert HEAD # to remove the changes.
93
66
  ```
94
67
 
95
- You can run a shell in a Docker container that pretty much should behave like a Debian distribution with:
68
+ Then fix the code and push your branch again.
96
69
 
97
- ```bash
98
- docker-compose run --service-ports shell
99
- ```
100
-
101
- (`--service-ports` exposes port 3000 so you can browse to the demo app on `localhost:3000`. If you just want to run a one-off command, or run the test suite, leave off the `--service-ports`.)
102
-
103
- The following instructions work for an Ubuntu host, and will probably work for other common Linux distributions.
104
-
105
- Add a `docker-compose.override.yml` in the local directory, that looks like this:
106
-
107
- ```docker-compose.yml
108
- version: '3.3'
109
-
110
- # https://blog.giovannidemizio.eu/2021/05/24/how-to-set-user-and-group-in-docker-compose/
111
-
112
- services:
113
- shell:
114
- # You have to set the user and group for this process, because you're going to be
115
- # creating all kinds of files from inside the container, that need to persist
116
- # outside the container.
117
- # Change `1000:1000` to the user and default group of your laptop user.
118
- user: 1000:1000
119
- volumes:
120
- - /etc/passwd:/etc/passwd:ro
121
- - ~/.gem/credentials:/app/.gem/credentials:ro
122
- # $HOME here is your host computer's `~`, e.g. `/home/reid`.
123
- # `ssh` explicitly looks for its config in the home directory from `/etc/passwd`,
124
- # so the target for this has to look like your home directory on the host.
125
- - ~/.ssh:${HOME}/.ssh:ro
126
- - ${SSH_AUTH_SOCK}:/ssh-agent
127
- environment:
128
- - SSH_AUTH_SOCK=/ssh-agent
129
- ```
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.
130
71
 
131
- 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.
132
-
133
- Adapting the above `docker-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.
134
-
135
- The above doesn't allow you to run the system tests. To keep the image small, it doesn't include Chrome or any other browser.
136
-
137
- There is an experimental `docker-compose-system-test.yml` file, that runs the `bootstrap_forms` docker container along with an off-the-shelf Selenium container. To start this configuration:
138
-
139
- ```bash
140
- RUBY_VERSION=3.2 docker-compose -f docker-compose-system-test.yml -f docker-compose.override.yml up&
141
- RUBY_VERSION=3.2 docker-compose -f docker-compose-system-test.yml -f docker-compose.override.yml exec shell /bin/bash
142
- ```
143
-
144
- (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.)
145
-
146
- Once in the shell:
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:
147
73
 
148
74
  ```bash
149
75
  cd demo
150
- bundle exec rails test:system
76
+ bundle exec rails test:all # or test:system
151
77
  ```
152
78
 
153
- 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. The tests currently fail, because the files with which they're being compared were generated on a Mac, but the Docker containers are running Linux.
79
+ The [Docker development environment](#developing-with-docker) appears to generate screenshots that are the same as what GitHub generates.
154
80
 
155
- #### Simple Dockerfile
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.
156
82
 
157
- This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
83
+ ### 7. Done
158
84
 
159
- ```bash
160
- docker build --tag bootstrap_form .
161
- ```
85
+ Somebody will shortly review your pull request and if everything is good, it will be
86
+ merged into the main branch. Eventually the gem will be published with your changes.
162
87
 
163
- 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.
88
+ ### Coding guidelines
164
89
 
165
- If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
90
+ This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding
91
+ guidelines.
166
92
 
167
- ```bash
168
- docker build --build-arg "RUBY_VERSION=3.0" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
169
- ```
93
+ - Test that your contribution passes with `rake rubocop`.
94
+ - RuboCop is also run as part of the full test suite with `bundle exec rake`.
95
+ - Note the Travis build will fail and your PR cannot be merged if RuboCop finds offences.
96
+
97
+ Note that most editors have plugins to run RuboCop as you type, or when you save a file. You may find it well worth your time to install and configure the RuboCop plugin for your editor. Read the [RuboCop documentation](https://rubocop.readthedocs.io/en/latest/integration_with_other_tools/).
170
98
 
171
- Then run the container you built with the shell, and create the bundle:
99
+ ### Supported Versions of Ruby and Rails
172
100
 
173
- ```bash
174
- docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -it bootstrap_form /bin/bash
175
- bundle install
176
- ```
101
+ The goal of `bootstrap_form` is to support all versions of Rails currently supported for bug fixes and security issues. We do not test against versions supported for severe security issues. We test against the minimum [version of Ruby required](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#ruby-versions) for those versions of Rails.
177
102
 
178
- You can run tests in the container as normal, with `rake test`.
103
+ The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/maintenance_policy.html).
179
104
 
180
- (Some of that command line is need for Linux hosts, to run the container as the current user.)
105
+ ### Developing with Docker
181
106
 
182
- 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.
183
108
 
184
- #### Troubleshooting Docker
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.
185
110
 
186
- - 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.
111
+ If you're intested in trying the Docker approach, read the [documentation](DOCKER.md).
187
112
 
188
113
  ### The Demo Application
189
114
 
@@ -226,7 +151,7 @@ Please try to keep the checked-in `.ruby-version` set to the oldest supported ve
226
151
  For the record, the demo app is set up as if the Rails app had been created with:
227
152
 
228
153
  ```sh
229
- rails new --skip-hotwire -d sqlite --edge -j esbuild -c bootstrap .
154
+ rails new -d sqlite --edge -j esbuild -c bootstrap .
230
155
  ```
231
156
 
232
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 "sprockets-rails", require: "sprockets/railtie"
10
+ gem "propshaft"
11
+ gem "sqlite3"