rails_accessibility_testing 1.5.1 → 1.5.3

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
2
  SHA256:
3
- metadata.gz: ed1c4100059b21f4a777e9691fec08fe59fc59f7accecc5b8f47e15b68b913ed
4
- data.tar.gz: b65e45644fd839d960ef461b5a3c350903c93ad0a89337f5f3423e2d87b7c57a
3
+ metadata.gz: 58922a0f7334ba5695d55aeb1d02576e975504492d7ae47c1ae37552cba246c3
4
+ data.tar.gz: a07f66b20c17b6da10ef18518d58a20d4de9429f2fac3af7dc9e2505bf3d218e
5
5
  SHA512:
6
- metadata.gz: 827873b27a3a9ee68c39090838d3d422a628567df1134ea4ed807be28b909e5fe3b976fb232493633ed8f521ebf2c94eca8ce051b78b844a86424095ffcc31fc
7
- data.tar.gz: 2f682ff20a50b1a0ec99911f0d260a6fc6400df9aac19451538efe882a7c7dd98582895e8dd151ad4bd1d80ec998a7c86ac6906b22da46beef048f2a7226490c
6
+ metadata.gz: 5f12b4e6da01ca76d1deb3aba955f284915857bf003fa6cb7568b8be05ea78e2eb7dddaf94bbe89fbe665cf99afb951ffbb86517eb3ea4862084b767939e779a
7
+ data.tar.gz: f638f6fbc1a0e4f7f3405f2c49929172d364910ad8140be4b662e823ab3c734fcde487666ae9874d973ec6d2643cb97ca2dc33e4419f805be45b0e2dec8daa2e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.5.3] - 2024-11-20
9
+
10
+ ### Fixed
11
+ - **Gem packaging**: Verified all required files are included in gem package
12
+ - All executables (rails_a11y, rails_server_safe, a11y_live_scanner)
13
+ - All generator templates (.erb files)
14
+ - Complete library files and documentation
15
+
16
+ ### Verified
17
+ - All executables properly included in gemspec
18
+ - Generator templates correctly packaged
19
+ - rails_server_safe Ruby script working correctly
20
+ - Local development setup confirmed working
21
+
22
+ ## [1.5.2] - 2024-11-20
23
+
24
+ ### Fixed
25
+ - **Bundler compatibility**: Converted `rails_server_safe` from shell script to Ruby script to fix Bundler wrapper loading issues
26
+ - **Generator Procfile.dev setup**: Generator now automatically uses `rails_server_safe` in Procfile.dev to prevent Foreman from terminating all processes when server is already running
27
+
28
+ ### Changed
29
+ - Generator behavior: When installing, automatically replaces `web: bin/rails server` with `web: bundle exec rails_server_safe` in existing Procfile.dev files
30
+ - Generator behavior: When creating new Procfile.dev, uses `rails_server_safe` by default
31
+
32
+ ## [1.5.1] - 2024-11-20
33
+
8
34
  ## [1.5.0] - 2025-11-19
9
35
 
10
36
  ### 🎉 Major Release: Enhanced View Detection & Performance Optimizations
@@ -301,6 +327,7 @@ This release introduces significant improvements to view file detection, partial
301
327
  - Compatible with RSpec Rails 6.0+
302
328
  - Modular architecture with rule engine and check definitions
303
329
 
