twitter-bootstrap-rails 5.5.1 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/README.md +84 -5
  4. data/app/assets/javascripts/twitter/bootstrap/bootstrap.min.js +3 -3
  5. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css +3 -3
  6. data/lib/generators/bootstrap/agent/agent_generator.rb +12 -0
  7. data/lib/generators/bootstrap/agent/templates/guide.md.erb +23 -3
  8. data/lib/generators/bootstrap/bootstrap5_markup.rb +22 -0
  9. data/lib/generators/bootstrap/cdn/cdn_generator.rb +32 -2
  10. data/lib/generators/bootstrap/cdn_tags.rb +11 -0
  11. data/lib/generators/bootstrap/install/install_generator.rb +77 -21
  12. data/lib/generators/bootstrap/layout/layout_generator.rb +15 -0
  13. data/lib/generators/bootstrap/layout/templates/layout.html.erb +4 -1
  14. data/lib/generators/bootstrap/layout/templates/layout.html.haml +4 -1
  15. data/lib/generators/bootstrap/layout/templates/layout.html.slim +4 -1
  16. data/lib/generators/bootstrap/nes/nes_generator.rb +101 -0
  17. data/lib/generators/bootstrap/snippets/snippet_base.rb +4 -0
  18. data/lib/generators/bootstrap/stimulus/stimulus_generator.rb +49 -0
  19. data/lib/generators/bootstrap/stimulus/templates/bootstrap_controller.js.tt +67 -0
  20. data/lib/generators/bootstrap/themed/themed_generator.rb +4 -0
  21. data/lib/twitter/bootstrap/rails/config.rb +17 -4
  22. data/lib/twitter/bootstrap/rails/doctor.rb +125 -6
  23. data/lib/twitter/bootstrap/rails/version.rb +37 -5
  24. data/spec/lib/generators/cdn_generator_spec.rb +31 -0
  25. data/spec/lib/generators/doctor_generator_spec.rb +52 -0
  26. data/spec/lib/generators/install_generator_spec.rb +51 -1
  27. data/spec/lib/generators/layout_generator_spec.rb +24 -0
  28. data/spec/lib/generators/nes_generator_spec.rb +164 -0
  29. data/spec/lib/generators/no_hardcoded_versions_spec.rb +3 -1
  30. data/spec/lib/generators/stimulus_generator_spec.rb +65 -0
  31. data/spec/support/generator_spec_helper.rb +2 -0
  32. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap.bundle.min.js +3 -3
  33. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap.esm.min.js +7 -0
  34. data/vendor/assets/javascripts/twitter/bootstrap/popper.esm.js +15 -0
  35. data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.min.css +3 -3
  36. metadata +28 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 875edfcbadfdb5b579da81a68c3a5dc44d7b14d208bcf7de6dc89a8dabe969d3
4
- data.tar.gz: bc3f64fe1f6c45217d043887a9fbcab629e7161738b2c47c3ea46a0a830b1cb1
3
+ metadata.gz: d3343912325295dcfadc41e7423dc0bee302ff317a96f33eb139b1a9a57298c3
4
+ data.tar.gz: 7bfd61a239c28448507553b76413cb4f0b413c24aeda37eef90f081e8488a26a
5
5
  SHA512:
6
- metadata.gz: 18bd87131c776f3da869462fb6af504614dd708a91434881a9e46955a3e7817cdbcd8071e3d490a5bd18841b3601016e632e73163071786c026b5a2fb52cfc74
7
- data.tar.gz: 75630ca82664a7956d088fbc90b48d2eb1f11e89087488dcb7a5b209221aff58ccabc2296546a4be9fc83595109b6b31fc41db9be8e931a23818ac8f6dea8841
6
+ metadata.gz: 78e89eefc0ea931a04d4d9dc47f6137b71a058c8107bdb77b2ff2336f6d55e29b82bd3c685c774a52ba620adc75279e84045ccc271588d0d39f1808acbfca6c3
7
+ data.tar.gz: 902f2ce037d46432def08732b1e64a8a015cb1c9c249326479150f4e450e29e5f8485f1fe0c50964bc7036c0c2044886e8f56cdad400a449ffbbfb7ce44705a1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,54 @@
1
+ ## 5.6.1
2
+
3
+ ### Changed
4
+
5
+ - **Bootstrap 5.3.9.** Re-vendored the stylesheet, bundle and ES module build, and
6
+ updated the CDN tags and SRI hashes (`layout`, `starter`, `cdn`). Popper stays at
7
+ 2.11.8. 5.3.9 adds `.modal-xxl`, which works through
8
+ `modal_dialog(:size => "modal-xxl")`, and keeps tooltip and popover text from data
9
+ attributes as literal text.
10
+
11
+ ## 5.6.0
12
+
13
+ ### Added
14
+
15
+ - **`rails g bootstrap:install importmap`.** Vendors the stylesheet and Bootstrap's ES
16
+ module build, pins `bootstrap` and `@popperjs/core` in `config/importmap.rb`, and
17
+ imports Bootstrap from `app/javascript/application.js`. Popper's official UMD build
18
+ is wrapped with ES module exports, because Popper ships no single-file ES module.
19
+ - **`rails g bootstrap:stimulus`** writes a Stimulus controller that sets up tooltips
20
+ and popovers on each Turbo render, disposes of them afterwards, and closes modals,
21
+ offcanvases and dropdowns before Turbo caches a page.
22
+ - **`rails g bootstrap:nes`** sets up HeroDevs Bootstrap NES 4.6.5 (paid,
23
+ security-patched Bootstrap 4.6) through npm. It adds the aliased package and an
24
+ override to `package.json`, and the registry to `.npmrc` with the token read from
25
+ `${HERODEVS_NES_TOKEN}`. The doctor gets `nes_package` and `nes_registry` checks
26
+ and skips the legacy-markup scan. The agent guide tells agents to write Bootstrap 4
27
+ markup, and the Bootstrap 5 generators warn.
28
+ - **`rails g bootstrap:cdn --bootstrap=6`** prints the Bootstrap 6.0.0-alpha.1 tags,
29
+ with the bundle as an ES module. The doctor names a Bootstrap 6 prerelease and
30
+ points at `--v6`.
31
+ - The doctor has an `importmap_tags` check.
32
+ - The upstream `bootstrap-v4-v6-migration` skill is installed in this repository
33
+ next to `bootstrap-v5-v6-migration`.
34
+ - Gemspec metadata (changelog, source, bug tracker, documentation, funding), and
35
+ `rubygems_mfa_required`.
36
+ - A feature-request issue template and Dependabot for Bundler.
37
+
38
+ ### Changed
39
+
40
+ - **Requires Rails 7.1 or later** (was 5.0). Older lines get no security fixes and
41
+ weren't tested.
42
+ - `bootstrap:layout` keeps `javascript_importmap_tags` on apps with
43
+ `config/importmap.rb`. Regenerating the application layout used to drop it, which
44
+ turned off Turbo and Stimulus.
45
+ - `CONTRIBUTERS.md` is now `CONTRIBUTORS.md`.
46
+
47
+ ### Removed
48
+
49
+ - `WARP.md` and `.travis.yml`, which described the pre-5.4 toolchain.
50
+ - The unused `minitest`, `mocha`, `turn` and `coveralls` development gems.
51
+
1
52
  ## 5.5.1
2
53
 
3
54
  ### Added
