bootstrap_form 4.4.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +48 -0
  3. data/.gitignore +28 -3
  4. data/.rubocop.yml +19 -15
  5. data/CHANGELOG.md +82 -1
  6. data/CONTRIBUTING.md +73 -12
  7. data/Dangerfile +5 -7
  8. data/Dockerfile +21 -0
  9. data/Gemfile +8 -11
  10. data/README.md +829 -82
  11. data/RELEASING.md +5 -10
  12. data/UPGRADE-4.0.md +1 -1
  13. data/UPGRADE-5.0.md +25 -0
  14. data/bootstrap_form.gemspec +8 -5
  15. data/demo/.ruby-version +1 -0
  16. data/demo/Gemfile +80 -0
  17. data/demo/Gemfile.lock +261 -0
  18. data/demo/Procfile.dev +2 -0
  19. data/demo/app/assets/builds/.keep +0 -0
  20. data/demo/app/assets/builds/application.js.LICENSE.txt +9 -0
  21. data/demo/app/assets/config/manifest.js +2 -2
  22. data/demo/app/assets/stylesheets/actiontext.css +31 -0
  23. data/demo/app/assets/stylesheets/application.scss +1 -1
  24. data/demo/app/controllers/bootstrap_controller.rb +17 -2
  25. data/demo/app/controllers/users_controller.rb +9 -0
  26. data/demo/app/helpers/bootstrap_helper.rb +5 -5
  27. data/demo/app/javascript/application.js +3 -0
  28. data/demo/app/models/skill.rb +15 -0
  29. data/demo/app/models/user.rb +14 -0
  30. data/demo/app/views/active_storage/blobs/_blob.html.erb +1 -1
  31. data/demo/app/views/bootstrap/form.html.erb +13 -0
  32. data/demo/app/views/layouts/action_text/contents/_content.html.erb +3 -0
  33. data/demo/app/views/layouts/application.html.erb +28 -20
  34. data/demo/bin/dev +9 -0
  35. data/demo/config/environments/development.rb +3 -3
  36. data/demo/config/puma.rb +2 -2
  37. data/demo/config/routes.rb +1 -0
  38. data/demo/db/schema.rb +31 -16
  39. data/demo/doc/screenshots/bootstrap/index/00_horizontal_form.png +0 -0
  40. data/demo/doc/screenshots/bootstrap/index/01_with_validation_error.png +0 -0
  41. data/demo/doc/screenshots/bootstrap/index/02_inline_form.png +0 -0
  42. data/demo/doc/screenshots/bootstrap/index/03_simple_action_text_example.png +0 -0
  43. data/demo/doc/screenshots/bootstrap/index/04_floating_labels.png +0 -0
  44. data/demo/doc/screenshots/bootstrap/readme/00_example.png +0 -0
  45. data/demo/doc/screenshots/bootstrap/readme/01_example.png +0 -0
  46. data/demo/doc/screenshots/bootstrap/readme/02_example.png +0 -0
  47. data/demo/doc/screenshots/bootstrap/readme/03_example.png +0 -0
  48. data/demo/doc/screenshots/bootstrap/readme/04_example.png +0 -0
  49. data/demo/doc/screenshots/bootstrap/readme/05_example.png +0 -0
  50. data/demo/doc/screenshots/bootstrap/readme/06_example.png +0 -0
  51. data/demo/doc/screenshots/bootstrap/readme/07_example.png +0 -0
  52. data/demo/doc/screenshots/bootstrap/readme/08_example.png +0 -0
  53. data/demo/doc/screenshots/bootstrap/readme/09_example.png +0 -0
  54. data/demo/doc/screenshots/bootstrap/readme/10_example.png +0 -0
  55. data/demo/doc/screenshots/bootstrap/readme/11_example.png +0 -0
  56. data/demo/doc/screenshots/bootstrap/readme/12_example.png +0 -0
  57. data/demo/doc/screenshots/bootstrap/readme/13_example.png +0 -0
  58. data/demo/doc/screenshots/bootstrap/readme/14_example.png +0 -0
  59. data/demo/doc/screenshots/bootstrap/readme/15_example.png +0 -0
  60. data/demo/doc/screenshots/bootstrap/readme/16_example.png +0 -0
  61. data/demo/doc/screenshots/bootstrap/readme/17_example.png +0 -0
  62. data/demo/doc/screenshots/bootstrap/readme/18_example.png +0 -0
  63. data/demo/doc/screenshots/bootstrap/readme/19_example.png +0 -0
  64. data/demo/doc/screenshots/bootstrap/readme/20_example.png +0 -0
  65. data/demo/doc/screenshots/bootstrap/readme/21_example.png +0 -0
  66. data/demo/doc/screenshots/bootstrap/readme/22_example.png +0 -0
  67. data/demo/doc/screenshots/bootstrap/readme/23_example.png +0 -0
  68. data/demo/doc/screenshots/bootstrap/readme/24_example.png +0 -0
  69. data/demo/doc/screenshots/bootstrap/readme/25_example.png +0 -0
  70. data/demo/doc/screenshots/bootstrap/readme/26_example.png +0 -0
  71. data/demo/doc/screenshots/bootstrap/readme/27_example.png +0 -0
  72. data/demo/doc/screenshots/bootstrap/readme/28_example.png +0 -0
  73. data/demo/doc/screenshots/bootstrap/readme/29_example.png +0 -0
  74. data/demo/doc/screenshots/bootstrap/readme/30_example.png +0 -0
  75. data/demo/doc/screenshots/bootstrap/readme/31_example.png +0 -0
  76. data/demo/doc/screenshots/bootstrap/readme/32_example.png +0 -0
  77. data/demo/doc/screenshots/bootstrap/readme/33_example.png +0 -0
  78. data/demo/doc/screenshots/bootstrap/readme/34_example.png +0 -0
  79. data/demo/doc/screenshots/bootstrap/readme/35_example.png +0 -0
  80. data/demo/doc/screenshots/bootstrap/readme/36_example.png +0 -0
  81. data/demo/doc/screenshots/bootstrap/readme/37_example.png +0 -0
  82. data/demo/doc/screenshots/bootstrap/readme/38_example.png +0 -0
  83. data/demo/doc/screenshots/bootstrap/readme/39_example.png +0 -0
  84. data/demo/doc/screenshots/bootstrap/readme/40_example.png +0 -0
  85. data/demo/doc/screenshots/bootstrap/readme/41_example.png +0 -0
  86. data/demo/doc/screenshots/bootstrap/readme/42_example.png +0 -0
  87. data/demo/doc/screenshots/bootstrap/readme/43_example.png +0 -0
  88. data/demo/doc/screenshots/bootstrap/readme/44_example.png +0 -0
  89. data/demo/doc/screenshots/bootstrap/readme/45_example.png +0 -0
  90. data/demo/doc/screenshots/bootstrap/readme/46_example.png +0 -0
  91. data/demo/doc/screenshots/bootstrap/readme/47_example.png +0 -0
  92. data/demo/doc/screenshots/bootstrap/readme/48_example.png +0 -0
  93. data/demo/doc/screenshots/bootstrap/readme/49_example.png +0 -0
  94. data/demo/doc/screenshots/bootstrap/readme/50_example.png +0 -0
  95. data/demo/package.json +10 -6
  96. data/demo/test/application_system_test_case.rb +8 -0
  97. data/demo/test/controllers/bootstrap_controller_test.rb +8 -0
  98. data/demo/test/controllers/users_controller_test.rb +13 -0
  99. data/demo/test/fixtures/users.yml +2 -0
  100. data/demo/test/system/bootstrap_test.rb +84 -0
  101. data/demo/test/test_helper.rb +10 -0
  102. data/demo/webpack.config.js +20 -0
  103. data/demo/yarn.lock +4063 -3144
  104. data/docker-compose.yml +49 -0
  105. data/gemfiles/5.2.gemfile +2 -15
  106. data/gemfiles/6.0.gemfile +2 -17
  107. data/gemfiles/6.1.gemfile +4 -0
  108. data/gemfiles/7.0.gemfile +6 -0
  109. data/gemfiles/edge.gemfile +2 -17
  110. data/lib/bootstrap_form/action_view_extensions/form_helper.rb +1 -1
  111. data/lib/bootstrap_form/components/hints.rb +13 -4
  112. data/lib/bootstrap_form/components/labels.rb +2 -2
  113. data/lib/bootstrap_form/components/validation.rb +1 -1
  114. data/lib/bootstrap_form/configuration.rb +22 -0
  115. data/lib/bootstrap_form/form_builder.rb +10 -12
  116. data/lib/bootstrap_form/form_group.rb +26 -11
  117. data/lib/bootstrap_form/form_group_builder.rb +6 -8
  118. data/lib/bootstrap_form/helpers/bootstrap.rb +17 -12
  119. data/lib/bootstrap_form/inputs/base.rb +5 -5
  120. data/lib/bootstrap_form/inputs/check_box.rb +11 -23
  121. data/lib/bootstrap_form/inputs/collection_check_boxes.rb +5 -1
  122. data/lib/bootstrap_form/inputs/collection_select.rb +2 -1
  123. data/lib/bootstrap_form/inputs/file_field.rb +3 -15
  124. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +2 -1
  125. data/lib/bootstrap_form/inputs/radio_button.rb +17 -30
  126. data/lib/bootstrap_form/inputs/select.rb +1 -0
  127. data/lib/bootstrap_form/inputs/time_zone_select.rb +1 -0
  128. data/lib/bootstrap_form/version.rb +1 -1
  129. data/lib/bootstrap_form.rb +17 -7
  130. metadata +94 -16
  131. data/.travis.yml +0 -42
  132. data/demo/config/initializers/assets.rb +0 -14
  133. data/gemfiles/5.0.gemfile +0 -18
  134. data/gemfiles/5.1.gemfile +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e064911f3a679f4ecf322d6e3e240b35cf1f33e73908d3bf3494a71a3013781
