bootstrap_form 5.0.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +31 -16
  3. data/.gitignore +15 -3
  4. data/.rubocop.yml +3 -1
  5. data/.yarnrc +5 -0
  6. data/CHANGELOG.md +53 -2
  7. data/CONTRIBUTING.md +110 -22
  8. data/Dangerfile +5 -5
  9. data/Dockerfile +6 -11
  10. data/Gemfile +5 -23
  11. data/README.md +805 -54
  12. data/RELEASING.md +16 -10
  13. data/Rakefile +7 -6
  14. data/bootstrap_form.gemspec +7 -10
  15. data/docker-compose.yml +9 -48
  16. data/gemfiles/6.0.gemfile +1 -1
  17. data/gemfiles/6.1.gemfile +1 -1
  18. data/gemfiles/7.0.gemfile +5 -0
  19. data/gemfiles/common.gemfile +28 -0
  20. data/gemfiles/edge.gemfile +3 -2
  21. data/lib/bootstrap_form/components/hints.rb +13 -4
  22. data/lib/bootstrap_form/components/labels.rb +4 -10
  23. data/lib/bootstrap_form/components/validation.rb +36 -19
  24. data/lib/bootstrap_form/form_builder.rb +9 -6
  25. data/lib/bootstrap_form/form_group.rb +15 -8
  26. data/lib/bootstrap_form/form_group_builder.rb +10 -7
  27. data/lib/bootstrap_form/helpers/bootstrap.rb +12 -9
  28. data/lib/bootstrap_form/helpers/field.rb +26 -0
  29. data/lib/bootstrap_form/helpers.rb +1 -0
  30. data/lib/bootstrap_form/inputs/check_box.rb +26 -8
  31. data/lib/bootstrap_form/inputs/collection_check_boxes.rb +5 -1
  32. data/lib/bootstrap_form/inputs/collection_select.rb +1 -1
  33. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +1 -1
  34. data/lib/bootstrap_form/inputs/radio_button.rb +15 -10
  35. data/lib/bootstrap_form/version.rb +2 -1
  36. data/lib/bootstrap_form.rb +1 -1
  37. metadata +17 -88
  38. data/demo/.postcssrc.yml +0 -3
  39. data/demo/README.md +0 -17
  40. data/demo/Rakefile +0 -6
  41. data/demo/app/assets/config/manifest.js +0 -1
  42. data/demo/app/assets/stylesheets/actiontext.scss +0 -38
  43. data/demo/app/assets/stylesheets/application.scss +0 -1
  44. data/demo/app/controllers/application_controller.rb +0 -2
  45. data/demo/app/controllers/bootstrap_controller.rb +0 -14
  46. data/demo/app/helpers/bootstrap_helper.rb +0 -27
  47. data/demo/app/javascript/channels/consumer.js +0 -6
  48. data/demo/app/javascript/channels/index.js +0 -5
  49. data/demo/app/javascript/packs/application.js +0 -11
  50. data/demo/app/models/address.rb +0 -3
  51. data/demo/app/models/application_record.rb +0 -3
  52. data/demo/app/models/faux_user.rb +0 -9
  53. data/demo/app/models/super_user.rb +0 -2
  54. data/demo/app/models/user.rb +0 -11
  55. data/demo/app/views/active_storage/blobs/_blob.html.erb +0 -14
  56. data/demo/app/views/bootstrap/form.html.erb +0 -67
  57. data/demo/app/views/layouts/application.html.erb +0 -68
  58. data/demo/bin/bundle +0 -3
  59. data/demo/bin/rails +0 -4
  60. data/demo/bin/rake +0 -4
  61. data/demo/bin/setup +0 -36
  62. data/demo/bin/update +0 -31
  63. data/demo/bin/webpack +0 -15
  64. data/demo/bin/webpack-dev-server +0 -15
  65. data/demo/bin/yarn +0 -11
  66. data/demo/config/application.rb +0 -21
  67. data/demo/config/boot.rb +0 -5
  68. data/demo/config/database.yml +0 -21
  69. data/demo/config/environment.rb +0 -5
  70. data/demo/config/environments/development.rb +0 -60
  71. data/demo/config/environments/production.rb +0 -48
  72. data/demo/config/environments/test.rb +0 -46
  73. data/demo/config/initializers/application_controller_renderer.rb +0 -8
  74. data/demo/config/initializers/assets.rb +0 -14
  75. data/demo/config/initializers/backtrace_silencers.rb +0 -7
  76. data/demo/config/initializers/cookies_serializer.rb +0 -5
  77. data/demo/config/initializers/filter_parameter_logging.rb +0 -4
  78. data/demo/config/initializers/inflections.rb +0 -16
  79. data/demo/config/initializers/mime_types.rb +0 -4
  80. data/demo/config/initializers/wrap_parameters.rb +0 -14
  81. data/demo/config/locales/en.yml +0 -33
  82. data/demo/config/puma.rb +0 -56
  83. data/demo/config/routes.rb +0 -5
  84. data/demo/config/spring.rb +0 -6
  85. data/demo/config/storage.yml +0 -35
  86. data/demo/config/webpack/development.js +0 -5
  87. data/demo/config/webpack/environment.js +0 -3
  88. data/demo/config/webpack/production.js +0 -5
  89. data/demo/config/webpack/test.js +0 -5
  90. data/demo/config/webpacker.yml +0 -92
  91. data/demo/config.ru +0 -5
  92. data/demo/db/schema.rb +0 -69
  93. data/demo/log/.keep +0 -0
  94. data/demo/package.json +0 -17
  95. data/demo/public/favicon.ico +0 -0
  96. data/demo/test/fixtures/action_text/rich_texts.yml +0 -4
  97. data/demo/yarn.lock +0 -6257
  98. data/gemfiles/5.2.gemfile +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a510f995829dd7bbdfa67fa4eeaa73b8cb8a10a73a2d46c89aad425709caf7c2
