sentry-rails 6.6.2 → 6.7.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 +4 -4
- data/.gitignore +1 -1
- data/Gemfile +50 -0
- data/README.md +1 -1
- data/bin/test +12 -386
- data/bin/test_old +389 -0
- data/gemfiles/ruby-2.7_rails-5.2.0.gemfile.lock +266 -0
- data/gemfiles/ruby-2.7_rails-6.0.0.gemfile.lock +282 -0
- data/gemfiles/ruby-2.7_rails-6.1.0.gemfile.lock +294 -0
- data/gemfiles/ruby-2.7_rails-7.0.0.gemfile.lock +311 -0
- data/gemfiles/ruby-2.7_rails-7.1.0.gemfile.lock +348 -0
- data/gemfiles/ruby-3.0_rails-6.1.0.gemfile.lock +362 -0
- data/gemfiles/ruby-3.0_rails-7.0.0.gemfile.lock +379 -0
- data/gemfiles/ruby-3.0_rails-7.1.0.gemfile.lock +405 -0
- data/gemfiles/ruby-3.1_rails-6.1.0.gemfile.lock +493 -0
- data/gemfiles/ruby-3.1_rails-7.0.0.gemfile.lock +513 -0
- data/gemfiles/ruby-3.1_rails-7.1.0.gemfile.lock +547 -0
- data/gemfiles/ruby-3.1_rails-7.2.0.gemfile.lock +541 -0
- data/gemfiles/ruby-3.2_rails-6.1.0.gemfile.lock +493 -0
- data/gemfiles/ruby-3.2_rails-7.0.0.gemfile.lock +511 -0
- data/gemfiles/ruby-3.2_rails-7.1.0.gemfile.lock +553 -0
- data/gemfiles/ruby-3.2_rails-7.2.0.gemfile.lock +545 -0
- data/gemfiles/ruby-3.2_rails-8.0.0.gemfile.lock +544 -0
- data/gemfiles/ruby-3.3_rails-6.1.0.gemfile.lock +493 -0
- data/gemfiles/ruby-3.3_rails-7.0.0.gemfile.lock +511 -0
- data/gemfiles/ruby-3.3_rails-7.1.0.gemfile.lock +553 -0
- data/gemfiles/ruby-3.3_rails-7.2.0.gemfile.lock +545 -0
- data/gemfiles/ruby-3.3_rails-8.0.0.gemfile.lock +544 -0
- data/gemfiles/ruby-3.4_rails-7.1.0.gemfile.lock +534 -0
- data/gemfiles/ruby-3.4_rails-7.2.0.gemfile.lock +528 -0
- data/gemfiles/ruby-3.4_rails-8.0.0.gemfile.lock +523 -0
- data/gemfiles/ruby-3.4_rails-8.1.3.gemfile.lock +527 -0
- data/gemfiles/ruby-4.0_rails-6.1.0.gemfile.lock +476 -0
- data/gemfiles/ruby-4.0_rails-7.0.0.gemfile.lock +492 -0
- data/gemfiles/ruby-4.0_rails-7.1.0.gemfile.lock +534 -0
- data/gemfiles/ruby-4.0_rails-8.0.0.gemfile.lock +523 -0
- data/gemfiles/ruby-4.0_rails-8.1.3.gemfile.lock +527 -0
- data/gemfiles/ruby-jruby-9.4.14.0_rails-6.1.0.gemfile.lock +369 -0
- data/gemfiles/ruby-jruby-9.4.14.0_rails-7.0.0.gemfile.lock +391 -0
- data/gemfiles/ruby-jruby-9.4.14.0_rails-7.1.0.gemfile.lock +425 -0
- data/lib/sentry/rails/active_job.rb +177 -24
- data/lib/sentry/rails/capture_exceptions.rb +5 -1
- data/lib/sentry/rails/configuration.rb +6 -0
- data/lib/sentry/rails/error_reporter_context.rb +26 -0
- data/lib/sentry/rails/railtie.rb +7 -0
- data/lib/sentry/rails/serializer.rb +35 -0
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +2 -2
- metadata +45 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c85c3cd23ce9e1d1cc8487220a8669e462dd01318d0309cec4af19289d9840c4
|
|
4
|
+
data.tar.gz: 30d3605a772942de5b36aa561a0780b1d697bd274c012a0168e49334ab88e71e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4af8635e17a8f79ffe219a155ab68b8077f24966fa0ea42383e26e484fbfdea8d7ddf63e9959ed627023a9209cf62dc1522953797cef8e324bf4402b5954bd6f
|
|
7
|
+
data.tar.gz: 67cc6cd95888b69e8c18d24fdb8b34184977ccce450a1e66b2610b71a49ee3339843eeded930180b1a6aa7144ecc7ab23e9ad33bd0eeace72669f785a68c46af
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
|
@@ -32,13 +32,16 @@ gem "rails", "~> #{rails_version}"
|
|
|
32
32
|
|
|
33
33
|
if rails_version >= Gem::Version.new("8.1.0")
|
|
34
34
|
gem "rspec-rails", "~> 8.0.0"
|
|
35
|
+
gem "solid_queue"
|
|
35
36
|
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
36
37
|
elsif rails_version >= Gem::Version.new("8.0.0")
|
|
37
38
|
gem "rspec-rails", "~> 8.0.0"
|
|
39
|
+
gem "solid_queue"
|
|
38
40
|
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
39
41
|
elsif rails_version >= Gem::Version.new("7.1.0")
|
|
40
42
|
gem "psych", "~> 4.0.0"
|
|
41
43
|
gem "rspec-rails", "~> 7.0"
|
|
44
|
+
gem "solid_queue"
|
|
42
45
|
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
43
46
|
elsif rails_version >= Gem::Version.new("6.1.0")
|
|
44
47
|
gem "rspec-rails", "~> 6.0"
|
|
@@ -56,6 +59,53 @@ end
|
|
|
56
59
|
|
|
57
60
|
gem "mini_magick"
|
|
58
61
|
|
|
62
|
+
# Sidekiq is a dev-only dependency, used by the common ActiveJob spec
|
|
63
|
+
# suite to verify the AJ tracing extension works against the :sidekiq
|
|
64
|
+
# adapter independent of sentry-sidekiq's native middleware.
|
|
65
|
+
#
|
|
66
|
+
# Gated on Ruby/Rails/platform because:
|
|
67
|
+
# - The sidekiq_adapter_spec only passes on Rails > 7.0.
|
|
68
|
+
# - Sidekiq 8 requires Ruby >= 3.2; older Rubies fall back to Sidekiq 7.
|
|
69
|
+
# - Sidekiq does not reliably support JRuby.
|
|
70
|
+
#
|
|
71
|
+
# sidekiq_adapter_spec.rb also rescues LoadError and re-checks the
|
|
72
|
+
# Rails version, so matrices that don't bundle Sidekiq skip the spec
|
|
73
|
+
# cleanly without any other gating.
|
|
74
|
+
unless RUBY_PLATFORM.include?("java")
|
|
75
|
+
if rails_version > Gem::Version.new("7.0.0") && ruby_version >= Gem::Version.new("3.2")
|
|
76
|
+
gem "sidekiq", "~> 8.0"
|
|
77
|
+
elsif rails_version > Gem::Version.new("7.0.0")
|
|
78
|
+
gem "sidekiq", "~> 7.0"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# delayed_job and resque are dev-only dependencies, used by the common
|
|
83
|
+
# ActiveJob spec suite to verify the AJ tracing extension works against
|
|
84
|
+
# the :delayed_job and :resque adapters independent of the dedicated
|
|
85
|
+
# sentry-delayed_job / sentry-resque integrations.
|
|
86
|
+
#
|
|
87
|
+
# Both spec files rescue LoadError and skip cleanly on matrices that
|
|
88
|
+
# don't bundle the gem, so the gating below only needs to keep
|
|
89
|
+
# `bundle install` resolvable — it doesn't have to be exact.
|
|
90
|
+
unless RUBY_PLATFORM.include?("java")
|
|
91
|
+
# delayed_job is backed by ActiveRecord here (delayed_job_active_record),
|
|
92
|
+
# reusing the dummy app's SQLite database. It supports every Ruby/Rails
|
|
93
|
+
# combination in the matrix.
|
|
94
|
+
gem "delayed_job"
|
|
95
|
+
gem "delayed_job_active_record"
|
|
96
|
+
|
|
97
|
+
# resque has no in-memory test mode, so the spec drives it through
|
|
98
|
+
# mock_redis instead of a live Redis (mirroring how the sidekiq context
|
|
99
|
+
# uses Sidekiq's fake mode). resque 3 / resque-scheduler 5 / mock_redis
|
|
100
|
+
# all require Ruby >= 3.0, so gate them on that — older matrices skip
|
|
101
|
+
# the resque spec via its LoadError rescue.
|
|
102
|
+
if ruby_version >= Gem::Version.new("3.0")
|
|
103
|
+
gem "resque"
|
|
104
|
+
gem "resque-scheduler", "~> 5.0"
|
|
105
|
+
gem "mock_redis"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
59
109
|
gem "sprockets-rails"
|
|
60
110
|
|
|
61
111
|
gem "benchmark-ips"
|
data/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
[](https://rubygems.org/gems/sentry-rails)
|
|
14
|
-

|
|
15
15
|
[](https://codecov.io/gh/getsentry/sentry-ruby/branch/master)
|
|
16
16
|
[](https://rubygems.org/gems/sentry-rails/)
|
|
17
17
|
[](https://dependabot.com/compatibility-score.html?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver)
|
data/bin/test
CHANGED
|
@@ -1,389 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# FEATURES:
|
|
8
|
-
# - Dedicated lock files for each Ruby/Rails version combination
|
|
9
|
-
# - Prevents dependency conflicts between different Rails versions
|
|
10
|
-
# - Automatic lock file management and restoration
|
|
11
|
-
# - Clean up functionality for old lock files
|
|
3
|
+
# Thin wrapper so you can run this gem's specs from inside its own directory:
|
|
4
|
+
# forwards to the repo-root bin/test scoped to this gem (--gem <thisgem>). All
|
|
5
|
+
# args pass through, so spec paths and flags work as documented there.
|
|
12
6
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
7
|
+
# bin/test # auto-pick the newest installed Ruby cell
|
|
8
|
+
# bin/test spec/.../foo_spec.rb # forward args to rspec
|
|
9
|
+
# bin/test --cell <path> # pin an exact cell
|
|
10
|
+
# bin/test --rake # run `bundle exec rake` like CI
|
|
17
11
|
#
|
|
18
|
-
#
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
require 'optparse'
|
|
24
|
-
require 'fileutils'
|
|
25
|
-
|
|
26
|
-
class RailsVersionTester
|
|
27
|
-
SUPPORTED_VERSIONS = %w[5.2 6.0 6.1 7.0 7.1 7.2 8.0 8.1].freeze
|
|
28
|
-
|
|
29
|
-
def initialize
|
|
30
|
-
@options = {}
|
|
31
|
-
@failed_versions = []
|
|
32
|
-
@ruby_version = RUBY_VERSION
|
|
33
|
-
@spec_paths = []
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def run(args)
|
|
37
|
-
parse_options(args)
|
|
38
|
-
|
|
39
|
-
case
|
|
40
|
-
when @options[:help]
|
|
41
|
-
show_help
|
|
42
|
-
when @options[:list]
|
|
43
|
-
list_versions
|
|
44
|
-
when @options[:clean]
|
|
45
|
-
clean_lock_files
|
|
46
|
-
when @options[:all]
|
|
47
|
-
test_all_versions
|
|
48
|
-
when @options[:version]
|
|
49
|
-
test_single_version(@options[:version])
|
|
50
|
-
else
|
|
51
|
-
puts "Error: No action specified. Use --help for usage information."
|
|
52
|
-
exit(1)
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
def parse_options(args)
|
|
59
|
-
OptionParser.new do |opts|
|
|
60
|
-
opts.banner = "Usage: #{$0} [options] [spec_paths...]"
|
|
61
|
-
|
|
62
|
-
opts.on("-v", "--version VERSION", "Test specific Rails version") do |version|
|
|
63
|
-
unless SUPPORTED_VERSIONS.include?(version)
|
|
64
|
-
puts "Error: Unsupported Rails version '#{version}'"
|
|
65
|
-
puts "Supported versions: #{SUPPORTED_VERSIONS.join(', ')}"
|
|
66
|
-
exit(1)
|
|
67
|
-
end
|
|
68
|
-
@options[:version] = version
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
opts.on("-a", "--all", "Test all supported Rails versions") do
|
|
72
|
-
@options[:all] = true
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
opts.on("-l", "--list", "List supported Rails versions and lock file status") do
|
|
76
|
-
@options[:list] = true
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
opts.on("-c", "--clean", "Clean up old lock files for current Ruby version") do
|
|
80
|
-
@options[:clean] = true
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
opts.on("-h", "--help", "Show this help message") do
|
|
84
|
-
@options[:help] = true
|
|
85
|
-
end
|
|
86
|
-
end.parse!(args)
|
|
87
|
-
|
|
88
|
-
# Remaining arguments are spec paths
|
|
89
|
-
@spec_paths = args
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def show_help
|
|
93
|
-
puts <<~HELP
|
|
94
|
-
Rails Version Tester for sentry-rails
|
|
95
|
-
|
|
96
|
-
This script tests sentry-rails against different Rails versions by:
|
|
97
|
-
1. Setting the RAILS_VERSION environment variable
|
|
98
|
-
2. Managing bundle dependencies with dedicated lock files per Ruby/Rails combination
|
|
99
|
-
3. Running the test suite in isolated processes
|
|
100
|
-
4. Providing proper exit codes for CI/CD integration
|
|
101
|
-
|
|
102
|
-
Each Ruby/Rails version combination gets its own Gemfile.lock to prevent conflicts:
|
|
103
|
-
- Ruby #{@ruby_version} + Rails 6.1 → Gemfile-ruby-#{@ruby_version}-rails-6.1.lock
|
|
104
|
-
- Ruby #{@ruby_version} + Rails 7.0 → Gemfile-ruby-#{@ruby_version}-rails-7.0.lock
|
|
105
|
-
|
|
106
|
-
Usage:
|
|
107
|
-
#{$0} --version 6.1 # Test specific Rails version (all specs)
|
|
108
|
-
#{$0} --version 7.0 spec/sentry/rails/log_subscribers # Test specific Rails version with specific specs
|
|
109
|
-
#{$0} --all # Test all supported versions
|
|
110
|
-
#{$0} --list # List supported versions and lock file status
|
|
111
|
-
#{$0} --clean # Clean up old lock files for current Ruby version
|
|
112
|
-
#{$0} --help # Show this help
|
|
113
|
-
|
|
114
|
-
Supported Rails versions: #{SUPPORTED_VERSIONS.join(', ')}
|
|
115
|
-
|
|
116
|
-
Examples:
|
|
117
|
-
#{$0} -v 7.1 # Test Rails 7.1 (all specs)
|
|
118
|
-
#{$0} -v 7.0 spec/sentry/rails/log_subscribers # Test Rails 7.0 log subscriber specs only
|
|
119
|
-
#{$0} -v 7.0 spec/sentry/rails/tracing # Test Rails 7.0 tracing specs only
|
|
120
|
-
#{$0} -a # Test all versions
|
|
121
|
-
#{$0} -c # Clean up old lock files
|
|
122
|
-
HELP
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def list_versions
|
|
126
|
-
puts "Supported Rails versions:"
|
|
127
|
-
SUPPORTED_VERSIONS.each do |version|
|
|
128
|
-
lock_file = generate_lock_file_name(version)
|
|
129
|
-
status = File.exist?(lock_file) ? "(has lock file)" : "(no lock file)"
|
|
130
|
-
puts " - #{version} #{status}"
|
|
131
|
-
end
|
|
132
|
-
puts
|
|
133
|
-
puts "Current Ruby version: #{@ruby_version}"
|
|
134
|
-
puts "Lock files are stored as: Gemfile-ruby-X.X.X-rails-Y.Y.lock"
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def test_all_versions
|
|
138
|
-
puts "Testing sentry-rails against all supported Rails versions: #{SUPPORTED_VERSIONS.join(', ')}"
|
|
139
|
-
puts
|
|
140
|
-
|
|
141
|
-
SUPPORTED_VERSIONS.each do |version|
|
|
142
|
-
puts "=" * 60
|
|
143
|
-
puts "Testing Rails #{version}"
|
|
144
|
-
puts "=" * 60
|
|
145
|
-
|
|
146
|
-
exit_code = test_rails_version(version)
|
|
147
|
-
|
|
148
|
-
if exit_code == 0
|
|
149
|
-
puts "✓ Rails #{version} - PASSED"
|
|
150
|
-
else
|
|
151
|
-
puts "✗ Rails #{version} - FAILED (exit code: #{exit_code})"
|
|
152
|
-
@failed_versions << version
|
|
153
|
-
end
|
|
154
|
-
puts
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
print_summary
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def test_single_version(version)
|
|
161
|
-
puts "Testing sentry-rails against Rails #{version}..."
|
|
162
|
-
exit_code = test_rails_version(version)
|
|
163
|
-
exit(exit_code) unless exit_code == 0
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def test_rails_version(version)
|
|
167
|
-
puts "Setting up environment for Rails #{version}..."
|
|
168
|
-
|
|
169
|
-
# Generate dedicated lock file name for this Ruby/Rails combination
|
|
170
|
-
dedicated_lock_file = generate_lock_file_name(version)
|
|
171
|
-
current_lock_file = "Gemfile.lock"
|
|
172
|
-
|
|
173
|
-
# Set up environment variables
|
|
174
|
-
env = {
|
|
175
|
-
"RAILS_VERSION" => version,
|
|
176
|
-
"BUNDLE_GEMFILE" => File.expand_path("Gemfile", Dir.pwd)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
puts "Using dedicated lock file: #{dedicated_lock_file}"
|
|
180
|
-
|
|
181
|
-
# Manage lock file switching
|
|
182
|
-
setup_lock_file(dedicated_lock_file, current_lock_file)
|
|
183
|
-
|
|
184
|
-
begin
|
|
185
|
-
# Check if bundle update is needed
|
|
186
|
-
if bundle_update_needed?(env, dedicated_lock_file)
|
|
187
|
-
puts "Dependencies need to be updated for Rails #{version}..."
|
|
188
|
-
unless update_bundle(env, dedicated_lock_file)
|
|
189
|
-
puts "✗ Failed to update bundle for Rails #{version}"
|
|
190
|
-
return 1
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
# Run the tests in a separate process
|
|
195
|
-
puts "Running test suite..."
|
|
196
|
-
run_tests(env, @spec_paths)
|
|
197
|
-
ensure
|
|
198
|
-
# Save the current lock file back to the dedicated location
|
|
199
|
-
save_lock_file(dedicated_lock_file, current_lock_file)
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
def generate_lock_file_name(rails_version)
|
|
204
|
-
# Create a unique lock file name for this Ruby/Rails combination
|
|
205
|
-
ruby_version_clean = @ruby_version.gsub(/[^\d\.]/, '')
|
|
206
|
-
rails_version_clean = rails_version.gsub(/[^\d\.]/, '')
|
|
207
|
-
"Gemfile-ruby-#{ruby_version_clean}-rails-#{rails_version_clean}.lock"
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
def setup_lock_file(dedicated_lock_file, current_lock_file)
|
|
211
|
-
# If we have a dedicated lock file, copy it to the current location
|
|
212
|
-
if File.exist?(dedicated_lock_file)
|
|
213
|
-
puts "Restoring lock file from #{dedicated_lock_file}"
|
|
214
|
-
FileUtils.cp(dedicated_lock_file, current_lock_file)
|
|
215
|
-
elsif File.exist?(current_lock_file)
|
|
216
|
-
# If no dedicated lock file exists but current one does, remove it
|
|
217
|
-
# so we get a fresh resolution
|
|
218
|
-
puts "Removing existing lock file for fresh dependency resolution"
|
|
219
|
-
File.delete(current_lock_file)
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
def save_lock_file(dedicated_lock_file, current_lock_file)
|
|
224
|
-
# Save the current lock file to the dedicated location
|
|
225
|
-
if File.exist?(current_lock_file)
|
|
226
|
-
puts "Saving lock file to #{dedicated_lock_file}"
|
|
227
|
-
FileUtils.cp(current_lock_file, dedicated_lock_file)
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
def bundle_update_needed?(env, dedicated_lock_file)
|
|
232
|
-
# Check if current Gemfile.lock exists
|
|
233
|
-
current_lock_file = "Gemfile.lock"
|
|
234
|
-
gemfile_path = env["BUNDLE_GEMFILE"] || "Gemfile"
|
|
235
|
-
|
|
236
|
-
return true unless File.exist?(current_lock_file)
|
|
237
|
-
|
|
238
|
-
# Check if Gemfile is newer than the current lock file
|
|
239
|
-
return true if File.mtime(gemfile_path) > File.mtime(current_lock_file)
|
|
240
|
-
|
|
241
|
-
# For Rails version changes, check if lockfile has incompatible Rails version
|
|
242
|
-
if env["RAILS_VERSION"] && lockfile_has_incompatible_rails_version?(current_lock_file, env["RAILS_VERSION"])
|
|
243
|
-
return true
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
# Check if bundle check passes
|
|
247
|
-
system(env, "bundle check > /dev/null 2>&1") == false
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
def lockfile_has_incompatible_rails_version?(lockfile_path, target_rails_version)
|
|
251
|
-
return false unless File.exist?(lockfile_path)
|
|
252
|
-
|
|
253
|
-
lockfile_content = File.read(lockfile_path)
|
|
254
|
-
|
|
255
|
-
# Extract Rails version from lockfile
|
|
256
|
-
if lockfile_content =~ /^\s*rails \(([^)]+)\)/
|
|
257
|
-
locked_rails_version = $1
|
|
258
|
-
target_major_minor = target_rails_version.split('.')[0..1].join('.')
|
|
259
|
-
locked_major_minor = locked_rails_version.split('.')[0..1].join('.')
|
|
260
|
-
|
|
261
|
-
# If major.minor versions don't match, we need to update
|
|
262
|
-
return target_major_minor != locked_major_minor
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
# If we can't determine the Rails version, assume update is needed
|
|
266
|
-
true
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
def update_bundle(env, dedicated_lock_file)
|
|
270
|
-
puts "Updating bundle for Rails #{env['RAILS_VERSION']}..."
|
|
271
|
-
|
|
272
|
-
current_lock_file = "Gemfile.lock"
|
|
273
|
-
|
|
274
|
-
# Try bundle update first
|
|
275
|
-
if system(env, "bundle update --quiet")
|
|
276
|
-
puts "Bundle updated successfully"
|
|
277
|
-
return true
|
|
278
|
-
end
|
|
279
|
-
|
|
280
|
-
puts "Bundle update failed, trying clean install..."
|
|
281
|
-
|
|
282
|
-
# Remove the current lockfile and try fresh install
|
|
283
|
-
File.delete(current_lock_file) if File.exist?(current_lock_file)
|
|
284
|
-
|
|
285
|
-
if system(env, "bundle install --quiet")
|
|
286
|
-
puts "Bundle installed successfully"
|
|
287
|
-
return true
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
puts "Bundle install failed"
|
|
291
|
-
false
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def run_tests(env, spec_paths = [])
|
|
295
|
-
# Determine the command to run
|
|
296
|
-
if spec_paths.empty?
|
|
297
|
-
# Run all tests via rake
|
|
298
|
-
command = "bundle exec rake"
|
|
299
|
-
else
|
|
300
|
-
# Run specific specs via rspec
|
|
301
|
-
command = "bundle exec rspec #{spec_paths.join(' ')}"
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
puts "Executing: #{command}"
|
|
305
|
-
|
|
306
|
-
# Run the tests in a separate process with proper signal handling
|
|
307
|
-
pid = spawn(env, command,
|
|
308
|
-
out: $stdout,
|
|
309
|
-
err: $stderr,
|
|
310
|
-
pgroup: true)
|
|
311
|
-
|
|
312
|
-
begin
|
|
313
|
-
_, status = Process.wait2(pid)
|
|
314
|
-
status.exitstatus
|
|
315
|
-
rescue Interrupt
|
|
316
|
-
puts "\nInterrupted! Terminating test process..."
|
|
317
|
-
terminate_process_group(pid)
|
|
318
|
-
130 # Standard exit code for SIGINT
|
|
319
|
-
end
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
def terminate_process_group(pid)
|
|
323
|
-
begin
|
|
324
|
-
Process.kill("TERM", -pid) # Kill the process group
|
|
325
|
-
sleep(2)
|
|
326
|
-
Process.kill("KILL", -pid) if process_running?(pid)
|
|
327
|
-
rescue Errno::ESRCH
|
|
328
|
-
# Process already terminated
|
|
329
|
-
end
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
def process_running?(pid)
|
|
333
|
-
Process.getpgid(pid)
|
|
334
|
-
true
|
|
335
|
-
rescue Errno::ESRCH
|
|
336
|
-
false
|
|
337
|
-
end
|
|
338
|
-
|
|
339
|
-
def clean_lock_files
|
|
340
|
-
puts "Cleaning up lock files for Ruby #{@ruby_version}..."
|
|
341
|
-
|
|
342
|
-
# Find all lock files matching our pattern
|
|
343
|
-
pattern = "Gemfile-ruby-#{@ruby_version.gsub(/[^\d\.]/, '')}-rails-*.lock"
|
|
344
|
-
lock_files = Dir.glob(pattern)
|
|
345
|
-
|
|
346
|
-
if lock_files.empty?
|
|
347
|
-
puts "No lock files found matching pattern: #{pattern}"
|
|
348
|
-
return
|
|
349
|
-
end
|
|
350
|
-
|
|
351
|
-
puts "Found #{lock_files.length} lock file(s):"
|
|
352
|
-
lock_files.each { |file| puts " - #{file}" }
|
|
353
|
-
|
|
354
|
-
print "Delete these files? [y/N]: "
|
|
355
|
-
response = $stdin.gets.chomp.downcase
|
|
356
|
-
|
|
357
|
-
if response == 'y' || response == 'yes'
|
|
358
|
-
lock_files.each do |file|
|
|
359
|
-
File.delete(file)
|
|
360
|
-
puts "Deleted: #{file}"
|
|
361
|
-
end
|
|
362
|
-
puts "Cleanup complete!"
|
|
363
|
-
else
|
|
364
|
-
puts "Cleanup cancelled."
|
|
365
|
-
end
|
|
366
|
-
end
|
|
367
|
-
|
|
368
|
-
def print_summary
|
|
369
|
-
puts "=" * 60
|
|
370
|
-
puts "SUMMARY"
|
|
371
|
-
puts "=" * 60
|
|
372
|
-
|
|
373
|
-
if @failed_versions.empty?
|
|
374
|
-
puts "✓ All Rails versions passed!"
|
|
375
|
-
exit(0)
|
|
376
|
-
else
|
|
377
|
-
puts "✗ Failed versions: #{@failed_versions.join(', ')}"
|
|
378
|
-
puts
|
|
379
|
-
puts "Some Rails versions failed. See output above for details."
|
|
380
|
-
exit(1)
|
|
381
|
-
end
|
|
382
|
-
end
|
|
383
|
-
end
|
|
384
|
-
|
|
385
|
-
# Run the script if called directly
|
|
386
|
-
if __FILE__ == $0
|
|
387
|
-
tester = RailsVersionTester.new
|
|
388
|
-
tester.run(ARGV)
|
|
389
|
-
end
|
|
12
|
+
# See `../../bin/test --help` for the full interface.
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
gem_dir="$(cd "$(dirname "$0")/.." && pwd)"
|
|
15
|
+
exec "$(dirname "$gem_dir")/bin/test" --gem "$(basename "$gem_dir")" "$@"
|