4
- data.tar.gz: 044b4a8d8dd6c046f88b45ddd6fb83ed9d619fd6e2872fbd1eb32c84fda50f71
3
+ metadata.gz: 75c715774dfcbad34c15dbd54c3a14da015c4e67805c0a1adfbfd36ff0f0d27b
4
+ data.tar.gz: f1a3c95a6cd6f2012c8062f5e3c3f8b680cb17292141443d8465625a552d1e5b
5
5
  SHA512:
6
- metadata.gz: ec13235058d63f5ff4a12991660d10acff7b7576954e3a103d38592cd90a6ee0a8431c93eeb33878d7a228e432bbf590ff248d60445cfacbca278efc73d5fc52
7
- data.tar.gz: 2b3c704fa1981633bbaaa04dc543d72e9a1e3d535f8d56852752fb9eef65ea4d75089971e073defb193119f80c8cc13a3708a8ac603bcdef0edc8946f2a95958
6
+ metadata.gz: 75107dba8802198d3685161d292ae40e28e9e83acd688c7779a5bf9eade665bdad236c7f64aeac906872a9e751f77ad98a6e24bda27334a8472bb5ec11855906
7
+ data.tar.gz: 0c30626a9bde0725bc7ca12713bc9d9acc588832e450752a4142c3a9bc63a47aec9bbdf016a1973ea173153ae700c88f4e0be820ca75c0047ced7cd5d8daa0dc
@@ -0,0 +1,48 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ Lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ with:
13
+ fetch-depth: 0
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7
17
+ bundler-cache: true
18
+ # Disabled since it requires access not granted by GitHub Actions for PRs
19
+ # - name: Danger
20
+ # if: ${{ github.event_name == 'pull_request' }}
21
+ # env:
22
+ # DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23
+ # run: |
24
+ # bundle exec danger
25
+ - name: Rubocop
26
+ run: bundle exec rubocop --auto-correct
27
+ Test:
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ fail-fast: false
31
+ matrix:
32
+ ruby-version: [ '3.1', '3.0', '2.7' ]
33
+ gemfile: [ '7.0', '6.1', '6.0', '5.2', 'edge' ]
34
+ exclude:
35
+ - { ruby-version: '3.1', gemfile: "6.0" }
36
+ - { ruby-version: '3.1', gemfile: "5.2" }
37
+ - { ruby-version: '3.0', gemfile: "5.2" }
38
+ env:
39
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
40
+ steps:
41
+ - uses: actions/checkout@v2
42
+ - name: Set up Ruby
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby-version }}
46
+ bundler-cache: true
47
+ - name: Run tests
48
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,19 +1,24 @@
1
1
  .bundle/