4
- data.tar.gz: 33543b5b3a9dd167ef7896e0ad55c7d86d31a54e4c19072d13e09b332bb5a872
3
+ metadata.gz: 3d296af534429e0065b8f5aef6254dd12455e6317fd36f684b060b3c425c03e8
4
+ data.tar.gz: aa02bc3031975302dbe4d556a1fcaa6751e2b4cbb961e737fa23b80516904ea2
5
5
  SHA512:
6
- metadata.gz: 4a703b03f34bb7208380b3370aab0b6444526fb4a33303f473c5b1a78c4c55639701d499c4013d437f79a240554c9da703a1698fc32fe5d91f73f69b919d080c
7
- data.tar.gz: 77362e8c4c482ad19a81d63b8c4b55fe213b42e28e44dc66cd716da7106afc2e7509e43428ec135a00f652ed6112cd6fcee4af8bb2e271bb77d3cc187e441045
6
+ metadata.gz: 0a402ef41606092aa37ec284382f754aea85d73dfc16b8b065ea130c6d47910d061afac644a0b0d38f1269f0c53caa2f987c8b5d4ce9dfa6105811919a40bc8f
7
+ data.tar.gz: 546e5dbb15379578c5f06a4d6d40a362bd08d9dc4049cd4a7140cc7b29f459bfc8f914d8e114125d398be8b323102d4912653d589e008441eb288dda71fb0ebd
@@ -2,41 +2,44 @@ name: Ruby
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ main ]
6
5
  pull_request:
7
- branches: [ main ]
8
6
 
9
7
  jobs:
10
8
  Lint:
11
9
  runs-on: ubuntu-latest
10
+ env:
11
+ BUNDLE_GEMFILE: gemfiles/6.0.gemfile
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ fetch-depth: 0
14
16
  - uses: ruby/setup-ruby@v1
15
17
  with:
16
- ruby-version: 2.7.2
18
+ ruby-version: 3.0.6
17
19
  bundler-cache: true
