benchmark_driver 0.10.6 → 0.10.7
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/CHANGELOG.md +4 -0
- data/exe/benchmark-driver +1 -1
- data/lib/benchmark_driver/config.rb +13 -0
- data/lib/benchmark_driver/runner/command_stdout.rb +16 -1
- data/lib/benchmark_driver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8346d596ab14db8378d9575ecd00a9efae898170b890c4627cb603d60290c19c
|
4
|
+
data.tar.gz: 21879bf897e059878da0bae0ef0c68dd622fe6086d948d33e18822c36582597d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d612ff00aceaea804a3b0ebaa39c7c6dd5bcd219d26e1e9c855049069e65271c1aa4dfd897502326713cd1e447054ddb39ba47061a0f604402c6b0c039b8107
|
7
|
+
data.tar.gz: 1be94a52f4d63a438bbec19e9c787b2b7c202367102b516784ad7a7d30afc33a3457ad7b3a434012fb739a2be6f95b9289417607d613defe741d4847f6a85a3b
|
data/CHANGELOG.md
CHANGED
data/exe/benchmark-driver
CHANGED
@@ -35,7 +35,7 @@ config = BenchmarkDriver::Config.new.tap do |c|
|
|
35
35
|
name, spec = full_spec.split('::', 2)
|
36
36
|
spec ||= name # if `::` is not given, regard whole string as spec
|
37
37
|
version, *args = spec.split(',')
|
38
|
-
executables << BenchmarkDriver::Config::
|
38
|
+
executables << BenchmarkDriver::Config::RbenvExecutable.new(
|
39
39
|
name: name,
|
40
40
|
command: [BenchmarkDriver::Rbenv.ruby_path(version), *args],
|
41
41
|
)
|
@@ -36,4 +36,17 @@ module BenchmarkDriver
|
|
36
36
|
Config.defaults[:executables] = [
|
37
37
|
BenchmarkDriver::Config::Executable.new(name: RUBY_VERSION, command: [RbConfig.ruby]),
|
38
38
|
]
|
39
|
+
|
40
|
+
class Config::RbenvExecutable < Config::Executable
|
41
|
+
def freeze
|
42
|
+
rbenv_version # avoid `can't modify frozen xxx`
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def rbenv_version
|
47
|
+
return @rbenv_version if defined?(@rbenv_version)
|
48
|
+
match = command.first.match(%r[/(?<version>[^/]+)/bin/ruby\z])
|
49
|
+
@rbenv_version = match && match[:version]
|
50
|
+
end
|
51
|
+
end
|
39
52
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'benchmark_driver/struct'
|
2
2
|
require 'benchmark_driver/metrics'
|
3
|
+
require 'benchmark_driver/rbenv'
|
3
4
|
require 'tempfile'
|
4
5
|
require 'shellwords'
|
5
6
|
require 'open3'
|
@@ -61,7 +62,7 @@ class BenchmarkDriver::Runner::CommandStdout
|
|
61
62
|
@config.executables.each do |exec|
|
62
63
|
best_value = with_repeat(metrics_type) do
|
63
64
|
stdout = with_chdir(job.working_directory) do
|
64
|
-
execute(*exec.command, *job.command)
|
65
|
+
with_rbenv_version(exec) { execute(*exec.command, *job.command) }
|
65
66
|
end
|
66
67
|
StdoutToMetrics.new(
|
67
68
|
stdout: stdout,
|
@@ -83,6 +84,20 @@ class BenchmarkDriver::Runner::CommandStdout
|
|
83
84
|
|
84
85
|
private
|
85
86
|
|
87
|
+
def with_rbenv_version(executable, &block)
|
88
|
+
if executable.is_a?(BenchmarkDriver::Config::RbenvExecutable) && executable.rbenv_version
|
89
|
+
begin
|
90
|
+
env = ENV.to_h.dup
|
91
|
+
ENV['RBENV_VERSION'] = executable.rbenv_version
|
92
|
+
block.call
|
93
|
+
ensure
|
94
|
+
ENV.replace(env)
|
95
|
+
end
|
96
|
+
else
|
97
|
+
block.call
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
86
101
|
def with_chdir(working_directory, &block)
|
87
102
|
if working_directory
|
88
103
|
Dir.chdir(working_directory) { block.call }
|
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.10.
|
4
|
+
version: 0.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|