2
+ .idea
2
3
  log/*.log
3
4
  pkg/
4
5
  demo/db/*.sqlite3
6
+ demo/doc/screenshots/**/*.committed.png
7
+ demo/doc/screenshots/**/*.latest.png
5
8
  demo/log/*.log
6
9
  demo/tmp/
7
10
  *.gem
8
11
  .rbenv-gemsets
9
12
  *.swp
10
- Gemfile.lock
13
+ /Gemfile.lock
11
14
  test/gemfiles/*.lock
12
- .ruby-version
15
+ gemfiles/*.lock
16
+ /.ruby-version
13
17
  Vagrantfile
14
18
  .vagrant
19
+ .yarnrc
15
20
 
16
- // For the demo app.
21
+ # For the demo app.
17
22
 
18
23
  # Ignore uploaded files in development.
19
24
  demo/storage/*
@@ -26,7 +31,27 @@ demo/public/assets
26
31
  demo/config/master.key
27
32
  demo/public/packs
28
33
  demo/public/packs-test
34
+ demo/app/assets/builds/*
35
+ !demo/app/assets/builds/.keep
29
36
  demo/node_modules
30
37
  demo/yarn-error.log
31
38
  demo/yarn-debug.log*
32
39
  demo/.yarn-integrity
40
+ demo/vendor/bundle
41
+
42
+ # For stuff that gets created if using the Dockerfile image
43
+ .bundle/
44
+ .cache/
45
+ vendor/bundle
46
+
47
+ # or .local/share/pry/pry_history if you need to be more exact
48
+ .local/
49
+ .irb_history
50
+ .byebug_history
51
+ # For Debian images with Bash
52
+ .bash_history
53
+ # For Alpine images
54
+ .ash_history
55
+ .sqlite_history
56
+
57
+ docker-compose.override.yml
data/.rubocop.yml CHANGED
@@ -1,33 +1,43 @@
1
- # Taken from: https://github.com/mattbrictson/rails-template/blob/master/rubocop.yml.tt
2
- # Modified for demo app in `demo/` directory.
3
- require: rubocop-rails
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
4
 
5
5
  AllCops:
6
6
  DisplayCopNames: true
7
7
  DisplayStyleGuide: true
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.7
9
+ NewCops: enable
9
10
  Exclude:
10
- - "bin/*"
11
+ - bin/*
11
12
  - Capfile
12
13
  - demo/bin/*
13
- - "demo/bower_components/**/*"
14
+ - demo/bower_components/**/*
14
15
  - demo/config/boot.rb
