rails-fort 0.1.5 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 08b7b0c97e01bf4cbec192e7a1af23030317ccb0
4
- data.tar.gz: c02deb8fe42a71bbf114af126027c8907ac9a68b
2
+ SHA256:
3
+ metadata.gz: 4def9cb0b3f3e14b33e1b34efa92e70dba9d7aea7f57cfe69c1d141cbfc5f149
4
+ data.tar.gz: 17bace62f5d924ecf13daf02f8836eb48f3a3e07ee96c7f14235988d1c5d00cf
5
5
  SHA512:
6
- metadata.gz: ae70e99e7537819869c0bff39d097ef2fa500dd0ec2dacc1c7a01c06ae1ee054ee87dbdcf110afbede9e2f2989c9bd2f33270ebec333aadb58dcf2801baa523d
7
- data.tar.gz: e225f341e2f4d99089a6d01f57f01907c74111e3f1dab6e4c7c5f8f178f55b963c1b9c367c5a0f798668c7a35d6ad3fa5539a64fdad9ab860e5c392d6f3de9db
6
+ metadata.gz: a5a4098a1bb92800febb3bd8ac7df48994b2e5d2b79a8eb144c13dbd98f4f7f5c91d57a2d1071777c5faecb91b1e8c1637e07e0f0bacef54ea75235f35278e6e
7
+ data.tar.gz: 0e54e8564ebceee75c96101308abf3bb31b293def4ba571e098f68366ebf68fae0f0a8f4b2b8966753be216be70536e2105afc2ca13a62e5e4dada221e176194
@@ -0,0 +1,55 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+ pull_request:
7
+ branches: [ main, master ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: ['3.0', '3.1', '3.2', '3.3']
16
+ rails: ['6.0', '6.1', '7.0', '7.1', '7.2', '8.0']
17
+ exclude:
18
+ # Rails 7.2+ requires Ruby 3.1+
19
+ - ruby: '3.0'
20
+ rails: '7.2'
21
+ - ruby: '3.0'
22
+ rails: '8.0'
23
+
24
+ env:
25
+ RAILS_VERSION: ${{ matrix.rails }}
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ bundler-cache: true
35
+
36
+ - name: Run tests
37
+ run: bundle exec rake
38
+
39
+ - name: Run RuboCop
40
+ run: bundle exec rubocop
41
+
42
+ security:
43
+ runs-on: ubuntu-latest
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - name: Set up Ruby
49
+ uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: '3.3'
52
+ bundler-cache: true
53
+
54
+ - name: Security audit
55
+ run: bundle exec bundle-audit --update
data/.gitignore CHANGED
@@ -1,9 +1,38 @@
1
+ ## Ruby/Bundler
1
2
  /.bundle/
2
- /.yardoc
3
+ /vendor/bundle/
3
4
  /Gemfile.lock
5
+
6
+ ## Documentation
7
+ /.yardoc/
4
8
  /_yardoc/
5
- /coverage/
6
9
  /doc/
7
- /pkg/
10
+ /rdoc/
11
+
12
+ ## Testing
13
+ /coverage/
8
14
  /spec/reports/
15
+ /test/tmp/
16
+ /test/version_tmp/
17
+
18
+ ## Build artifacts
19
+ /pkg/
9
20
  /tmp/
21
+ *.gem
22
+
23
+ ## IDE and OS files
24
+ .DS_Store
25
+ .idea/
26
+ .vscode/
27
+ *.swp
28
+ *.swo
29
+ *~
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ ## Environment
34
+ .env
35
+ .env.local
36
+
37
+ ## Logs
38
+ npm-debug.log
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+ Exclude:
6
+ - 'vendor/**/*'
7
+ - 'bin/**/*'
8
+ - 'app/assets/javascripts/fort.js'
9
+
10
+ Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/StringLiterals:
14
+ Enabled: true
15
+ EnforcedStyle: double_quotes
16
+
17
+ Style/FrozenStringLiteralComment:
18
+ Enabled: true
19
+ EnforcedStyle: always
20
+
21
+ Layout/LineLength:
22
+ Max: 120
23
+ Exclude:
24
+ - '*.gemspec'
25
+
26
+ Metrics/BlockLength:
27
+ Exclude:
28
+ - 'spec/**/*'
29
+ - '*.gemspec'
30
+
31
+ Gemspec/DevelopmentDependencies:
32
+ Enabled: false
33
+
34
+ Gemspec/AddRuntimeDependency:
35
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.0] - 2026-05-30
6
+
7
+ First modern release on RubyGems.
8
+
9
+ ### Added
10
+
11
+ - New vanilla JavaScript implementation (`fort.js`) — no jQuery, no `document.body` rewriting
12
+ - `fort.css` as a first-class stylesheet (include via `*= require fort`)
13
+ - Support for `fort-ignore` class in addition to `ignore`
14
+ - Accessible progress bar attributes (`role="progressbar"`, `aria-*`)
15
+ - Explicit `railties` runtime dependency (>= 6.0, < 9.0)
16
+ - GitHub Actions CI, RuboCop, bundler-audit, RSpec
17
+ - CHANGELOG, UPGRADE_GUIDE, and modern README
18
+
19
+ ### Changed
20
+
21
+ - **Breaking (JS):** Replaced legacy vendored `fort.min.js` with `FortProgress` class
22
+ - **Breaking (Ruby):** Minimum Ruby 3.0, Rails 6.0+
23
+ - `config/fort.yml` format unchanged (`type`, `value`, `height`, `duration`, `alignment`)
24
+ - Progress bar DOM uses `.fort-bar` (legacy `.top-one` / `.top-two` classes retained in CSS for compatibility)
25
+
26
+ ### Removed
27
+
28
+ - jQuery dependency
29
+ - Legacy vendor `fort.min.js` and `fort.min.css`
30
+ - Travis CI
31
+
32
+ ### Notes
33
+
34
+ - Original upstream Fort.js GitHub repository is unavailable; JS is maintained in this gem
35
+
36
+ ## [0.2.0] - Previous Release
37
+
38
+ - jQuery-based integration with vendored Fort.js
39
+ - Form completion progress bar with `config/fort.yml`
40
+
41
+ ---
42
+
43
+ For upgrade instructions, see [UPGRADE_GUIDE.md](UPGRADE_GUIDE.md)
data/CODE_OF_CONDUCT.md CHANGED
@@ -11,3 +11,4 @@ Project maintainers have the right and responsibility to remove, edit, or reject
11
11
  Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
