bootstrap_form 5.1.0 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +21 -8
- data/.gitignore +4 -2
- data/.rubocop.yml +2 -1
- data/.yarnrc +5 -0
- data/CHANGELOG.md +13 -3
- data/CONTRIBUTING.md +101 -14
- data/Dangerfile +4 -4
- data/Dockerfile +5 -5
- data/Gemfile +5 -21
- data/README.md +108 -42
- data/RELEASING.md +12 -1
- data/Rakefile +7 -6
- data/bootstrap_form.gemspec +6 -8
- data/docker-compose.yml +6 -24
- data/gemfiles/6.0.gemfile +1 -1
- data/gemfiles/6.1.gemfile +1 -1
- data/gemfiles/7.0.gemfile +2 -3
- data/gemfiles/common.gemfile +28 -0
- data/gemfiles/edge.gemfile +3 -2
- data/lib/bootstrap_form/components/labels.rb +3 -9
- data/lib/bootstrap_form/components/validation.rb +36 -19
- data/lib/bootstrap_form/form_builder.rb +4 -1
- data/lib/bootstrap_form/form_group.rb +9 -6
- data/lib/bootstrap_form/form_group_builder.rb +10 -7
- data/lib/bootstrap_form/helpers/bootstrap.rb +7 -8
- data/lib/bootstrap_form/helpers/field.rb +26 -0
- data/lib/bootstrap_form/helpers.rb +1 -0
- data/lib/bootstrap_form/inputs/base.rb +2 -2
- data/lib/bootstrap_form/inputs/check_box.rb +22 -6
- data/lib/bootstrap_form/inputs/radio_button.rb +3 -3
- data/lib/bootstrap_form/inputs/range_field.rb +1 -1
- data/lib/bootstrap_form/inputs.rb +1 -1
- data/lib/bootstrap_form/version.rb +2 -1
- data/lib/bootstrap_form.rb +1 -1
- metadata +14 -146
- data/demo/.postcssrc.yml +0 -3
- data/demo/.ruby-version +0 -1
- data/demo/Gemfile +0 -80
- data/demo/Gemfile.lock +0 -261
- data/demo/Procfile.dev +0 -2
- data/demo/README.md +0 -17
- data/demo/Rakefile +0 -6
- data/demo/app/assets/builds/.keep +0 -0
- data/demo/app/assets/builds/application.js.LICENSE.txt +0 -9
- data/demo/app/assets/config/manifest.js +0 -2
- data/demo/app/assets/stylesheets/actiontext.css +0 -31
- data/demo/app/assets/stylesheets/actiontext.scss +0 -38
- data/demo/app/assets/stylesheets/application.scss +0 -1
- data/demo/app/controllers/application_controller.rb +0 -2
- data/demo/app/controllers/bootstrap_controller.rb +0 -29
- data/demo/app/controllers/users_controller.rb +0 -9
- data/demo/app/helpers/bootstrap_helper.rb +0 -27
- data/demo/app/javascript/application.js +0 -3
- data/demo/app/javascript/channels/consumer.js +0 -6
- data/demo/app/javascript/channels/index.js +0 -5
- data/demo/app/javascript/packs/application.js +0 -11
- data/demo/app/models/address.rb +0 -3
- data/demo/app/models/application_record.rb +0 -3
- data/demo/app/models/faux_user.rb +0 -9
- data/demo/app/models/skill.rb +0 -15
- data/demo/app/models/super_user.rb +0 -2
- data/demo/app/models/user.rb +0 -25
- data/demo/app/views/active_storage/blobs/_blob.html.erb +0 -14
- data/demo/app/views/bootstrap/form.html.erb +0 -67
- data/demo/app/views/layouts/action_text/contents/_content.html.erb +0 -3
- data/demo/app/views/layouts/application.html.erb +0 -76
- data/demo/bin/bundle +0 -3
- data/demo/bin/dev +0 -9
- data/demo/bin/rails +0 -4
- data/demo/bin/rake +0 -4
- data/demo/bin/setup +0 -36
- data/demo/bin/update +0 -31
- data/demo/bin/webpack +0 -15
- data/demo/bin/webpack-dev-server +0 -15
- data/demo/bin/yarn +0 -11
- data/demo/config/application.rb +0 -21
- data/demo/config/boot.rb +0 -5
- data/demo/config/database.yml +0 -21
- data/demo/config/environment.rb +0 -5
- data/demo/config/environments/development.rb +0 -60
- data/demo/config/environments/production.rb +0 -48
- data/demo/config/environments/test.rb +0 -46
- data/demo/config/initializers/application_controller_renderer.rb +0 -8
- data/demo/config/initializers/backtrace_silencers.rb +0 -7
- data/demo/config/initializers/cookies_serializer.rb +0 -5
- data/demo/config/initializers/filter_parameter_logging.rb +0 -4
- data/demo/config/initializers/inflections.rb +0 -16
- data/demo/config/initializers/mime_types.rb +0 -4
- data/demo/config/initializers/wrap_parameters.rb +0 -14
- data/demo/config/locales/en.yml +0 -33
- data/demo/config/puma.rb +0 -56
- data/demo/config/routes.rb +0 -6
- data/demo/config/spring.rb +0 -6
- data/demo/config/storage.yml +0 -35
- data/demo/config/webpack/development.js +0 -5
- data/demo/config/webpack/environment.js +0 -3
- data/demo/config/webpack/production.js +0 -5
- data/demo/config/webpack/test.js +0 -5
- data/demo/config/webpacker.yml +0 -92
- data/demo/config.ru +0 -5
- data/demo/db/schema.rb +0 -84
- data/demo/doc/screenshots/bootstrap/index/00_horizontal_form.png +0 -0
- data/demo/doc/screenshots/bootstrap/index/01_with_validation_error.png +0 -0
- data/demo/doc/screenshots/bootstrap/index/02_inline_form.png +0 -0
- data/demo/doc/screenshots/bootstrap/index/03_simple_action_text_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/index/04_floating_labels.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/00_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/01_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/02_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/03_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/04_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/05_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/06_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/07_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/08_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/09_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/10_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/11_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/12_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/13_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/14_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/15_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/16_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/17_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/18_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/19_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/20_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/21_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/22_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/23_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/24_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/25_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/26_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/27_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/28_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/29_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/30_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/31_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/32_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/33_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/34_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/35_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/36_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/37_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/38_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/39_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/40_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/41_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/42_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/43_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/44_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/45_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/46_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/47_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/48_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/49_example.png +0 -0
- data/demo/doc/screenshots/bootstrap/readme/50_example.png +0 -0
- data/demo/log/.keep +0 -0
- data/demo/package.json +0 -21
- data/demo/public/favicon.ico +0 -0
- data/demo/test/application_system_test_case.rb +0 -8
- data/demo/test/controllers/bootstrap_controller_test.rb +0 -8
- data/demo/test/controllers/users_controller_test.rb +0 -13
- data/demo/test/fixtures/action_text/rich_texts.yml +0 -4
- data/demo/test/fixtures/users.yml +0 -2
- data/demo/test/system/bootstrap_test.rb +0 -84
- data/demo/test/test_helper.rb +0 -10
- data/demo/webpack.config.js +0 -20
- data/demo/yarn.lock +0 -7176
- data/gemfiles/5.2.gemfile +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bea3ab95f979a7fc02d2c2a5dff3bae3ca536c6e277a86d11361c3e3bd72e59
|
4
|
+
data.tar.gz: 80fa55a6cbcd89ae0b52ebc8135d8b9f38b25b321bdbe492983db46c866c1e7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97b0ddfb9afcfb847b27ea4853c4f3b99bb0c72a0366d4d1a0a3fac217f0693090c96ea03c51e3a07e66cfe3c8c4576be8618eb3b48401c6d6f326e35619fa7
|
7
|
+
data.tar.gz: 3d79f681187a5fa0cab604ced1919229cdbdd101cc8f91c4261a115b82fa5589c3037b8b0c6d6208ce17affe964397a8fc33a9483a82a5c74efd22c9224eb582
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,13 +7,15 @@ on:
|
|
7
7
|
jobs:
|
8
8
|
Lint:
|
9
9
|
runs-on: ubuntu-latest
|
10
|
+
env:
|
11
|
+
BUNDLE_GEMFILE: gemfiles/6.0.gemfile
|
10
12
|
steps:
|
11
|
-
- uses: actions/checkout@
|
13
|
+
- uses: actions/checkout@v3
|
12
14
|
with:
|
13
15
|
fetch-depth: 0
|
14
16
|
- uses: ruby/setup-ruby@v1
|
15
17
|
with:
|
16
|
-
ruby-version:
|
18
|
+
ruby-version: 3.0.6
|
17
19
|
bundler-cache: true
|
18
20
|
# Disabled since it requires access not granted by GitHub Actions for PRs
|
19
21
|
# - name: Danger
|
@@ -23,22 +25,21 @@ jobs:
|
|
23
25
|
# run: |
|
24
26
|
# bundle exec danger
|
25
27
|
- name: Rubocop
|
26
|
-
run: bundle exec rubocop --
|
28
|
+
run: bundle exec rubocop --autocorrect
|
27
29
|
Test:
|
28
30
|
runs-on: ubuntu-latest
|
29
31
|
strategy:
|
30
32
|
fail-fast: false
|
31
33
|
matrix:
|
32
|
-
ruby-version: [ '3.
|
33
|
-
gemfile: [ '7.0', '6.1', '6.0', '
|
34
|
+
ruby-version: [ '3.2', '3.1', '3.0' ]
|
35
|
+
gemfile: [ '7.0', '6.1', '6.0', 'edge' ]
|
34
36
|
exclude:
|
37
|
+
- { ruby-version: '3.2', gemfile: "6.0" }
|
35
38
|
- { ruby-version: '3.1', gemfile: "6.0" }
|
36
|
-
- { ruby-version: '3.1', gemfile: "5.2" }
|
37
|
-
- { ruby-version: '3.0', gemfile: "5.2" }
|
38
39
|
env:
|
39
40
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
40
41
|
steps:
|
41
|
-
- uses: actions/checkout@
|
42
|
+
- uses: actions/checkout@v3
|
42
43
|
- name: Set up Ruby
|
43
44
|
uses: ruby/setup-ruby@v1
|
44
45
|
with:
|
@@ -46,3 +47,15 @@ jobs:
|
|
46
47
|
bundler-cache: true
|
47
48
|
- name: Run tests
|
48
49
|
run: bundle exec rake test
|
50
|
+
Demo:
|
51
|
+
runs-on: ubuntu-latest
|
52
|
+
steps:
|
53
|
+
- uses: actions/checkout@v3
|
54
|
+
- name: Set up Ruby
|
55
|
+
uses: ruby/setup-ruby@v1
|
56
|
+
with:
|
57
|
+
working-directory: demo
|
58
|
+
bundler-cache: true
|
59
|
+
- name: Run tests
|
60
|
+
working-directory: demo
|
61
|
+
run: bundle exec rake test:all
|
data/.gitignore
CHANGED
@@ -16,7 +16,9 @@ gemfiles/*.lock
|
|
16
16
|
/.ruby-version
|
17
17
|
Vagrantfile
|
18
18
|
.vagrant
|
19
|
-
|
19
|
+
**/.yarn/**/cache
|
20
|
+
**/.yarn/install-state.gz
|
21
|
+
**/.yarn/unplugged
|
20
22
|
|
21
23
|
# For the demo app.
|
22
24
|
|
@@ -25,7 +27,7 @@ demo/storage/*
|
|
25
27
|
!demo/storage/.keep
|
26
28
|
|
27
29
|
demo/public/assets
|
28
|
-
|
30
|
+
**/.byebug_history
|
29
31
|
|
30
32
|
# Ignore master key for decrypting credentials and more.
|
31
33
|
demo/config/master.key
|
data/.rubocop.yml
CHANGED
data/.yarnrc
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
|
3
|
+
You can find recent releases with docs in GitHub:
|
4
4
|
|
5
|
-
|
5
|
+
https://github.com/bootstrap-ruby/bootstrap_form/releases
|
6
6
|
|
7
|
+
## Diffs
|
7
8
|
|
8
|
-
- [Pending Release](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.
|
9
|
+
- [Pending Release](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.0...HEAD)
|
10
|
+
- [5.2.1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.0...v5.2.1)
|
11
|
+
[Issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-05-20T23%3A59..2023-05-23T10%3A00)
|
12
|
+
- [5.2.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.1.0...v5.2.0)
|
13
|
+
[Issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2022-06-25T17%3A22..2023-05-20T23%3A59)
|
9
14
|
- [5.1.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...v5.1.0)
|
15
|
+
[Issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2021-11-12T05%3A58..2022-06-25T17%3A22)
|
10
16
|
- [5.0.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0)
|
11
17
|
- [4.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0)
|
12
18
|
- [4.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0)
|
@@ -23,6 +29,10 @@ The tooling to support our old way of doing the change log doesn't work anymore,
|
|
23
29
|
- [2.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.4.0...v2.5.0)
|
24
30
|
- [2.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.3.0...v2.4.0)
|
25
31
|
|
32
|
+
## Older releases
|
33
|
+
|
34
|
+
The tooling to support our old way of doing the change log doesn't work anymore, and we don't have a better solution, so this change log has become unreliable since version 4.5.0. Please refer to the commit history if you need to debug changes.
|
35
|
+
|
26
36
|
## [Pending Release][]
|
27
37
|
|
28
38
|
### Breaking changes
|
data/CONTRIBUTING.md
CHANGED
@@ -46,11 +46,11 @@ You may find the [demo application](#the-demo-application) useful for developmen
|
|
46
46
|
|
47
47
|
### 6. Make a pull request
|
48
48
|
|
49
|
-
- If you've never made a pull request (PR) before, read this
|
49
|
+
- If you've never made a pull request (PR) before, read [this](https://help.github.com/articles/about-pull-requests/).
|
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 Travis CI ran all the tests successfully, and didn't raise any issues.
|
52
52
|
|
53
|
-
### 7. Done
|
53
|
+
### 7. Done
|
54
54
|
|
55
55
|
Somebody will shortly review your pull request and if everything is good, it will be
|
56
56
|
merged into the main branch. Eventually the gem will be published with your changes.
|
@@ -74,6 +74,59 @@ The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/mainte
|
|
74
74
|
|
75
75
|
### Developing with Docker
|
76
76
|
|
77
|
+
This repository offers experimental support support for a couple of ways to develop using Docker, if you're interested:
|
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_ requied 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
|
+
|
77
130
|
This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
|
78
131
|
|
79
132
|
```bash
|
@@ -85,7 +138,7 @@ This builds an image called `bootstrap_form`. You can change that to any tag you
|
|
85
138
|
If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
|
86
139
|
|
87
140
|
```bash
|
88
|
-
docker build --build-arg "RUBY_VERSION=
|
141
|
+
docker build --build-arg "RUBY_VERSION=3.0" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
|
89
142
|
```
|
90
143
|
|
91
144
|
Then run the container you built with the shell, and create the bundle:
|
@@ -99,6 +152,12 @@ You can run tests in the container as normal, with `rake test`.
|
|
99
152
|
|
100
153
|
(Some of that command line is need for Linux hosts, to run the container as the current user.)
|
101
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.
|
156
|
+
|
157
|
+
#### Troubleshooting Docker
|
158
|
+
|
159
|
+
- 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.
|
160
|
+
|
102
161
|
### The Demo Application
|
103
162
|
|
104
163
|
There is a demo app in this repository. It shows some of the features of `bootstrap_form`, and provides a base on which to build ad-hoc testing, if you need it.
|
@@ -110,8 +169,7 @@ To run the demo app, set up the database and run the server:
|
|
110
169
|
cd demo
|
111
170
|
bundle
|
112
171
|
rails db:setup
|
113
|
-
|
114
|
-
rails s -b 0.0.0.0
|
172
|
+
dev
|
115
173
|
```
|
116
174
|
|
117
175
|
To run the demo app in the Docker container:
|
@@ -119,21 +177,32 @@ To run the demo app in the Docker container:
|
|
119
177
|
```bash
|
120
178
|
docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -p 3000:3000 -it bootstrap_form /bin/bash
|
121
179
|
cd demo
|
122
|
-
|
180
|
+
bundle
|
123
181
|
rails db:setup
|
124
|
-
|
125
|
-
rails s -b 0.0.0.0
|
182
|
+
dev
|
126
183
|
```
|
127
184
|
|
128
|
-
|
185
|
+
You'll see errors in the browser console about duplicate ids. This is expected, since the demo app has many forms with the same fields in them. Something we can fix in the future, perhaps.
|
129
186
|
|
130
|
-
|
131
|
-
|
187
|
+
To use other supported versions of Rails, you will need to create a `Gemfile` for the Rails version. Then, change the `export BUNDLE_GEMFILE...` line to your gem file. Finally, figure out how to include the assets.
|
188
|
+
|
189
|
+
If you need to run the Rails server separately, for example, to debug the server, you _must_ run it like this:
|
190
|
+
|
191
|
+
```sh
|
192
|
+
bundle exec rails s -b 0.0.0.0
|
132
193
|
```
|
133
194
|
|
134
|
-
|
195
|
+
If you run just `rails` or even `bin/rails`, the `sprockets-rails` gem won't load and you'll either get error messages, or the assets won't be available to the demo app. At the moment it's a mystery why. PRs to fix this are welcome.
|
135
196
|
|
136
|
-
|
197
|
+
Please try to keep the checked-in `.ruby-version` set to the oldest supported version of Ruby. You're welcome and encouraged to try the demo app with other Ruby versions. Just don't check in the `.ruby-version` to GitHub.
|
198
|
+
|
199
|
+
For the record, the demo app is set up as if the Rails app had been created with:
|
200
|
+
|
201
|
+
```sh
|
202
|
+
rails new --skip-hotwire -d sqlite --edge -j esbuild -c bootstrap .
|
203
|
+
```
|
204
|
+
|
205
|
+
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.
|
137
206
|
|
138
207
|
## Documentation Contributions
|
139
208
|
|
@@ -147,7 +216,7 @@ We are an entirely volunteer project. Sometimes it's hard for people to find the
|
|
147
216
|
|
148
217
|
---
|
149
218
|
|
150
|
-
Thanks to all the great contributors
|
219
|
+
Thanks to all the [great contributors](https://github.com/bootstrap-ruby/bootstrap_form/graphs/contributors) over the years.
|
151
220
|
|
152
221
|
## Troubleshooting
|
153
222
|
|
@@ -162,3 +231,21 @@ cd demo
|
|
162
231
|
rails db:setup # create the databases from `schema.rb`
|
163
232
|
rails db:migrate # add the new tables and create a new `schema.rb`
|
164
233
|
```
|
234
|
+
|
235
|
+
### RuboCop
|
236
|
+
|
237
|
+
When you push a branch, RuboCop checks may fail, but locally you can't reproduce the failure. This may be because you're using a different version of RuboCop locally. When you push, the RuboCop tests use the currently available version of RuboCop. If you've been working on the branch for a while, it's likely you have a `Gemfile.lock` that specifies an older version of RuboCop.
|
238
|
+
|
239
|
+
The first thing to try is to update your `Gemfile.lock` locally:
|
240
|
+
|
241
|
+
```bash
|
242
|
+
bundle update
|
243
|
+
```
|
244
|
+
|
245
|
+
Or, if you really want to minimize your work:
|
246
|
+
|
247
|
+
```bash
|
248
|
+
bundle update --conservative rubocop
|
249
|
+
```
|
250
|
+
|
251
|
+
This should enable you to reproduce the RuboCop failures locally, and then you can fix them.
|
data/Dangerfile
CHANGED
@@ -19,8 +19,8 @@ has_changelog_changes = git.modified_files.include?("CHANGELOG.md")
|
|
19
19
|
# You've made changes to lib, but didn't write any tests?
|
20
20
|
# ------------------------------------------------------------------------------
|
21
21
|
if has_lib_changes && !has_test_changes
|
22
|
-
warn("There are code changes, but no corresponding tests. "\
|
23
|
-
"Please include tests if this PR introduces any modifications in "\
|
22
|
+
warn("There are code changes, but no corresponding tests. " \
|
23
|
+
"Please include tests if this PR introduces any modifications in " \
|
24
24
|
"#{project_name}'s behavior.",
|
25
25
|
sticky: false)
|
26
26
|
end
|
@@ -36,8 +36,8 @@ if !has_changelog_changes && has_lib_changes
|
|
36
36
|
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
|
37
37
|
```
|
38
38
|
MARKDOWN
|
39
|
-
warn("Please update CHANGELOG.md with a description of your changes. "\
|
40
|
-
"If this PR is not a user-facing change (e.g. just refactoring), "\
|
39
|
+
warn("Please update CHANGELOG.md with a description of your changes. " \
|
40
|
+
"If this PR is not a user-facing change (e.g. just refactoring), " \
|
41
41
|
"you can disregard this.", sticky: false)
|
42
42
|
end
|
43
43
|
|
data/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
ARG RUBY_VERSION=
|
1
|
+
ARG RUBY_VERSION=3.0
|
2
2
|
ARG DISTRO=bullseye
|
3
3
|
|
4
4
|
FROM ruby:$RUBY_VERSION-$DISTRO
|
@@ -13,9 +13,9 @@ ENV PATH ./bin:$GEM_HOME/bin:$PATH
|
|
13
13
|
RUN (echo 'docker'; echo 'docker') | passwd root
|
14
14
|
|
15
15
|
# Yarn installs nodejs.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# Rails wants a newer version of node that we get with the Debian distro.
|
17
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs
|
18
|
+
RUN corepack enable && corepack prepare yarn@stable --activate
|
19
|
+
RUN apt install -y -q yarn sqlite3
|
20
20
|
|
21
21
|
EXPOSE 3000
|
data/Gemfile
CHANGED
@@ -1,23 +1,7 @@
|
|
1
|
-
|
1
|
+
gems = "#{__dir__}/gemfiles/common.gemfile"
|
2
|
+
eval File.read(gems), binding, gems # rubocop: disable Security/Eval
|
2
3
|
|
3
|
-
|
4
|
+
require "#{__dir__}/lib/bootstrap_form/version"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
group :development do
|
8
|
-
gem "htmlbeautifier"
|
9
|
-
gem "rubocop-performance", require: false
|
10
|
-
gem "rubocop-rails", require: false
|
11
|
-
gem "webpacker"
|
12
|
-
end
|
13
|
-
|
14
|
-
group :test do
|
15
|
-
gem "diffy"
|
16
|
-
gem "equivalent-xml"
|
17
|
-
gem "mocha"
|
18
|
-
gem "sqlite3"
|
19
|
-
end
|
20
|
-
|
21
|
-
group :ci do
|
22
|
-
gem "danger"
|
23
|
-
end
|
6
|
+
gem "rails", BootstrapForm::REQUIRED_RAILS_VERSION
|
7
|
+
gem "sprockets-rails", require: "sprockets/railtie"
|