15
16
  - demo/config/environment.rb
16
17
  - demo/config/initializers/version.rb
17
18
  - demo/db/schema.rb
18
- - "demo/node_modules/**/*"
19
+ - demo/node_modules/**/*
19
20
  - demo/Rakefile
20
- - "demo/tmp/**/*"
21
- - "demo/vendor/**/*"
21
+ - demo/tmp/**/*
22
+ - demo/vendor/**/*
22
23
  - Gemfile
23
24
  - gemfiles/vendor/bundle/**/*
25
+ - vendor/bundle/**/*
24
26
  - Guardfile
25
27
  - Rakefile
28
+ - vendor/**/*
29
+
30
+ Layout/LineLength:
31
+ Max: 132
32
+ Exclude:
33
+ - "demo/config/**/*"
34
+ - "demo/db/**/*"
26
35
 
27
36
  Layout/SpaceAroundEqualsInParameterDefault:
28
37
  EnforcedStyle: no_space
29
38
 
30
39
  Metrics/AbcSize:
40
+ Max: 18
31
41
  Exclude:
32
42
  - "demo/test/**/*"
33
43
  - "test/**/*"
@@ -43,12 +53,6 @@ Metrics/ClassLength:
43
53
  - "demo/test/**/*"
44
54
  - "test/**/*"