18
- - name: Danger
19
- if: ${{ github.event_name == 'pull_request' }}
20
- run: |
21
- gem install danger
22
- export DANGER_GITHUB_API_TOKEN=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
23
- danger
20
+ # Disabled since it requires access not granted by GitHub Actions for PRs
21
+ # - name: Danger
22
+ # if: ${{ github.event_name == 'pull_request' }}
23
+ # env:
24
+ # DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25
+ # run: |
26
+ # bundle exec danger
24
27
  - name: Rubocop
25
- run: bundle exec rubocop --auto-correct
28
+ run: bundle exec rubocop --autocorrect
26
29
  Test:
27
30
  runs-on: ubuntu-latest
28
31
  strategy:
29
32
  fail-fast: false
30
33
  matrix:
31
- ruby-version: [ '3.0', '2.7', '2.6' ]
32
- gemfile: [ '6.1', '6.0', '5.2', 'edge' ]
34
+ ruby-version: [ '3.2', '3.1', '3.0' ]
35
+ gemfile: [ '7.0', '6.1', '6.0', 'edge' ]
33
36
  exclude:
34
- - { ruby-version: '3.0', gemfile: "5.2" }
35
- - { ruby-version: '2.6', gemfile: "edge" }
37
+ - { ruby-version: '3.2', gemfile: "6.0" }
38
+ - { ruby-version: '3.1', gemfile: "6.0" }
36
39
  env:
37
40
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
38
41
  steps:
39
- - uses: actions/checkout@v2
42
+ - uses: actions/checkout@v3
40
43
  - name: Set up Ruby
41
44
  uses: ruby/setup-ruby@v1
42
45
  with:
@@ -44,3 +47,15 @@ jobs:
44
47
  bundler-cache: true
45
48
  - name: Run tests
46
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
@@ -3,16 +3,22 @@
3
3
  log/*.log
4
4
  pkg/
5
5
  demo/db/*.sqlite3
6
+ demo/doc/screenshots/**/*.committed.png
7
+ demo/doc/screenshots/**/*.latest.png
6
8
  demo/log/*.log
7
9
  demo/tmp/
8
10
  *.gem
9
11
  .rbenv-gemsets
10
12
  *.swp
11
- Gemfile.lock
13
+ /Gemfile.lock
12
14
  test/gemfiles/*.lock
13
- .ruby-version
15
+ gemfiles/*.lock
16
+ /.ruby-version
14
17
  Vagrantfile
15
18
  .vagrant
19
+ **/.yarn/**/cache
20
+ **/.yarn/install-state.gz
21
+ **/.yarn/unplugged
16
22
 
17
23
  # For the demo app.
18
24
 
@@ -21,16 +27,19 @@ demo/storage/*
21
27
  !demo/storage/.keep
22
28
 
23
29
  demo/public/assets
24
- .byebug_history
30
+ **/.byebug_history
25
31
 
26
32
  # Ignore master key for decrypting credentials and more.
27
33
  demo/config/master.key
28
34
  demo/public/packs
29
35
  demo/public/packs-test
36
+ demo/app/assets/builds/*
37
+ !demo/app/assets/builds/.keep
30
38
  demo/node_modules
31
39
  demo/yarn-error.log
32
40
  demo/yarn-debug.log*
33
41
  demo/.yarn-integrity
42
+ demo/vendor/bundle
34
43
 
35
44
  # For stuff that gets created if using the Dockerfile image
36
45
  .bundle/
@@ -45,3 +54,6 @@ vendor/bundle
45
54
  .bash_history
46
55
  # For Alpine images
47
56
  .ash_history
57
+ .sqlite_history
58
+
59
+ docker-compose.override.yml
data/.rubocop.yml CHANGED
@@ -5,7 +5,8 @@ require:
5
5
  AllCops:
6
6
  DisplayCopNames: true
7
7
  DisplayStyleGuide: true
8
- TargetRubyVersion: 2.5
8
+ TargetRubyVersion: 3.0
9
+ TargetRailsVersion: 6.0
9
10
  NewCops: enable
10
11
  Exclude:
11
12
  - bin/*
@@ -37,6 +38,7 @@ Layout/SpaceAroundEqualsInParameterDefault:
37
38
  EnforcedStyle: no_space
38
39
 
39
40
  Metrics/AbcSize:
41
+ Max: 18
40
42
  Exclude:
41
43
  - "demo/test/**/*"