12
 
13
13
  This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
14
+
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
- # Specify your gem's dependencies in rails-fort.gemspec
4
5
  gemspec
6
+
7
+ if (rails_version = ENV.fetch("RAILS_VERSION", nil))
8
+ gem "railties", "~> #{rails_version}.0"
9
+ end
data/README.md CHANGED
@@ -1,101 +1,138 @@
1
1
  # Rails::Fort
2
2
 
3
- [![Build Status](https://travis-ci.org/ethirajsrinivasan/rails-fort.svg?branch=master)](https://travis-ci.org/ethirajsrinivasan/rails-fort)
4
- [![Code Climate](https://codeclimate.com/github/ethirajsrinivasan/rails-fort/badges/gpa.svg)](https://codeclimate.com/github/ethirajsrinivasan/rails-fort)
5
- [![security](https://hakiri.io/github/ethirajsrinivasan/rails-fort/master.svg)](https://hakiri.io/github/ethirajsrinivasan/rails-fort/master)
3
+ [![CI](https://github.com/ethirajsrinivasan/rails-fort/actions/workflows/ci.yml/badge.svg)](https://github.com/ethirajsrinivasan/rails-fort/actions/workflows/ci.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/rails-fort.svg)](https://badge.fury.io/rb/rails-fort)
6
5
 
6
+ Modern progress bar for form completion
7
7
 
8
- rails-fort gem gives you modern progress bar for form completion
8
+ ## Requirements
9
+
10
+ - Ruby >= 3.0
11
+ - Rails >= 6.0
12
+ - No jQuery required
9
13
 
10
14
  ## Installation
11
15
 
12
16
  Add this line to your application's Gemfile:
13
17
 
14
18
  ```ruby
15
- gem 'rails-fort'
19
+ gem 'rails-fort', '~> 1.0'
16
20
  ```
17
21
 
18
22
  And then execute:
19
23
 
20
- $ bundle install
24
+ ```bash
25
+ bundle install
26
+ ```
21
27
 
22
- Or install it yourself as:
28
+ ### Asset Pipeline Setup
23
29
 
24
- $ gem install rails-fort
30
+ **For Rails 6.x / 7.x with Sprockets:**
25
31
 
26
- To use this gem add this require statement to your application.js file:
32
+ In `app/assets/javascripts/application.js`:
27
33
 
28
- //= require fort
34
+ ```javascript
35
+ //= require rails_fort
36
+ ```
29
37
 
30
- and in application.css file
38
+ In `app/assets/stylesheets/application.css`:
31
39
 
32
- *= require fort
40
+ ```css
41
+ *= require fort
42
+ ```
33
43
 
44
+ **For Rails 7+ with Import Maps:**
34
45
 
35
- ## Usage
46
+ Add to `config/importmap.rb`:
36
47
 
37
- rails-fort will automatically detect all `<input>` inside form
48
+ ```ruby
49
+ pin "rails_fort", to: "rails_fort.js"
50
+ pin "fort", to: "fort.js"
51
+ ```
38
52
 
39
- Certain fields:
53
+ Import in `application.js`:
40
54
 
41
- If you want to exclude certain fields add a class named 'ignore' to the field. rails-fort will not detect the field after you do so.
55
+ ```javascript
56
+ import "rails_fort"
57
+ ```
42
58
 
43
- Example
59
+ Include `fort.css` through your stylesheet pipeline or asset host.
44
60
 
45
- <input type="text" class='ignore'>
61
+ ## Usage
46
62
 
63
+ Rails-Fort tracks `input`, `textarea`, and `select` fields inside forms and shows a fixed progress bar as the user completes the form.
47
64
 
48
- You can also set default configuration in fort.yml under config folder, example
65
+ ### Exclude fields
49
66
 
50
- height: '20px'
51
- duration: '3s'
52
- alignment: 'bottom'
53
- type: 'solid'
54
- value: '#009DFF'
67
+ Add `ignore` or `fort-ignore` to skip a field:
55
68
 
69
+ ```html
70
+ <input type="text" class="ignore">
71
+ ```
56
72
 
57
- Effects:
73
+ ### Configuration (`config/fort.yml`)
58
74
 
59
- * Solid
75
+ ```yaml
76
+ height: '20px'
77
+ duration: '3s'
78
+ alignment: 'bottom'
79
+ type: 'solid'
80
+ value: '#009DFF'
81
+ ```
60
82
 
61
- type: 'solid'
62
- value: '#009DFF'
83
+ ### Effects
63
84
 
64
- * Gradient
85
+ **Solid**
65
86
 
66
- type: 'gradient'
67
- value: ["#009DFF", "#47B9FF"]
87
+ ```yaml
88
+ type: 'solid'
89
+ value: '#009DFF'
90
+ ```
91
+
92
+ **Gradient** (two colors)
93
+
94
+ ```yaml
95
+ type: 'gradient'
96
+ value: ['#009DFF', '#47B9FF']
97
+ ```
98
+
99
+ **Sections**
68
100
 
69
- Note: Only two values can be passed
101
+ ```yaml
102
+ type: 'sections'
103
+ value: ['#009DFF', '#4AF2A1', '#FB5229']
104
+ ```
70
105
 
71
- * Sections
106
+ **Flash**
72
107
 
73
- type: 'sections'
74
- value: ["#009DFF", "#4AF2A1", "#FB5229"]
108
+ ```yaml
109
+ type: 'flash'
110
+ value: ['#009DFF', '#000', '#6638F0']
111
+ ```
75
112
 
76
- * Flash
113
+ **Merge**
77
114
 
78
- type: 'flash'
79
- value: ["#009DFF", "#000", "#6638F0"]
115
+ ```yaml
116
+ type: 'merge'
117
+ value: '#009DFF'
118
+ ```
80
119
 
81
- * Merge
120
+ ## Upgrading
82
121
 
83
- type: 'merge'
84
- value: '#009DFF'
122
+ Upgrading from the legacy **0.x** gem? See [UPGRADE_GUIDE.md](UPGRADE_GUIDE.md) for **1.0.0**.
85
123
 
86
- effects can be added by changing type and value fields in fort.yml
124
+ ## JavaScript
87
125
 
126
+ The progress bar is implemented in vanilla JavaScript (`app/assets/javascripts/fort.js`) and vendored inside this gem. The original [Fort.js](https://github.com/idriskhenchil/Fort.js) repository by Idris Khenchil is no longer available; this gem maintains a compatible `fort.yml` API with a new implementation.
88
127
 
89
128
  ## Contributing
90
129
 
91
- Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/rails-fort. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
130
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/rails-fort. Contributors are expected to adhere to the [Contributor Covenant](CODE_OF_CONDUCT.md) code of conduct.
92
131
 
93
- ##Thanks
94
-
95
- Thanks to [Idris Khenchil](https://github.com/idriskhenchil/Fort.js) for writing an awesome fort plugin.
132
+ ## Thanks
96
133
 
134
+ Thanks to Idris Khenchil for the original Fort.js form progress bar concept.
97
135
 
98
136
  ## License
99
137
 
100
138
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
101
-
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
  RSpec::Core::RakeTask.new
4
- task :default => :spec
6
+ task default: :spec
data/UPGRADE_GUIDE.md ADDED
@@ -0,0 +1,107 @@
1
+ # Upgrade Guide: Rails-Fort 0.x to 1.0.0
2
+
3
+ ## Overview
4
+
5
+ Rails-Fort **1.0.0** is the first modern release on RubyGems. It combines Ruby/Rails modernization (Ruby 3.0+, Rails 6.0+) with a **rewritten JavaScript engine** while keeping the same `config/fort.yml` format.
6
+
7
+ ## What Changed
8
+
9
+ ### Ruby & Rails
10
+
11
+ | Component | 0.x | 1.0.0 |
12
+ |-----------|-----|-------|
13
+ | Ruby | >= 2.7 (varied) | >= 3.0 |
14
+ | Rails | >= 4.2 | >= 6.0 |
15
+
16
+ ### JavaScript
17
+
18
+ | Topic | 0.x | 1.0.0 |
19
+ |-------|-----|-------|
20
+ | jQuery | Required | **Not required** |
21
+ | Implementation | Vendored legacy `fort.min.js` | New `fort.js` (`FortProgress`) |
22
+ | CSS | Bundled minified vendor file | `*= require fort` in your stylesheet manifest |
23
+ | DOM behavior | Rewrote `document.body` innerHTML | Inserts progress bar elements only |
24
+ | Ignore class | `ignore` | `ignore` or `fort-ignore` |
25
+ | Upstream repo | idriskhenchil/Fort.js (now 404) | Maintained in this gem |
26
+
27
+ ### Unchanged
28
+
29
+ - `config/fort.yml` keys: `height`, `duration`, `alignment`, `type`, `value`
30
+ - Effect types: `solid`, `gradient`, `sections`, `flash`, `merge`
31
+ - `//= require rails_fort` in `application.js`
32
+
33
+ ## Upgrade Steps
34
+
35
+ ### 1. Update Gemfile
36
+
37
+ ```ruby
38
+ gem 'rails-fort', '~> 1.0'
39
+ ```
40
+
41
+ ```bash
42
+ bundle update rails-fort
43
+ ```
44
+
45
+ ### 2. Add stylesheet (new in 1.0)
46
+
47
+ In `app/assets/stylesheets/application.css` (or equivalent):
48
+
49
+ ```css
50
+ *= require fort
51
+ ```
52
+
53
+ ### 3. Remove jQuery requirement
54
+
55
+ You no longer need jQuery for rails-fort. Remove any load order that existed only for this gem.
56
+
57
+ ### 4. Keep `config/fort.yml`
58
+
59
+ Existing configuration should work as-is, for example:
60
+
61
+ ```yaml
62
+ height: '20px'
63
+ duration: '3s'
64
+ alignment: 'bottom'
65
+ type: 'solid'
66
+ value: '#009DFF'
67
+ ```
68
+
69
+ ### 5. Test your forms
70
+
71
+ 1. Load a page with a form
72
+ 2. Confirm the progress bar appears (top or bottom per `alignment`)
73
+ 3. Fill fields and verify width/color effects
74
+ 4. Confirm fields with class `ignore` are skipped
75
+
76
+ ## Troubleshooting
77
+
78
+ ### Progress bar not visible
79
+
80
+ - Ensure **both** JS and CSS are included (`rails_fort` + `fort` stylesheet)
81
+ - Check the browser console for errors
82
+ - Verify `config/fort.yml` is valid YAML
83
+
84
+ ### Custom CSS targeting old markup
85
+
86
+ 1.0 still applies `.top-one` and `.top-two` on bar elements for compatibility. Prefer `.fort-bar` for new custom styles.
87
+
88
+ ### Turbo / Turbolinks
89
+
90
+ Re-initialize on page change if needed:
91
+
92
+ ```javascript
93
+ document.addEventListener("turbo:load", function () {
94
+ if (window._railsFortInstance) {
95
+ window._railsFortInstance.destroy();
96
+ window._railsFortInstance = new FortProgress(/* your config */);
97
+ window._railsFortInstance.init();
98
+ }
99
+ });
100
+ ```
101
+
102
+ For Sprockets-only apps, a full page load re-runs `rails_fort.js.erb` automatically.
103
+
104
+ ## Getting Help
105
+
106
+ - [GitHub Issues](https://github.com/ethirajsrinivasan/rails-fort/issues)
107
+ - [CHANGELOG.md](CHANGELOG.md)