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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -8
  3. data/.gitignore +4 -2
  4. data/.rubocop.yml +2 -1
  5. data/.yarnrc +5 -0
  6. data/CHANGELOG.md +13 -3
  7. data/CONTRIBUTING.md +101 -14
  8. data/Dangerfile +4 -4
  9. data/Dockerfile +5 -5
  10. data/Gemfile +5 -21
  11. data/README.md +108 -42
  12. data/RELEASING.md +12 -1
  13. data/Rakefile +7 -6
  14. data/bootstrap_form.gemspec +6 -8
  15. data/docker-compose.yml +6 -24
  16. data/gemfiles/6.0.gemfile +1 -1
  17. data/gemfiles/6.1.gemfile +1 -1
  18. data/gemfiles/7.0.gemfile +2 -3
  19. data/gemfiles/common.gemfile +28 -0
  20. data/gemfiles/edge.gemfile +3 -2
  21. data/lib/bootstrap_form/components/labels.rb +3 -9
  22. data/lib/bootstrap_form/components/validation.rb +36 -19
  23. data/lib/bootstrap_form/form_builder.rb +4 -1
  24. data/lib/bootstrap_form/form_group.rb +9 -6
  25. data/lib/bootstrap_form/form_group_builder.rb +10 -7
  26. data/lib/bootstrap_form/helpers/bootstrap.rb +7 -8
  27. data/lib/bootstrap_form/helpers/field.rb +26 -0
  28. data/lib/bootstrap_form/helpers.rb +1 -0
  29. data/lib/bootstrap_form/inputs/base.rb +2 -2
  30. data/lib/bootstrap_form/inputs/check_box.rb +22 -6
  31. data/lib/bootstrap_form/inputs/radio_button.rb +3 -3
  32. data/lib/bootstrap_form/inputs/range_field.rb +1 -1
  33. data/lib/bootstrap_form/inputs.rb +1 -1
  34. data/lib/bootstrap_form/version.rb +2 -1
  35. data/lib/bootstrap_form.rb +1 -1
  36. metadata +14 -146
  37. data/demo/.postcssrc.yml +0 -3
  38. data/demo/.ruby-version +0 -1
  39. data/demo/Gemfile +0 -80
  40. data/demo/Gemfile.lock +0 -261
  41. data/demo/Procfile.dev +0 -2
  42. data/demo/README.md +0 -17
  43. data/demo/Rakefile +0 -6
  44. data/demo/app/assets/builds/.keep +0 -0
  45. data/demo/app/assets/builds/application.js.LICENSE.txt +0 -9
  46. data/demo/app/assets/config/manifest.js +0 -2
  47. data/demo/app/assets/stylesheets/actiontext.css +0 -31
  48. data/demo/app/assets/stylesheets/actiontext.scss +0 -38
  49. data/demo/app/assets/stylesheets/application.scss +0 -1
  50. data/demo/app/controllers/application_controller.rb +0 -2
  51. data/demo/app/controllers/bootstrap_controller.rb +0 -29
  52. data/demo/app/controllers/users_controller.rb +0 -9
  53. data/demo/app/helpers/bootstrap_helper.rb +0 -27
  54. data/demo/app/javascript/application.js +0 -3
  55. data/demo/app/javascript/channels/consumer.js +0 -6
  56. data/demo/app/javascript/channels/index.js +0 -5
  57. data/demo/app/javascript/packs/application.js +0 -11
  58. data/demo/app/models/address.rb +0 -3
  59. data/demo/app/models/application_record.rb +0 -3
  60. data/demo/app/models/faux_user.rb +0 -9
  61. data/demo/app/models/skill.rb +0 -15
  62. data/demo/app/models/super_user.rb +0 -2
  63. data/demo/app/models/user.rb +0 -25
  64. data/demo/app/views/active_storage/blobs/_blob.html.erb +0 -14
  65. data/demo/app/views/bootstrap/form.html.erb +0 -67
  66. data/demo/app/views/layouts/action_text/contents/_content.html.erb +0 -3
  67. data/demo/app/views/layouts/application.html.erb +0 -76
  68. data/demo/bin/bundle +0 -3
  69. data/demo/bin/dev +0 -9
  70. data/demo/bin/rails +0 -4
  71. data/demo/bin/rake +0 -4
  72. data/demo/bin/setup +0 -36
  73. data/demo/bin/update +0 -31
  74. data/demo/bin/webpack +0 -15
  75. data/demo/bin/webpack-dev-server +0 -15
  76. data/demo/bin/yarn +0 -11
  77. data/demo/config/application.rb +0 -21
  78. data/demo/config/boot.rb +0 -5
  79. data/demo/config/database.yml +0 -21
  80. data/demo/config/environment.rb +0 -5
  81. data/demo/config/environments/development.rb +0 -60
  82. data/demo/config/environments/production.rb +0 -48
  83. data/demo/config/environments/test.rb +0 -46
  84. data/demo/config/initializers/application_controller_renderer.rb +0 -8
  85. data/demo/config/initializers/backtrace_silencers.rb +0 -7
  86. data/demo/config/initializers/cookies_serializer.rb +0 -5
  87. data/demo/config/initializers/filter_parameter_logging.rb +0 -4
  88. data/demo/config/initializers/inflections.rb +0 -16
  89. data/demo/config/initializers/mime_types.rb +0 -4
  90. data/demo/config/initializers/wrap_parameters.rb +0 -14
  91. data/demo/config/locales/en.yml +0 -33
  92. data/demo/config/puma.rb +0 -56
  93. data/demo/config/routes.rb +0 -6
  94. data/demo/config/spring.rb +0 -6
  95. data/demo/config/storage.yml +0 -35
  96. data/demo/config/webpack/development.js +0 -5
  97. data/demo/config/webpack/environment.js +0 -3
  98. data/demo/config/webpack/production.js +0 -5
  99. data/demo/config/webpack/test.js +0 -5
  100. data/demo/config/webpacker.yml +0 -92
  101. data/demo/config.ru +0 -5
  102. data/demo/db/schema.rb +0 -84
  103. data/demo/doc/screenshots/bootstrap/index/00_horizontal_form.png +0 -0
  104. data/demo/doc/screenshots/bootstrap/index/01_with_validation_error.png +0 -0
  105. data/demo/doc/screenshots/bootstrap/index/02_inline_form.png +0 -0
  106. data/demo/doc/screenshots/bootstrap/index/03_simple_action_text_example.png +0 -0
  107. data/demo/doc/screenshots/bootstrap/index/04_floating_labels.png +0 -0
  108. data/demo/doc/screenshots/bootstrap/readme/00_example.png +0 -0
  109. data/demo/doc/screenshots/bootstrap/readme/01_example.png +0 -0
  110. data/demo/doc/screenshots/bootstrap/readme/02_example.png +0 -0
  111. data/demo/doc/screenshots/bootstrap/readme/03_example.png +0 -0
  112. data/demo/doc/screenshots/bootstrap/readme/04_example.png +0 -0
  113. data/demo/doc/screenshots/bootstrap/readme/05_example.png +0 -0
  114. data/demo/doc/screenshots/bootstrap/readme/06_example.png +0 -0
  115. data/demo/doc/screenshots/bootstrap/readme/07_example.png +0 -0
  116. data/demo/doc/screenshots/bootstrap/readme/08_example.png +0 -0
  117. data/demo/doc/screenshots/bootstrap/readme/09_example.png +0 -0
  118. data/demo/doc/screenshots/bootstrap/readme/10_example.png +0 -0
  119. data/demo/doc/screenshots/bootstrap/readme/11_example.png +0 -0
  120. data/demo/doc/screenshots/bootstrap/readme/12_example.png +0 -0
  121. data/demo/doc/screenshots/bootstrap/readme/13_example.png +0 -0
  122. data/demo/doc/screenshots/bootstrap/readme/14_example.png +0 -0
  123. data/demo/doc/screenshots/bootstrap/readme/15_example.png +0 -0
  124. data/demo/doc/screenshots/bootstrap/readme/16_example.png +0 -0
  125. data/demo/doc/screenshots/bootstrap/readme/17_example.png +0 -0
  126. data/demo/doc/screenshots/bootstrap/readme/18_example.png +0 -0
  127. data/demo/doc/screenshots/bootstrap/readme/19_example.png +0 -0
  128. data/demo/doc/screenshots/bootstrap/readme/20_example.png +0 -0
  129. data/demo/doc/screenshots/bootstrap/readme/21_example.png +0 -0
  130. data/demo/doc/screenshots/bootstrap/readme/22_example.png +0 -0
  131. data/demo/doc/screenshots/bootstrap/readme/23_example.png +0 -0
  132. data/demo/doc/screenshots/bootstrap/readme/24_example.png +0 -0
  133. data/demo/doc/screenshots/bootstrap/readme/25_example.png +0 -0
  134. data/demo/doc/screenshots/bootstrap/readme/26_example.png +0 -0
  135. data/demo/doc/screenshots/bootstrap/readme/27_example.png +0 -0
  136. data/demo/doc/screenshots/bootstrap/readme/28_example.png +0 -0
  137. data/demo/doc/screenshots/bootstrap/readme/29_example.png +0 -0
  138. data/demo/doc/screenshots/bootstrap/readme/30_example.png +0 -0
  139. data/demo/doc/screenshots/bootstrap/readme/31_example.png +0 -0
  140. data/demo/doc/screenshots/bootstrap/readme/32_example.png +0 -0
  141. data/demo/doc/screenshots/bootstrap/readme/33_example.png +0 -0
  142. data/demo/doc/screenshots/bootstrap/readme/34_example.png +0 -0
  143. data/demo/doc/screenshots/bootstrap/readme/35_example.png +0 -0
  144. data/demo/doc/screenshots/bootstrap/readme/36_example.png +0 -0
  145. data/demo/doc/screenshots/bootstrap/readme/37_example.png +0 -0
  146. data/demo/doc/screenshots/bootstrap/readme/38_example.png +0 -0
  147. data/demo/doc/screenshots/bootstrap/readme/39_example.png +0 -0
  148. data/demo/doc/screenshots/bootstrap/readme/40_example.png +0 -0
  149. data/demo/doc/screenshots/bootstrap/readme/41_example.png +0 -0
  150. data/demo/doc/screenshots/bootstrap/readme/42_example.png +0 -0
  151. data/demo/doc/screenshots/bootstrap/readme/43_example.png +0 -0
  152. data/demo/doc/screenshots/bootstrap/readme/44_example.png +0 -0
  153. data/demo/doc/screenshots/bootstrap/readme/45_example.png +0 -0
  154. data/demo/doc/screenshots/bootstrap/readme/46_example.png +0 -0
  155. data/demo/doc/screenshots/bootstrap/readme/47_example.png +0 -0
  156. data/demo/doc/screenshots/bootstrap/readme/48_example.png +0 -0
  157. data/demo/doc/screenshots/bootstrap/readme/49_example.png +0 -0
  158. data/demo/doc/screenshots/bootstrap/readme/50_example.png +0 -0
  159. data/demo/log/.keep +0 -0
  160. data/demo/package.json +0 -21
  161. data/demo/public/favicon.ico +0 -0
  162. data/demo/test/application_system_test_case.rb +0 -8
  163. data/demo/test/controllers/bootstrap_controller_test.rb +0 -8
  164. data/demo/test/controllers/users_controller_test.rb +0 -13
  165. data/demo/test/fixtures/action_text/rich_texts.yml +0 -4
  166. data/demo/test/fixtures/users.yml +0 -2
  167. data/demo/test/system/bootstrap_test.rb +0 -84
  168. data/demo/test/test_helper.rb +0 -10
  169. data/demo/webpack.config.js +0 -20
  170. data/demo/yarn.lock +0 -7176
  171. data/gemfiles/5.2.gemfile +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75c715774dfcbad34c15dbd54c3a14da015c4e67805c0a1adfbfd36ff0f0d27b
