Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ruby version Check #298

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion xprof/xprof.rb.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env ruby


# 2.7 for Lazy in Enumerable. 2.7 was released 25 Dec 2019
THAPI_RUBY_MINIMAL_VERSION = '2.6.0'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new(THAPI_RUBY_MINIMAL_VERSION)
warn("Your ruby version #{RUBY_VERSION} is too old. #{THAPI_RUBY_MINIMAL_VERSION} or newer required")
exit(1)
end

# We Cannot use "@ .. @" for libdir, bindir, and dataroodir
# as they will appear as bash "${exec_prefix}/lib"
# So for now we will rely on them having the default value,
Expand Down Expand Up @@ -226,7 +234,8 @@ def thapi_trace_dir_root
# Use ISO8601 extended format
date = DateTime.now.iso8601

(0..).each do |i|
# Don't use endless range, as it trigger "syntax error" for ruby 2.5...
(0..Float::INFINITY).each do |i|
prefix = i == 0 ? '' : "_#{i}"
thapi_uuid = date + prefix
path = File.join(thapi_trace_home, "thapi#{prefix_processed_trace}--#{thapi_uuid}")
Expand Down