benchmark_driver 0.16.1 → 0.16.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: 2aa17cc07885ff406870c16844aa57b9230f81a1be2104627af5e21131ba9fb9
4
- data.tar.gz: 6b3d0dfcc8fe50785811a98eb1d62093a90463150aff7eb7d1773c07a9c72391
3
+ metadata.gz: '0286746ad8c7c0b6c5c5eaaa9e224c9a1e62785c55a5285053c9150eb2297f8a'
4
+ data.tar.gz: 9cb1292f11551d0ad1de357532d8ae5b1b6b97ad666395c53e1ebc787221e536
5
5
  SHA512:
6
- metadata.gz: dc65698d4628c758ec49a32769d9f4e86c1b3d2721777227e7bca285c32b75687e7ec05d93351c4df37ed789e1d96fb0e717fe56440b972e34f03ce04341ca9b
7
- data.tar.gz: 139315d91d21b9f86a276a3257eec66bdff8f317dd358619d99a6fcdcafabbe9e1fb9a9837b4607f97dbcc2df911b0d11ac128d228c10c644d7336cecbf396e8
6
+ metadata.gz: 9bb68b47e082eff267c213968ef34684a032bbb93152cb592307114e787480a21237307be72a0b22f553b3a0102547abc662cf00fac0e797c92cc6078aecc34a
7
+ data.tar.gz: a22277c75ef96e21c9dafda77a7d7fbe8ac279dfe7c48cf9c55bb02cd7c74597edc397cac7db24902ab05225f795ec10a0b01618e6fb401f4480a7b8ced3b0d6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.16.3
2
+
3
+ - Unset `GEM_PATH` and `GEM_HOME` in child processes to avoid warnings when using chruby
4
+
5
+ # v0.16.2
6
+
7
+ - Add --chruby option to use a Ruby managed by chruby
8
+
1
9
  # v0.16.1
2
10
 
3
11
  - Add --output-humanize option to --output=simple
data/exe/benchmark-driver CHANGED
@@ -48,6 +48,11 @@ config = BenchmarkDriver::Config.new.tap do |c|
48
48
  executables << BenchmarkDriver::Rbenv.parse_spec(version)
49
49
  end
50
50
  end if system("which rbenv > #{File::NULL} 2>&1")
51
+ o.on('--chruby VERSIONS', String, 'Ruby executables in chruby (x.x.x arg1;y.y.y arg2;...)') do |r|
52
+ r.split(';').each do |version|
53
+ executables << BenchmarkDriver::Chruby.parse_spec(version)
54
+ end
55
+ end if Dir.exist?('/opt/rubies') || Dir.exist?("#{ENV['HOME']}/.rubies")
51
56
  o.on('--rvm VERSIONS', String, 'Ruby executables in rvm (x.x.x arg1;y.y.y arg2;...)') do |r|
52
57
  r.split(';').each do |version|
53
58
  executables << BenchmarkDriver::Rvm.parse_spec(version)
@@ -0,0 +1,27 @@
1
+ require 'shellwords'
2
+
3
+ module BenchmarkDriver
4
+ module Chruby
5
+ # @param [String] version
6
+ def self.ruby_path(version)
7
+ prefix = (Dir.glob('/opt/rubies/*') + Dir.glob("#{ENV['HOME']}/.rubies/*")).find do |dir|
8
+ File.basename(dir) == version
9
+ end
10
+ unless prefix
11
+ abort "Failed to find '#{version}' in /opt/rubies or ~/.rubies"
12
+ end
13
+ "#{prefix}/bin/ruby"
14
+ end
15
+
16
+ # @param [String] full_spec - "2.5.0", "2.5.0 --jit", "JIT::2.5.0 --jit", etc.
17
+ def self.parse_spec(full_spec)
18
+ name, spec = full_spec.split('::', 2)
19
+ spec ||= name # if `::` is not given, use the whole string as spec
20
+ version, *args = spec.shellsplit
21
+ BenchmarkDriver::Config::Executable.new(
22
+ name: name,
23
+ command: [BenchmarkDriver::Chruby.ruby_path(version), *args],
24
+ )
25
+ end
26
+ end
27
+ end
@@ -98,6 +98,16 @@ module BenchmarkDriver
98
98
  end
99
99
 
100
100
  def with_clean_env(&block)
101
+ # chruby sets GEM_HOME and GEM_PATH in your shell. We have to unset it in the child
102
+ # process to avoid installing gems to the version that is running benchmark-driver.
103
+ env = nil
104
+ ['GEM_HOME', 'GEM_PATH'].each do |var|
105
+ if ENV.key?(var)
106
+ env ||= ENV.to_h
107
+ ENV.delete(var)
108
+ end
109
+ end
110
+
101
111
  unless defined?(Gem::Version)
102
112
  # default-gem Bundler can be loaded and broken with --disable-gems
103
113
  return block.call
@@ -115,6 +125,10 @@ module BenchmarkDriver
115
125
  end
116
126
  rescue LoadError
117
127
  block.call
128
+ ensure
129
+ if env
130
+ ENV.replace(env)
131
+ end
118
132
  end
119
133
  end
120
134
  end
@@ -1,3 +1,3 @@
1
1
  module BenchmarkDriver
2
- VERSION = '0.16.1'
2
+ VERSION = '0.16.3'
3
3
  end
@@ -3,6 +3,7 @@ require 'benchmark_driver/config'
3
3
  require 'benchmark_driver/job_parser'
4
4
  require 'benchmark_driver/output'
5
5
  require 'benchmark_driver/rbenv'
6
+ require 'benchmark_driver/chruby'
6
7
  require 'benchmark_driver/rvm'
7
8
  require 'benchmark_driver/repeater'
8
9
  require 'benchmark_driver/ridkuse'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-11 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,6 +100,7 @@ files:
100
100
  - images/optcarrot.png
101
101
  - lib/benchmark_driver.rb
102
102
  - lib/benchmark_driver/bulk_output.rb
103
+ - lib/benchmark_driver/chruby.rb
103
104
  - lib/benchmark_driver/config.rb
104
105
  - lib/benchmark_driver/default_job.rb
105
106
  - lib/benchmark_driver/default_job_parser.rb
@@ -146,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
147
  - !ruby/object:Gem::Version
147
148
  version: '0'
148
149
  requirements: []
149
- rubygems_version: 3.3.7
150
+ rubygems_version: 3.4.1
150
151
  signing_key:
151
152
  specification_version: 4
152
153
  summary: Fully-featured accurate benchmark driver for Ruby