4
- data.tar.gz: f1a3c95a6cd6f2012c8062f5e3c3f8b680cb17292141443d8465625a552d1e5b
3
+ metadata.gz: 9bea3ab95f979a7fc02d2c2a5dff3bae3ca536c6e277a86d11361c3e3bd72e59
4
+ data.tar.gz: 80fa55a6cbcd89ae0b52ebc8135d8b9f38b25b321bdbe492983db46c866c1e7d
5
5
  SHA512:
6
- metadata.gz: 75107dba8802198d3685161d292ae40e28e9e83acd688c7779a5bf9eade665bdad236c7f64aeac906872a9e751f77ad98a6e24bda27334a8472bb5ec11855906
7
- data.tar.gz: 0c30626a9bde0725bc7ca12713bc9d9acc588832e450752a4142c3a9bc63a47aec9bbdf016a1973ea173153ae700c88f4e0be820ca75c0047ced7cd5d8daa0dc
6
+ metadata.gz: a97b0ddfb9afcfb847b27ea4853c4f3b99bb0c72a0366d4d1a0a3fac217f0693090c96ea03c51e3a07e66cfe3c8c4576be8618eb3b48401c6d6f326e35619fa7
7
+ data.tar.gz: 3d79f681187a5fa0cab604ced1919229cdbdd101cc8f91c4261a115b82fa5589c3037b8b0c6d6208ce17affe964397a8fc33a9483a82a5c74efd22c9224eb582
@@ -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@v2
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: 2.7
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 --auto-correct
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.1', '3.0', '2.7' ]
33
- gemfile: [ '7.0', '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' ]
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@v2
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
- .yarnrc
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
- .byebug_history
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
@@ -5,7 +5,8 @@ require:
5
5
  AllCops:
6
6
  DisplayCopNames: true
7
7
  DisplayStyleGuide: true
8
- TargetRubyVersion: 2.7
8
+ TargetRubyVersion: 3.0
9
+ TargetRailsVersion: 6.0
9
10
  NewCops: enable
10
11
  Exclude:
11
12
  - bin/*
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,12 +1,18 @@
1
1
  # Change Log
2
2
 
3
- ## Apology
3
+ You can find recent releases with docs in GitHub:
4
4
 
5
- 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.
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.1.0...HEAD)
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: 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/).
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=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 .
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
- yarn build --watch &
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
- export BUNDLE_GEMFILE=../gemfiles/7.0.gemfile
180
+ bundle
123
181
  rails db:setup
124
- yarn build --watch &
125
- rails s -b 0.0.0.0
182
+ dev
126
183
  ```
127
184
 
128
- The app doesn't appear to find the source map, or perhaps it isn't being generated. In the Rails log you will see messages similar to:
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
- ```bash
131
- ActionController::RoutingError (No route matches [GET] "/assets/application.js-c6c0edbd68f05cffd0e2495198bfbc4bf42be8a11b76eecbfade30a8036b6b87.map")
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
- But this doesn't seem to affect how the app runs.
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
- 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.
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 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.
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=2.7
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
- 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
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
- 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
- # To test with different Rails versions, use the files in `./gemfiles`
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"