Skip to content

Commit 81ea0ef

Browse files
committed
1 parent d4d00fa commit 81ea0ef

File tree

3 files changed

+14
-46
lines changed

3 files changed

+14
-46
lines changed

spec/mspec/Gemfile.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ PLATFORMS
1919
DEPENDENCIES
2020
rake (~> 10.0)
2121
rspec (~> 2.14.1)
22-
23-
BUNDLED WITH
24-
1.16.1

spec/mspec/lib/mspec/helpers/ruby_exe.rb

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,29 @@
22
require 'mspec/helpers/tmp'
33

44
# The ruby_exe helper provides a wrapper for invoking the
5-
# same Ruby interpreter with the same falgs as the one running
5+
# same Ruby interpreter with the same flags as the one running
66
# the specs and getting the output from running the code.
7+
#
78
# If +code+ is a file that exists, it will be run.
8-
# Otherwise, +code+ should be Ruby code that will be run with
9-
# the -e command line option. For example:
9+
# Otherwise, +code+ will be written to a temporary file and be run.
10+
# For example:
1011
#
1112
# ruby_exe('path/to/some/file.rb')
1213
#
1314
# will be executed as
1415
#
1516
# `#{RUBY_EXE} 'path/to/some/file.rb'`
1617
#
17-
# while
18-
#
19-
# ruby_exe('puts "hello, world."')
20-
#
21-
# will be executed as
22-
#
23-
# `#{RUBY_EXE} -e 'puts "hello, world."'`
24-
#
2518
# The ruby_exe helper also accepts an options hash with three
2619
# keys: :options, :args and :env. For example:
2720
#
2821
# ruby_exe('file.rb', :options => "-w",
29-
# :args => "> file.txt",
22+
# :args => "arg1 arg2",
3023
# :env => { :FOO => "bar" })
3124
#
3225
# will be executed as
3326
#
34-
# `#{RUBY_EXE} -w #{'file.rb'} > file.txt`
27+
# `#{RUBY_EXE} -w file.rb arg1 arg2`
3528
#
3629
# with access to ENV["FOO"] with value "bar".
3730
#
@@ -49,33 +42,11 @@
4942
# The RUBY_EXE constant is setup by mspec automatically
5043
# and is used by ruby_exe and ruby_cmd. The mspec runner script
5144
# will set ENV['RUBY_EXE'] to the name of the executable used
52-
# to invoke the mspec-run script. The value of RUBY_EXE will be
53-
# constructed as follows:
54-
#
55-
# 1. the value of ENV['RUBY_EXE']
56-
# 2. an explicit value based on RUBY_ENGINE
57-
# 3. cwd/(RUBY_ENGINE + $(EXEEXT) || $(exeext) || '')
58-
# 4. $(bindir)/$(RUBY_INSTALL_NAME)
45+
# to invoke the mspec-run script.
5946
#
6047
# The value will only be used if the file exists and is executable.
61-
# The flags will then be appended to the resulting value.
62-
#
63-
# These 4 ways correspond to the following scenarios:
64-
#
65-
# 1. Using the MSpec runner scripts, the name of the
66-
# executable is explicitly passed by ENV['RUBY_EXE']
67-
# so there is no ambiguity.
68-
#
69-
# Otherwise, if using RSpec (or something else)
70-
#
71-
# 2. Running the specs while developing an alternative
72-
# Ruby implementation. This explicitly names the
73-
# executable in the development directory based on
74-
# the value of RUBY_ENGINE.
75-
# 3. Running the specs within the source directory for
76-
# some implementation. (E.g. a local build directory.)
77-
# 4. Running the specs against some installed Ruby
78-
# implementation.
48+
# The flags will then be appended to the resulting value, such that
49+
# the RUBY_EXE constant contains both the executable and the flags.
7950
#
8051
# Additionally, the flags passed to mspec
8152
# (with -T on the command line or in the config with set :flags)
@@ -129,6 +100,10 @@ def resolve_ruby_exe
129100
raise Exception, "Unable to find a suitable ruby executable."
130101
end
131102

103+
unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE
104+
RUBY_EXE = resolve_ruby_exe
105+
end
106+
132107
def ruby_exe(code = :not_given, opts = {})
133108
if opts[:dir]
134109
raise "ruby_exe(..., dir: dir) is no longer supported, use Dir.chdir"
@@ -180,7 +155,3 @@ def ruby_cmd(code, opts = {})
180155

181156
[RUBY_EXE, opts[:options], body, opts[:args]].compact.join(' ')
182157
end
183-
184-
unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE
185-
RUBY_EXE = resolve_ruby_exe
186-
end

spec/mspec/tool/sync/sync-rubyspec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def verify_commits(impl)
190190
puts "Manually check commit messages:"
191191
print "Press enter >"
192192
STDIN.gets
193-
sh "git", "log", "master..."
193+
system "git", "log", "master..."
194194
end
195195
end
196196

0 commit comments

Comments
 (0)