42
44
  - "test/**/*"
data/.yarnrc ADDED
@@ -0,0 +1,5 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ lastUpdateCheck 1681870014941
data/CHANGELOG.md CHANGED
@@ -1,17 +1,67 @@
1
+ # Change Log
2
+
3
+ You can find recent releases with docs in GitHub:
4
+
5
+ https://github.com/bootstrap-ruby/bootstrap_form/releases
6
+
7
+ ## Diffs
8
+
9
+ - [Pending Release](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.0...HEAD)
10
+ - [5.2.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.1.0...v5.2.0)
11
+ [Issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2022-06-25T17%3A22..2023-05-20T23%3A59)
12
+ - [5.1.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...v5.1.0)
13
+ [Issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2021-11-12T05%3A58..2022-06-25T17%3A22)
14
+ - [5.0.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0)
15
+ - [4.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0)
16
+ - [4.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0)
17
+ - [4.3.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...v4.3.0)
18
+ - [4.2.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.1.0...v4.2.0)
19
+ - [4.1.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0...v4.1.0)
20
+ - [4.0.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0.alpha1...v4.0.0)
21
+ - [4.0.0.alpha1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.7.0...v4.0.0.alpha1)
22
+ - [2.7.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.6.0...v2.7.0)
23
+ - [2.6.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.3...v2.6.0)
24
+ - [2.5.3](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.2...v2.5.3)
25
+ - [2.5.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.1...v2.5.2)
26
+ - [2.5.1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.0...v2.5.1)
27
+ - [2.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.4.0...v2.5.0)
28
+ - [2.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.3.0...v2.4.0)
29
+
30
+ ## Older releases
31
+
32
+ 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.
33
+
1
34
  ## [Pending Release][]
2
35
 
3
36
  ### Breaking changes
4
37
 
