Method: MSpecMain#run

Defined in:
lib/mspec/commands/mspec.rb

#runObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/mspec/commands/mspec.rb', line 145

def run
  ENV['MSPEC_RUNNER'] = '1'
  ENV['RUBY_EXE']     = config[:target]
  ENV['RUBY_FLAGS']   = config[:flags].join " "

  argv = []

  argv.concat config[:launch]
  argv.concat config[:flags]
  argv.concat config[:includes]
  argv.concat config[:requires]
  argv << "-v"
  argv << "#{MSPEC_HOME}/bin/mspec-#{ config[:command] || "run" }"
  argv.concat config[:options]

  if config[:multi] and config[:command] == "ci"
    multi_exec argv
  else
    if config[:use_valgrind]
      more = ["--child-silent-after-fork=yes",
              "--db-attach=#{config[:use_gdb] ? 'yes' : 'no'}",
              config[:target]] + argv
      exec "valgrind", *more
    elsif config[:use_gdb]
      more = ["--args", config[:target]] + argv
      exec "gdb", *more
    else
      cmd, *rest = config[:target].split(/\s+/)
      argv = rest + argv unless rest.empty?
      exec cmd, *argv
    end
  end
end