Skip to content

Commit 7e73848

Browse files
Merge pull request #847 from marshall-lee/tracepoint-allow-reentry
Use TracePoint.allow_reentry to support TracePoint events while eval
2 parents ddad523 + ba2240c commit 7e73848

File tree

20 files changed

+215
-57
lines changed

20 files changed

+215
-57
lines changed

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-fast: false
2020

2121
matrix:
22-
version: [2.5.8, 2.6.6, 2.7.2]
22+
version: [2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2]
2323
line_editor: [libedit, readline]
2424
compiler: [clang, gcc]
2525

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require:
77
AllCops:
88
Exclude:
99
- tmp/**/*
10+
- bin/*
1011

1112
DisplayCopNames: true
1213
DisplayStyleGuide: true

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ DEPENDENCIES
5656
yard (= 0.9.26)
5757

5858
BUNDLED WITH
59-
2.2.0.rc.2
59+
2.3.26

bin/bundle

Lines changed: 83 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,114 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'bundle' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
411
require "rubygems"
512

613
m = Module.new do
7-
extend self
14+
module_function
15+
16+
def invoked_as_script?
17+
File.expand_path($0) == File.expand_path(__FILE__)
18+
end
19+
20+
def env_var_version
21+
ENV["BUNDLER_VERSION"]
22+
end
23+
24+
def cli_arg_version
25+
return unless invoked_as_script? # don't want to hijack other binstubs
26+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27+
bundler_version = nil
28+
update_index = nil
29+
ARGV.each_with_index do |a, i|
30+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31+
bundler_version = a
32+
end
33+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34+
bundler_version = $1
35+
update_index = i
36+
end
37+
bundler_version
38+
end
839

940
def gemfile
41+
gemfile = ENV["BUNDLE_GEMFILE"]
42+
return gemfile if gemfile && !gemfile.empty?
43+
1044
File.expand_path("../Gemfile", __dir__)
1145
end
1246

1347
def lockfile
14-
"#{gemfile}.lock"
48+
lockfile =
49+
case File.basename(gemfile)
50+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51+
else "#{gemfile}.lock"
52+
end
53+
File.expand_path(lockfile)
1554
end
1655

1756
def lockfile_version
1857
return unless File.file?(lockfile)
19-
2058
lockfile_contents = File.read(lockfile)
59+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60+
Regexp.last_match(1)
61+
end
2162

22-
regexp = /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
23-
24-
regexp.match(lockfile_contents)[1]
63+
def bundler_requirement
64+
@bundler_requirement ||=
65+
env_var_version || cli_arg_version ||
66+
bundler_requirement_for(lockfile_version)
2567
end
2668

27-
def bundler_version
28-
@bundler_version ||= lockfile_version
69+
def bundler_requirement_for(version)
70+
return "#{Gem::Requirement.default}.a" unless version
71+
72+
bundler_gem_version = Gem::Version.new(version)
73+
74+
requirement = bundler_gem_version.approximate_recommendation
75+
76+
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77+
78+
requirement += ".a" if bundler_gem_version.prerelease?
79+
80+
requirement
2981
end
3082

3183
def load_bundler!
3284
ENV["BUNDLE_GEMFILE"] ||= gemfile
3385

34-
activate_bundler(bundler_version)
86+
activate_bundler
87+
end
88+
89+
def activate_bundler
90+
gem_error = activation_error_handling do
91+
gem "bundler", bundler_requirement
92+
end
93+
return if gem_error.nil?
94+
require_error = activation_error_handling do
95+
require "bundler/version"
96+
end
97+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99+
exit 42
35100
end
36101

37-
def activate_bundler(bundler_version)
38-
gem "bundler", bundler_version
102+
def activation_error_handling
103+
yield
104+
nil
105+
rescue StandardError, LoadError => e
106+
e
39107
end
40108
end
41109

42110
m.load_bundler!
111+
112+
if m.invoked_as_script?
113+
load Gem.bin_path("bundler", "bundle")
114+
end

bin/mdl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
ENV["BUNDLE_GEMFILE"] = File.expand_path("gemfiles/lint/Gemfile")
5-
6-
load File.expand_path("bundle", __dir__)
4+
ENV["BUNDLE_GEMFILE"] = File.expand_path("../gemfiles/lint/Gemfile", __dir__)
75

6+
require "rubygems"
87
require "bundler/setup"
98

109
load Gem.bin_path("mdl", "mdl")

bin/minitest

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
load File.expand_path("bundle", __dir__)
4+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
55

6+
require "rubygems"
67
require "bundler/setup"
78

89
require_relative "../test/minitest_runner"
910

10-
Byebug::MinitestRunner.new.run
11+
exit Byebug::MinitestRunner.new.run

bin/rake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
load File.expand_path("bundle", __dir__)
4+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
55

6+
require "rubygems"
67
require "bundler/setup"
78

89
load Gem.bin_path("rake", "rake")

bin/rubocop

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
ENV["BUNDLE_GEMFILE"] = File.expand_path("gemfiles/lint/Gemfile")
5-
6-
load File.expand_path("bundle", __dir__)
4+
ENV["BUNDLE_GEMFILE"] = File.expand_path("../gemfiles/lint/Gemfile", __dir__)
75

6+
require "rubygems"
87
require "bundler/setup"
98

109
load Gem.bin_path("rubocop", "rubocop")

bin/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -eo pipefail
44

55
set +x
66

7-
gem update --system 3.1.2
8-
gem install bundler --version 2.2.0.rc.2 --force
7+
gem update --system 3.4.20
8+
gem install bundler --version 2.3.26 --force
99

1010
bundle install
1111

docker/manager.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ module Docker
1010
#
1111
class Manager
1212
VERSIONS = %w[
13-
2.5.8
14-
2.6.6
15-
2.7.2
13+
2.5.9
14+
2.6.10
15+
2.7.8
16+
3.0.6
17+
3.1.4
18+
3.2.2
1619
].freeze
1720

1821
LINE_EDITORS = %w[

0 commit comments

Comments
 (0)