ruby-changes:55941
From: Benoit <ko1@a...>
Date: Sat, 1 Jun 2019 02:03:25 +0900 (JST)
Subject: [ruby-changes:55941] Benoit Daloze: f97979ce88 (trunk): Update to ruby/mspec@a57a9af
https://git.ruby-lang.org/ruby.git/commit/?id=f97979ce88 From f97979ce888492cbf1c3c92839e086fbec1e5d15 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Fri, 31 May 2019 19:02:06 +0200 Subject: Update to ruby/mspec@a57a9af diff --git a/spec/mspec/lib/mspec/helpers/ruby_exe.rb b/spec/mspec/lib/mspec/helpers/ruby_exe.rb index 4704845..6d5470b 100644 --- a/spec/mspec/lib/mspec/helpers/ruby_exe.rb +++ b/spec/mspec/lib/mspec/helpers/ruby_exe.rb @@ -2,11 +2,12 @@ require 'mspec/guards/platform' https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L2 require 'mspec/helpers/tmp' # The ruby_exe helper provides a wrapper for invoking the -# same Ruby interpreter with the same falgs as the one running +# same Ruby interpreter with the same flags as the one running # the specs and getting the output from running the code. +# # If +code+ is a file that exists, it will be run. -# Otherwise, +code+ should be Ruby code that will be run with -# the -e command line option. For example: +# Otherwise, +code+ will be written to a temporary file and be run. +# For example: # # ruby_exe('path/to/some/file.rb') # @@ -14,24 +15,16 @@ require 'mspec/helpers/tmp' https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L15 # # `#{RUBY_EXE} 'path/to/some/file.rb'` # -# while -# -# ruby_exe('puts "hello, world."') -# -# will be executed as -# -# `#{RUBY_EXE} -e 'puts "hello, world."'` -# # The ruby_exe helper also accepts an options hash with three # keys: :options, :args and :env. For example: # # ruby_exe('file.rb', :options => "-w", -# :args => "> file.txt", +# :args => "arg1 arg2", # :env => { :FOO => "bar" }) # # will be executed as # -# `#{RUBY_EXE} -w #{'file.rb'} > file.txt` +# `#{RUBY_EXE} -w file.rb arg1 arg2` # # with access to ENV["FOO"] with value "bar". # @@ -49,33 +42,11 @@ require 'mspec/helpers/tmp' https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L42 # The RUBY_EXE constant is setup by mspec automatically # and is used by ruby_exe and ruby_cmd. The mspec runner script # will set ENV['RUBY_EXE'] to the name of the executable used -# to invoke the mspec-run script. The value of RUBY_EXE will be -# constructed as follows: -# -# 1. the value of ENV['RUBY_EXE'] -# 2. an explicit value based on RUBY_ENGINE -# 3. cwd/(RUBY_ENGINE + $(EXEEXT) || $(exeext) || '') -# 4. $(bindir)/$(RUBY_INSTALL_NAME) +# to invoke the mspec-run script. # # The value will only be used if the file exists and is executable. -# The flags will then be appended to the resulting value. -# -# These 4 ways correspond to the following scenarios: -# -# 1. Using the MSpec runner scripts, the name of the -# executable is explicitly passed by ENV['RUBY_EXE'] -# so there is no ambiguity. -# -# Otherwise, if using RSpec (or something else) -# -# 2. Running the specs while developing an alternative -# Ruby implementation. This explicitly names the -# executable in the development directory based on -# the value of RUBY_ENGINE. -# 3. Running the specs within the source directory for -# some implementation. (E.g. a local build directory.) -# 4. Running the specs against some installed Ruby -# implementation. +# The flags will then be appended to the resulting value, such that +# the RUBY_EXE constant contains both the executable and the flags. # # Additionally, the flags passed to mspec # (with -T on the command line or in the config with set :flags) @@ -129,6 +100,10 @@ def resolve_ruby_exe https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L100 raise Exception, "Unable to find a suitable ruby executable." end +unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE + RUBY_EXE = resolve_ruby_exe +end + def ruby_exe(code = :not_given, opts = {}) if opts[:dir] raise "ruby_exe(..., dir: dir) is no longer supported, use Dir.chdir" @@ -180,7 +155,3 @@ def ruby_cmd(code, opts = {}) https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/ruby_exe.rb#L155 [RUBY_EXE, opts[:options], body, opts[:args]].compact.join(' ') end - -unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE - RUBY_EXE = resolve_ruby_exe -end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/