330
+ [1.5.2]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.2
304
331
  [1.5.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.0
305
332
  [1.4.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.3
306
333
  [1.4.2]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.2
data/README.md CHANGED
@@ -99,7 +99,8 @@ This creates:
99
99
  - `config/accessibility.yml` - Check settings
100
100
  - `spec/system/all_pages_accessibility_spec.rb` - Comprehensive spec that dynamically tests all GET routes
101
101
  - Updates `spec/rails_helper.rb` (if using RSpec)
102
- - Updates `Procfile.dev` with accessibility watch command (if present)
102
+ - Updates `Procfile.dev` with live accessibility scanner (if present)
103
+ - Optionally uses `rails_server_safe` wrapper (convenience helper, not required)
103
104
 
104
105
  ### Setup (Option 2: Manual)
105
106
 
@@ -445,6 +446,7 @@ See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed architecture documentation.
445
446
  1. **🎯 Live Accessibility Scanner**
446
447
  - Real-time scanning as you browse during development
447
448
  - Integrated with `bin/dev` via Procfile.dev
449
+ - Uses `rails_server_safe` wrapper to prevent Foreman process termination issues
448
450
  - Smart cancellation when navigating to new pages
449
451
  - Detailed reporting showing exactly what's being scanned
450
452
 
@@ -1,58 +1,66 @@
1
- #!/usr/bin/env sh
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  # Safe wrapper for Rails server that doesn't fail if server is already running
4
5
  # This prevents Foreman from terminating all processes when server is already up
5
6
 
6
- PIDFILE="${PIDFILE:-tmp/pids/server.pid}"
7
- PORT="${PORT:-3000}"
7
+ require 'fileutils'
8
8
 
9
- # Check if PID file exists
10
- if [ -f "$PIDFILE" ]; then
11
- PID=$(cat "$PIDFILE" 2>/dev/null)
9
+ pidfile = ENV.fetch('PIDFILE', 'tmp/pids/server.pid')
10
+ port = ENV.fetch('PORT', '3000').to_i
11
+
12
+ # Check if PID file exists and process is running
13
+ if File.exist?(pidfile)
14
+ pid = File.read(pidfile).strip.to_i rescue nil
12
15
 
13
- # Check if the process is actually running
14
- if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
15
- # Check if it's listening on the expected port
16
- if lsof -ti:$PORT -sTCP:LISTEN | grep -q "^$PID$" 2>/dev/null; then
17
- echo "Server is already running (pid: $PID, port: $PORT)"
18
- echo "Keeping process alive for Foreman..."
19
- # Keep the process alive by waiting indefinitely
20
- # This prevents Foreman from shutting down all processes
21
- while true; do
22
- # Check if the server process is still running
23
- if ! kill -0 "$PID" 2>/dev/null; then
24
- echo "Server process ended. Exiting."
25
- exit 0
26
- fi
27
- sleep 5
28
- done
29
- else
30
- # PID exists but not listening on port - stale PID file
31
- echo "Removing stale PID file (pid: $PID not listening on port $PORT)"
32
- rm -f "$PIDFILE"
33
- fi
34
- else
35
- # PID file exists but process is dead - stale PID file
36
- echo "Removing stale PID file (process $PID not running)"
37
- rm -f "$PIDFILE"
38
- fi
39
- fi
16
+ if pid && pid > 0
17
+ # Check if the process is actually running
18
+ begin
19
+ Process.kill(0, pid)
20
+ # Process is running, check if it's listening on the expected port
21
+ port_check = `lsof -ti:#{port} -sTCP:LISTEN 2>/dev/null`.strip
22
+ if port_check == pid.to_s
23
+ puts "Server is already running (pid: #{pid}, port: #{port})"
24
+ puts "Keeping process alive for Foreman..."
25
+ # Keep the process alive by waiting indefinitely
26
+ loop do
27
+ begin
28
+ Process.kill(0, pid)
29
+ rescue Errno::ESRCH
30
+ puts "Server process ended. Exiting."
31
+ exit 0
32
+ end
33
+ sleep 5
34
+ end
35
+ else
36
+ # PID exists but not listening on port - stale PID file
37
+ puts "Removing stale PID file (pid: #{pid} not listening on port #{port})"
38
+ FileUtils.rm_f(pidfile)
39
+ end
40
+ rescue Errno::ESRCH
41
+ # PID file exists but process is dead - stale PID file
42
+ puts "Removing stale PID file (process #{pid} not running)"
43
+ FileUtils.rm_f(pidfile)
44
+ end
45
+ end
46
+ end
40
47
 
41
48
  # Check if something else is using the port
42
- if lsof -ti:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
43
- EXISTING_PID=$(lsof -ti:$PORT -sTCP:LISTEN | head -1)
44
- echo "Port $PORT is already in use by process $EXISTING_PID"
45
- echo "Server may already be running. Keeping process alive for Foreman..."
49
+ port_check = `lsof -ti:#{port} -sTCP:LISTEN 2>/dev/null`.strip
50
+ if !port_check.empty?
51
+ existing_pid = port_check.split("\n").first.to_i
52
+ puts "Port #{port} is already in use by process #{existing_pid}"
53
+ puts "Server may already be running. Keeping process alive for Foreman..."
46
54
  # Keep the process alive by monitoring the existing server
47
- while true; do
48
- if ! lsof -ti:$PORT -sTCP:LISTEN >/dev/null 2>&1; then
49
- echo "Port $PORT is now free. Exiting so Foreman can restart."
50
- exit 0
51
- fi
55
+ loop do
56
+ port_check = `lsof -ti:#{port} -sTCP:LISTEN 2>/dev/null`.strip
57
+ if port_check.empty?
58
+ puts "Port #{port} is now free. Exiting so Foreman can restart."
59
+ exit 0
60
+ end
52
61
  sleep 5
53
- done
54
- fi
62
+ end
63
+ end
55
64
 
56
65
  # Start the server normally
57
- exec bin/rails server "$@"
58
-
66
+ exec('bin/rails', 'server', *ARGV)
@@ -53,34 +53,49 @@ module RailsA11y
53
53
  end
54
54
  end
55
55
 
56
- def update_procfile_dev
57
- procfile_path = 'Procfile.dev'
58
-
59
- if File.exist?(procfile_path)
60
- procfile_content = File.read(procfile_path)
61
-
62
- # Check if a11y line already exists
63
- unless procfile_content.include?('a11y:')
64
- # Add live scanner to Procfile.dev
65
- a11y_line = "a11y: bundle exec a11y_live_scanner\n"
66
- procfile_content += a11y_line
67
- File.write(procfile_path, procfile_content)
68
- say " Added live accessibility scanner to #{procfile_path}", :green
69
- say " 💡 Run 'bin/dev' to start live scanning as you browse pages", :cyan
70
- else
71
- say "⚠️ Procfile.dev already contains an a11y entry. Skipping.", :yellow
72
- end
73
- else
74
- # Create Procfile.dev if it doesn't exist
75
- procfile_content = <<~PROCFILE
76
- web: bin/rails server
77
- a11y: bundle exec a11y_live_scanner
78
- PROCFILE
79
-
80
- File.write(procfile_path, procfile_content)
81
- say "✅ Created #{procfile_path} with live accessibility scanner", :green
82
- end
83
- end
56
+ def update_procfile_dev
57
+ procfile_path = 'Procfile.dev'
58
+
59
+ if File.exist?(procfile_path)
60
+ procfile_content = File.read(procfile_path)
61
+ modified = false
62
+
63
+ # Update web line to use rails_server_safe if it's using standard rails server
64
+ if procfile_content.match?(/^web:\s*bin\/rails server/)
65
+ procfile_content.gsub!(/^web:\s*bin\/rails server/, 'web: bundle exec rails_server_safe')
66
+ modified = true
67
+ say "✅ Updated web process to use rails_server_safe in #{procfile_path}", :green
68
+ say " 💡 This prevents Foreman from terminating processes when server is already running", :cyan
69
+ end
70
+
71
+ # Check if a11y line already exists
72
+ unless procfile_content.include?('a11y:')
73
+ # Add live scanner to Procfile.dev
74
+ a11y_line = "a11y: bundle exec a11y_live_scanner\n"
75
+ procfile_content += a11y_line
76
+ modified = true
77
+ say "✅ Added live accessibility scanner to #{procfile_path}", :green
78
+ say " 💡 Run 'bin/dev' to start live scanning as you browse pages", :cyan
79
+ else
80
+ say "⚠️ Procfile.dev already contains an a11y entry. Skipping.", :yellow
81
+ end
82
+
83
+ # Save if we made changes
84
+ File.write(procfile_path, procfile_content) if modified
85
+ else
86
+ # Create Procfile.dev if it doesn't exist
87
+ # Use rails_server_safe to prevent Foreman termination issues
88
+ procfile_content = <<~PROCFILE
89
+ web: bundle exec rails_server_safe
90
+ a11y: bundle exec a11y_live_scanner
91
+ PROCFILE
92
+
93
+ File.write(procfile_path, procfile_content)
94
+ say "✅ Created #{procfile_path} with live accessibility scanner", :green
95
+ say " 💡 Using rails_server_safe to prevent Foreman process termination", :cyan
96
+ say " 💡 Run 'bin/dev' to start live scanning as you browse pages", :cyan
97
+ end
98
+ end
84
99
 
85
100
  def update_gitignore
86
101
  gitignore_path = '.gitignore'
@@ -1,4 +1,4 @@
1
1
  module RailsAccessibilityTesting
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.3"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_accessibility_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Regan Maharjan