data/README.md CHANGED
@@ -6,13 +6,15 @@
6
6
  [![GitHub issues](https://img.shields.io/github/issues/seyhunak/twitter-bootstrap-rails.svg)](https://github.com/seyhunak/twitter-bootstrap-rails/issues)
7
7
  [![Built with Claude Code](https://img.shields.io/badge/Built%20with-Claude%20Code-D97757?logo=claude&logoColor=white)](https://claude.com/claude-code)
8
8
 
9
- Integrates Bootstrap 5.3.8 into Rails Asset Pipeline. Supports Rails 8, 7, 6, 5.
10
- Tested against Rails 8.1.4.1 and 8.0.5.2.
9
+ Integrates Bootstrap 5.3.9 into Rails on Propshaft, Sprockets, importmap or the CDN.
10
+ Supports Rails 8 and 7.1+. Tested against Rails 8.1.4.1 and 8.0.5.2.
11
+ Apps still on Bootstrap 4 can use [HeroDevs Bootstrap NES 4.6](#bootstrap-nes-46-herodevs).
11
12
 
12
13
  > **Upgrade Rails.** [Rails 8.1.4.1 and 8.0.5.2](https://rubyonrails.org/2026/11/4/Rails-8.0.5.2-and-8.1.4.1-have-been-released)
13
14
  > fix 21 security issues, and the Rails team strongly recommends upgrading as soon
14
- > as possible. This gem's dependency range still allows older Rails versions, so
15
- > installing it won't upgrade Rails for you. Run `bundle update rails` in your app.
15
+ > as possible. This gem requires Rails 7.1 or later but allows unpatched releases
16
+ > within that range, so installing it won't upgrade Rails for you. Run
17
+ > `bundle update rails` in your app.
16
18
  > Security support for Rails 8.0 ends on 7 November 2026, and older series are
17
19
  > already unsupported.
18
20
 
@@ -40,6 +42,7 @@ is reproducible from a command:
40
42
  | CDN CSS `<link>` | `rails g bootstrap:cdn --css` |
41
43
  | CDN JS bundle `<script>` | `rails g bootstrap:cdn --js` |
42
44
  | Popper + `bootstrap.js` separately | `rails g bootstrap:cdn --separate-popper` |
45
+ | Bootstrap 6 prerelease tags | `rails g bootstrap:cdn --bootstrap=6` |
43
46
  | Important globals (doctype, `lang`, viewport) | baked into every generated layout and the starter template |
44
47
 
45
48
  ```bash
@@ -49,6 +52,9 @@ rails g bootstrap:install static
49
52
  # ...or load Bootstrap from the jsDelivr CDN instead
50
53
  rails g bootstrap:install cdn
51
54
 
55
+ # ...or pin Bootstrap as an ES module in config/importmap.rb
56
+ rails g bootstrap:install importmap
57
+
52
58
  # Generate a Bootstrap layout
53
59
  rails g bootstrap:layout application
54
60
 
@@ -69,6 +75,9 @@ rails g bootstrap:cdn
69
75
  rails g scaffold Task title:string done:boolean
70
76
  rails db:migrate
71
77
  rails g bootstrap:themed Tasks
78
+
79
+ # Keep tooltips, popovers and modals working with Turbo (needs Stimulus)
80
+ rails g bootstrap:stimulus
72
81
  ```
73
82
 
74
83
  `bootstrap:install cdn` records the choice in `config/initializers/bootstrap.rb`,
@@ -83,6 +92,64 @@ run `rails g bootstrap:layout` after `bootstrap:install static` either way.
83
92
  The Bootstrap version and its CDN URLs and integrity hashes live in one place,
84
93
  `Twitter::Bootstrap::Rails::BOOTSTRAP_CDN`. No template hardcodes them.
85
94
 
95
+ ### Importmap
96
+
97
+ `rails g bootstrap:install importmap` is for apps on importmap-rails (the Rails 7 and
98
+ 8 default). It vendors the stylesheet, copies Bootstrap's ES module build and Popper
99
+ into `vendor/javascript/twitter/bootstrap/`, pins both in `config/importmap.rb`, and
100
+ adds `import "bootstrap"` to `app/javascript/application.js`. Your own modules can
101
+ then `import { Tooltip } from "bootstrap"`. Nothing is fetched from a CDN at runtime.
102
+
103
+ Popper ships no single-file ES module build, so the gem wraps Popper's official
104
+ UMD build with ES module exports.
105
+
106
+ `bootstrap:layout` now keeps `<%= javascript_importmap_tags %>` in the layout on any
107
+ app with `config/importmap.rb`. Earlier versions dropped it, so regenerating
108
+ `application` silently turned off Turbo and Stimulus. The doctor warns
109
+ (`importmap_tags`) if no layout loads the importmap.
110
+
111
+ ### Turbo and Stimulus
112
+
113
+ Bootstrap's data attributes (`data-bs-toggle="modal"`, `"dropdown"`, `"collapse"`)
114
+ work with Turbo on their own. Tooltips and popovers are opt-in JavaScript, and an
115
+ open modal can be cached by Turbo and come back with its backdrop stuck. Run
116
+ `rails g bootstrap:stimulus` and add `data-controller="bootstrap"` to `<body>`. The
117
+ controller sets up tooltips and popovers on every render, disposes of them
118
+ afterwards, and closes modals, offcanvases and dropdowns before Turbo caches a page.
119
+ On importmap apps it imports Bootstrap, and elsewhere it uses the bundle's global.
120
+
121
+ ### Bootstrap NES 4.6 (HeroDevs)
122
+
123
+ Apps that can't leave Bootstrap 4 yet can run
124
+ [HeroDevs Bootstrap NES 4.6](https://docs.herodevs.com/bootstrap/bootstrap-4-6), a
125
+ security-patched Bootstrap 4.6 (currently 4.6.5). It is a **paid** product served
126
+ from HeroDevs' private npm registry, so the gem can't vendor it. It sets your app
127
+ up to install it:
128
+
129
+ ```bash
130
+ rails g bootstrap:nes # package.json + .npmrc + initializer
131
+ export HERODEVS_NES_TOKEN=... # your HeroDevs access token
132
+ npm install
133
+ rails g bootstrap:doctor # checks the NES setup
134
+ ```
135
+
136
+ - It needs npm, so use jsbundling-rails or cssbundling-rails. importmap can't
137
+ install from an authenticated registry.
138
+ - `package.json` gets
139
+ `"bootstrap": "npm:@neverendingsupport/bootstrap@4.6.2-bootstrap-4.6.5"` plus a
140
+ matching `overrides` entry, so packages that depend on Bootstrap get NES too.
141
+ - `.npmrc` gets the registry and
142
+ `_authToken=${HERODEVS_NES_TOKEN}`, so the token stays in the environment and out
143
+ of git. Use `--token-env=NAME` for another variable name.
144
+ - Bootstrap 4's JavaScript needs jQuery.
145
+ - The doctor checks the package, the override, the registry and the token line. It
146
+ warns if a token is written into `.npmrc` or the NES release is older than the one
147
+ the gem knows, and it doesn't flag Bootstrap 4 markup as legacy.
148
+ - The gem's layout, themed and snippet generators and its view helpers write
149
+ Bootstrap 5 markup, so they warn on an NES app. `bootstrap:agent` tells coding
150
+ agents to write Bootstrap 4 markup and points them at the upstream
151
+ `bootstrap-v4-v6-migration` skill.
152
+
86
153
  ## Snippets
87
154
 
88
155
  Every snippet published at
@@ -182,13 +249,14 @@ can't verify it rather than reporting an error.
182
249
 
183
250
  ### Preparing for Bootstrap 6
184
251
 
185
- This gem ships Bootstrap 5.3.8. Bootstrap 6 is in alpha (`6.0.0-alpha.1` on npm),
252
+ This gem ships Bootstrap 5.3.9. Bootstrap 6 is in alpha (`6.0.0-alpha.1` on npm),
186
253
  and the Bootstrap team publishes an agent skill for the move from 5 to 6. Install it
187
254
  into your app alongside the gem's own guide:
188
255
 
189
256
  ```bash
190
257
  npx skills add twbs/bootstrap --skill bootstrap-v5-v6-migration
191
258
  rails g bootstrap:agent # the guide tells agents to stay on Bootstrap 5 markup until you migrate
259
+ rails g bootstrap:cdn --bootstrap=6 # prerelease CDN tags, to try Bootstrap 6 out
192
260
  rails g bootstrap:doctor --v6 # the migration worklist
193
261
  rails g bootstrap:doctor --v6 --json
194
262
  ```
@@ -229,6 +297,17 @@ rails server
229
297
  Run `bootstrap:layout` even if you already have a layout — that step is what puts
230
298
  Bootstrap's CSS and JS on the page.
231
299
 
300
+ ## Upgrading to 5.6.0
301
+
302
+ 5.6.0 requires **Rails 7.1 or later**. Apps on older Rails should pin
303
+ `gem "twitter-bootstrap-rails", "~> 5.5.1"`.
304
+
305
+ If your app uses importmap and you generated its layout with an earlier version,
306
+ re-run `rails g bootstrap:layout` or add `<%= javascript_importmap_tags %>` to its
307
+ `<head>`: earlier layouts left it out. `rails g bootstrap:doctor` reports this as
308
+ `importmap_tags`. To load Bootstrap's JavaScript through the importmap instead of the
309
+ bundle, run `rails g bootstrap:install importmap`.
310
+
232
311
  ## Upgrading to 5.5.0
233
312
 
234
313
  5.5.0 changes the HTML that the view helpers produce. They were still