38
+ * [#618](https://github.com/bootstrap-ruby/bootstrap_form/pull/618): Allow overriding the wrapper class - [@donv](https://github.com/donv).
5
39
  * Your contribution here!
6
40
 
7
41
  ### New features
8
42
 
9
- * Your contribution here!
43
+ * [#572](https://github.com/bootstrap-ruby/bootstrap_form/issues/572): Simplify the formatting of the file upload control to follow the new Bootstrap 5 styles
44
+ * [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
10
45
 
46
+ * [#215](https://github.com/bootstrap-ruby/bootstrap_form/issues/215): Add `include_hidden` option to `check_box`
11
47
  ### Bugfixes
12
48
 
49
+ * [#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.
50
+
51
+ ## [5.0.0.alpha1][]
52
+
53
+ ### Breaking changes
54
+
55
+ * [#569] Remove `role="form"` from the default generated form HTML so forms pass W3C validation. (Only a breaking change if you depended on the `form` attribute. `bootstrap_form` doesn't depend on it.)
56
+
57
+ ### New features
58
+
13
59
  * Your contribution here!
14
60
 
61
+ ### Bugfixes
62
+
63
+ * [#284] [#300] Field's help message is displayed, even while inline error message is displayed. - [@antpaw](https://github.com/antpaw)
64
+
15
65
  ## [5.0.0][] (2021-11-11)
16
66
 
17
67
  ### Breaking changes
@@ -322,7 +372,8 @@ Features:
322
372
  - Added support for bootstrap_form_tag (@baldwindavid)
323
373
 
324
374
 
325
- [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...HEAD
375
+ [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.1.0...HEAD
376
+ [5.1.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...v5.1.0
326
377
  [5.0.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0
327
378
  [4.5.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0
328
379
  [4.4.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0
data/CONTRIBUTING.md CHANGED
@@ -10,11 +10,6 @@ There are a number of ways you can contribute to `bootstrap_form`:
10
10
  - Add to the documentation
11
11
  - Review pull requests
12
12
 
13
- *Note:* If you want to work on preparing `bootstrap_form` for Bootstrap 5,
14
- please start from the `bootstrap-5` branch.
15
- If you're submitting a pull request with code or documentation,
16
- target the pull request to the `bootstrap-5` branch.
17
-
18
13
  ## Code Contributions
19
14
 
20
15
  Here's a quick guide for code contributions:
@@ -47,20 +42,15 @@ Fork the project. Optionally, create a branch you want to work on.
47
42
  - Add a line to the CHANGELOG for your bug fix or feature.
48
43
  - Read the [Coding Guidelines](#coding-guidelines) section and make sure that `rake lint` doesn't find any offences.
49
44
 
50
- You may find the demo application useful for development and debugging.
51
-
52
- - `cd demo`
53
- - `rake db:schema:load`
54
- - `rails s`
55
- - Navigate to http://localhost:3000
45
+ You may find the [demo application](#the-demo-application) useful for development and debugging.
56
46
 
57
47
  ### 6. Make a pull request
58
48
 
59
- - If you've never made a pull request (PR) before, read this: https://help.github.com/articles/about-pull-requests/.
49
+ - If you've never made a pull request (PR) before, read [this](https://help.github.com/articles/about-pull-requests/).
60
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.
61
51
  - When the PR is submitted, check if Travis CI ran all the tests successfully, and didn't raise any issues.
62
52
 
63
- ### 7. Done!
53
+ ### 7. Done
64
54
 
65
55
  Somebody will shortly review your pull request and if everything is good, it will be
66
56
  merged into the main branch. Eventually the gem will be published with your changes.
@@ -84,6 +74,59 @@ The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/mainte
84
74
 
85
75
  ### Developing with Docker
86
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
+
87
130
  This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
88
131
 
89
132
  ```bash
@@ -95,7 +138,7 @@ This builds an image called `bootstrap_form`. You can change that to any tag you
95
138
  If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
96
139
 
97
140
  ```bash
98
- docker build --build-arg "RUBY_VERSION=2.7" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
141
+ docker build --build-arg "RUBY_VERSION=3.0" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
99
142
  ```
100
143
 
101
144
  Then run the container you built with the shell, and create the bundle:
@@ -109,17 +152,24 @@ You can run tests in the container as normal, with `rake test`.
109
152
 
110
153
  (Some of that command line is need for Linux hosts, to run the container as the current user.)
111
154
 
112
- ### The Demo App
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
+
161
+ ### The Demo Application
113
162
 
114
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.
115
164
 
165
+ Currently, the demo app is only set up to run for Rails 7, due to the variety of ways to include CSS and JavaScript in a modern Rails application.
116
166
  To run the demo app, set up the database and run the server:
117
167
 
118
168
  ```bash
119
169
  cd demo
120
- export BUNDLER_GEMFILE=../gemfiles/6.1.gemfile
170
+ bundle
121
171
  rails db:setup
122
- rails s -b 0.0.0.0
172
+ dev
123
173
  ```
124
174
 
125
175
  To run the demo app in the Docker container:
@@ -127,18 +177,38 @@ To run the demo app in the Docker container:
127
177
  ```bash
128
178
  docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -p 3000:3000 -it bootstrap_form /bin/bash
129
179
  cd demo
130
- export BUNDLER_GEMFILE=../gemfiles/6.1.gemfile
180
+ bundle
131
181
  rails db:setup
132
- rails s -b 0.0.0.0
182
+ dev
133
183
  ```
134
184
 
135
- To use other supported versions of Rails, change the `export BUNDLER_GEMFILE...` line to another gem file.
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.
186
+
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
193
+ ```
194
+
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.
196
+
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.
136
206
 
137
207
  ## Documentation Contributions
138
208
 
139
209
  Contributions to documentation are always welcome. Even fixing one typo improves the quality of `bootstrap_form`. To make a documentation contribution, follow steps 1-3 of Code Contributions, then make the documentation changes, then make the pull request (step 6 of Code Contributions).
140
210
 
141
- If you put `[ci skip]` in the commit message of the most recent commit of the PR, you'll be a good citizen by not causing Travis CI to run all the tests when it's not necessary.
211
+ If you put `[ci skip]` in the commit message of the most recent commit of the PR, you'll be a good citizen by not causing our CI pipeline to run all the tests when it's not necessary.
142
212
 
143
213
  ## Reviewing Pull Requests
144
214
 
@@ -146,7 +216,7 @@ We are an entirely volunteer project. Sometimes it's hard for people to find the
146
216
 
147
217
  ---
148
218
 
149
- Thanks to all the great contributors over the years: https://github.com/bootstrap-ruby/bootstrap_form/graphs/contributors
219
+ Thanks to all the [great contributors](https://github.com/bootstrap-ruby/bootstrap_form/graphs/contributors) over the years.
150
220
 
151
221
  ## Troubleshooting
152
222
 
@@ -161,3 +231,21 @@ cd demo
161
231
  rails db:setup # create the databases from `schema.rb`
162
232
  rails db:migrate # add the new tables and create a new `schema.rb`
163
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,15 +36,15 @@ 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
 
44
44
  # ------------------------------------------------------------------------------
45
45
  # Did you remove the CHANGELOG's "Your contribution here!" line?
46
46
  # ------------------------------------------------------------------------------
47
- if has_changelog_changes && IO.read("CHANGELOG.md").scan(/^\s*[-*] Your contribution here/i).count < 3
47
+ if has_changelog_changes && File.read("CHANGELOG.md").scan(/^\s*[-*] Your contribution here/i).count < 3
48
48
  raise(
49
49
  "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
50
50
  sticky: false
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- ARG DISTRO=buster
2
- ARG RUBY_VERSION=2.6
1
+ ARG RUBY_VERSION=3.0
2
+ ARG DISTRO=bullseye
3
3
 
4
4
  FROM ruby:$RUBY_VERSION-$DISTRO
5
5
 
@@ -13,14 +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
- RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
17
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
18
- apt update -y -q && \
19
- apt install -y -q yarn sqlite3
20
-
21
- # Ruby now comes with bundler, but we're not using the default version yet, because we were using
22
- # a newer version of bundler already. Ruby 3 comes with Bundler 2.2.3. Ruby 2.7 has Bundler 2.1.2,
23
- # which is still behind what we were using.
24
- RUN gem install bundler -v 2.1.4
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
25
20
 
26
21
  EXPOSE 3000
data/Gemfile CHANGED
@@ -1,25 +1,7 @@
1
- source "http://rubygems.org"
1
+ gems = "#{__dir__}/gemfiles/common.gemfile"
2
+ eval File.read(gems), binding, gems # rubocop: disable Security/Eval
2
3
 
3
- gemspec path: __dir__
4
+ require "#{__dir__}/lib/bootstrap_form/version"
4
5
 
5
- # Uncomment and change rails version for testing purposes
6
- # gem "rails", "~> 5.2.0"
7
- # gem "rails", "~> 6.0.0"
8
- # gem "rails", "~> 6.1.0"
9
- # gem "rails", git: "https://github.com/rails/rails.git"
10
-
11
- group :development do
12
- gem "chandler", ">= 0.7.0"
13
- gem "htmlbeautifier"
14
- gem "rubocop-performance", require: false
15
- gem "rubocop-rails", require: false
16
- gem "sassc-rails"
17
- gem "webpacker"
18
- end
19
-
20
- group :test do
21
- gem "diffy"
22
- gem "equivalent-xml"
23
- gem "mocha"
24
- gem "sqlite3"
25
- end
6
+ gem "rails", BootstrapForm::REQUIRED_RAILS_VERSION
7
+ gem "sprockets-rails", require: "sprockets/railtie"