45
55
 
46
- Metrics/LineLength:
47
- Max: 132
48
- Exclude:
49
- - "demo/config/**/*"
50
- - "demo/db/**/*"
51
-
52
56
  Metrics/MethodLength:
53
57
  Max: 12
54
58
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,17 +1,95 @@
1
+ # Change Log
2
+
3
+ ## Apology
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.
6
+
7
+
8
+ - [Pending Release](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.1.0...HEAD)
9
+ - [5.1.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...v5.1.0)
10
+ - [5.0.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0)
11
+ - [4.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0)
12
+ - [4.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0)
13
+ - [4.3.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...v4.3.0)
14
+ - [4.2.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.1.0...v4.2.0)
15
+ - [4.1.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0...v4.1.0)
16
+ - [4.0.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0.alpha1...v4.0.0)
17
+ - [4.0.0.alpha1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.7.0...v4.0.0.alpha1)
18
+ - [2.7.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.6.0...v2.7.0)
19
+ - [2.6.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.3...v2.6.0)
20
+ - [2.5.3](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.2...v2.5.3)
21
+ - [2.5.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.1...v2.5.2)
22
+ - [2.5.1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.5.0...v2.5.1)
23
+ - [2.5.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.4.0...v2.5.0)
24
+ - [2.4.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v2.3.0...v2.4.0)
25
+
1
26
  ## [Pending Release][]
2
27
 
3
28
  ### Breaking changes
4
29
 
30
+ * [#618](https://github.com/bootstrap-ruby/bootstrap_form/pull/618): Allow overriding the wrapper class - [@donv](https://github.com/donv).
5
31
  * Your contribution here!
6
32
 
7
33
  ### New features
8
34
 
35
+ * [#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
36
+ * [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
37
+
38
+ * [#215](https://github.com/bootstrap-ruby/bootstrap_form/issues/215): Add `include_hidden` option to `check_box`
39
+ ### Bugfixes
40
+
41
+ * [#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.
42
+
43
+ ## [5.0.0.alpha1][]
44
+
45
+ ### Breaking changes
46
+
47
+ * [#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.)
48
+
49
+ ### New features
50
+
9
51
  * Your contribution here!
10
52
 
11
53
  ### Bugfixes
12
54
 
55
+ * [#284] [#300] Field's help message is displayed, even while inline error message is displayed. - [@antpaw](https://github.com/antpaw)
56
+
57
+ ## [5.0.0][] (2021-11-11)
58
+
59
+ ### Breaking changes
60
+
61
+ * Generates markup for Bootstrap 5.
62
+
63
+ ### New features
64
+
65
+ * [#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
66
+ * [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
67
+
68
+ ### Bugfixes
69
+
70
+ * [#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.
71
+
72
+ ## [5.0.0.alpha1][]
73
+
74
+ ### Breaking changes
75
+
76
+ * [#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.)
77
+
78
+ ### New features
79
+
13
80
  * Your contribution here!
14
81
 
82
+ ### Bugfixes
83
+
84
+ * [#586](https://github.com/bootstrap-ruby/bootstrap_form/pull/586): Fix Rails 6.1 tests on master - [@thimo](https://github.com/thimo).
85
+ * [#587](https://github.com/bootstrap-ruby/bootstrap_form/pull/587): Replace `strip_heredoc` with `<<~` - [@thimo](https://github.com/thimo).
86
+
87
+ ## [4.5.0][] (2020-04-29)
88
+
89
+ ### New features
90
+
91
+ * [#562](https://github.com/bootstrap-ruby/bootstrap_form/pull/562): Allow to configure default form attributes - [@sharshenov](https://github.com/sharshenov).
92
+
15
93
  ## [4.4.0][] (2020-03-08)
16
94
 
17
95
  ### New features
@@ -286,7 +364,10 @@ Features:
286
364
  - Added support for bootstrap_form_tag (@baldwindavid)
287
365
 
288
366
 
289
- [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...HEAD
367
+ [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.1.0...HEAD
368
+ [5.1.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...v5.1.0
369
+ [5.0.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0
370
+ [4.5.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0
290
371
  [4.4.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0
291
372
  [4.3.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...v4.3.0
292
373
  [4.2.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.1.0...v4.2.0
data/CONTRIBUTING.md CHANGED
@@ -42,12 +42,7 @@ Fork the project. Optionally, create a branch you want to work on.
42
42
  - Add a line to the CHANGELOG for your bug fix or feature.
43
43
  - Read the [Coding Guidelines](#coding-guidelines) section and make sure that `rake lint` doesn't find any offences.
44
44
 
45
- You may find the demo application useful for development and debugging.
46
-
47
- - `cd demo`
48
- - `rake db:schema:load`
49
- - `rails s`
50
- - Navigate to http://localhost:3000
45
+ You may find the [demo application](#the-demo-application) useful for development and debugging.
51
46
 
52
47
  ### 6. Make a pull request
53
48
 
@@ -58,16 +53,16 @@ You may find the demo application useful for development and debugging.
58
53
  ### 7. Done!
59
54
 
60
55
  Somebody will shortly review your pull request and if everything is good, it will be
61
- merged into the master branch. Eventually the gem will be published with your changes.
56
+ merged into the main branch. Eventually the gem will be published with your changes.
62
57
 
63
58
  ### Coding guidelines
64
59
 
65
60
  This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding
66
61
  guidelines.
67
62
 
68
- * Test that your contribution passes with `rake rubocop`.
69
- * RuboCop is also run as part of the full test suite with `bundle exec rake`.
70
- * Note the Travis build will fail and your PR cannot be merged if RuboCop finds offences.
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.
71
66
 
72
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/).
73
68
 
@@ -77,11 +72,74 @@ The goal of `bootstrap_form` is to support all versions of Rails currently suppo
77
72
 
78
73
  The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/maintenance_policy.html).
79
74
 
75
+ ### Developing with Docker
76
+
77
+ This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
78
+
79
+ ```bash
80
+ docker build --tag bootstrap_form .
81
+ ```
82
+
83
+ 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.
84
+
85
+ If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
86
+
87
+ ```bash
88
+ docker build --build-arg "RUBY_VERSION=2.7" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
89
+ ```
90
+
91
+ Then run the container you built with the shell, and create the bundle:
92
+
93
+ ```bash
94
+ docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -it bootstrap_form /bin/bash
95
+ bundle install
96
+ ```
97
+
98
+ You can run tests in the container as normal, with `rake test`.
99
+
100
+ (Some of that command line is need for Linux hosts, to run the container as the current user.)
101
+
102
+ ### The Demo Application
103
+
104
+ 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.
105
+
106
+ 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.
107
+ To run the demo app, set up the database and run the server:
108
+
109
+ ```bash
110
+ cd demo
111
+ bundle
112
+ rails db:setup
113
+ yarn build --watch &
114
+ rails s -b 0.0.0.0
115
+ ```
116
+
117
+ To run the demo app in the Docker container:
118
+
119
+ ```bash
120
+ docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -p 3000:3000 -it bootstrap_form /bin/bash
121
+ cd demo
122
+ export BUNDLE_GEMFILE=../gemfiles/7.0.gemfile
123
+ rails db:setup
124
+ yarn build --watch &
125
+ rails s -b 0.0.0.0
126
+ ```
127
+
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:
129
+
130
+ ```bash
131
+ ActionController::RoutingError (No route matches [GET] "/assets/application.js-c6c0edbd68f05cffd0e2495198bfbc4bf42be8a11b76eecbfade30a8036b6b87.map")
132
+ ```
133
+
134
+ But this doesn't seem to affect how the app runs.
135
+
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.
137
+
80
138
  ## Documentation Contributions
81
139
 
82
140
  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).
83
141
 
84
- 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.
142
+ 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.
85
143
 
86
144
  ## Reviewing Pull Requests
87
145
 
@@ -92,11 +150,14 @@ We are an entirely volunteer project. Sometimes it's hard for people to find the
92
150
  Thanks to all the great contributors over the years: https://github.com/bootstrap-ruby/bootstrap_form/graphs/contributors
93
151
 
94
152
  ## Troubleshooting
153
+
95
154
  ### Models and Database Tables
155
+
96
156
  `bootstrap_form` needs a few models and tables to support testing. It appears that the necessary tables were created via the `demo/db/schema.rb` file. To support `rich_text_area`, Rails 6 creates some migrations. These migrations had to be run in the existing database (not an empty one) to create a new `schema.rb` that creates the `bootstrap_form` test tables, and the tables needed by Rails 6. The `schema.rb` file was checked in to GitHub, but the migrations were not.
97
157
 
98
158
  In the future, any new Rails functionality that creates tables would likely have to be prepared the same way:
99
- ```
159
+
160
+ ```bash
100
161
  cd demo
101
162
  rails db:setup # create the databases from `schema.rb`
102
163
  rails db:migrate # add the new tables and create a new `schema.rb`
data/Dangerfile CHANGED
@@ -44,11 +44,9 @@ end
44
44
  # ------------------------------------------------------------------------------
45
45
  # Did you remove the CHANGELOG's "Your contribution here!" line?
46
46
  # ------------------------------------------------------------------------------
47
- if has_changelog_changes
48
- if IO.read("CHANGELOG.md").scan(/^\s*[-\*] Your contribution here/i).count < 3
49
- raise(
50
- "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
51
- sticky: false
52
- )
53
- end
47
+ if has_changelog_changes && File.read("CHANGELOG.md").scan(/^\s*[-*] Your contribution here/i).count < 3
48
+ raise(
49
+ "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
50
+ sticky: false
51
+ )
54
52
  end
data/Dockerfile ADDED
@@ -0,0 +1,21 @@
1
+ ARG RUBY_VERSION=2.7
2
+ ARG DISTRO=bullseye
3
+
4
+ FROM ruby:$RUBY_VERSION-$DISTRO
5
+
6
+ RUN mkdir -p /app
7
+ ENV HOME /app
8
+ WORKDIR /app
9
+
10
+ ENV GEM_HOME $HOME/vendor/bundle
11
+ ENV BUNDLE_APP_CONFIG="$GEM_HOME"
12
+ ENV PATH ./bin:$GEM_HOME/bin:$PATH
13
+ RUN (echo 'docker'; echo 'docker') | passwd root
14
+
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
+ EXPOSE 3000
data/Gemfile CHANGED
@@ -1,26 +1,23 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ gemspec path: __dir__
4
4
 
5
- # Uncomment and change rails version for testing purposes
6
- # gem "rails", "~> 5.2.0"
7
- gem "rails", "~> 6.0.0"
5
+ # To test with different Rails versions, use the files in `./gemfiles`
8
6
 
9
7
  group :development do
10
- gem "chandler", ">= 0.7.0"
11
8
  gem "htmlbeautifier"
9
+ gem "rubocop-performance", require: false
12
10
  gem "rubocop-rails", require: false
13
- gem "sassc-rails"
14
- gem "webpacker", ">= 4.0.0.rc.3"
11
+ gem "webpacker"
15
12
  end
16
13
 
17
14
  group :test do
18
- # can relax version requirement for Rails 5.2.beta3+
19
- gem "minitest", "~> 5.10.3"
20
-
21
15
  gem "diffy"
22
16
  gem "equivalent-xml"
23
17
  gem "mocha"
24
18
  gem "sqlite3"
25
- gem "timecop", "~> 0.7.1"
19
+ end
20
+
21
+ group :ci do
22
+ gem "danger"
26
23
  end