Sha256: c859ebfabf6b9585c15635dfaf81dc2314260ef553242c57e409b81fff20bfaf
Contents?: true
Size: 926 Bytes
Versions: 2
Compression:
Stored size: 926 Bytes
Contents
require 'tempfile' require 'fileutils' require 'open3' require 'reek/cli/application' class ReekWorld def run(cmd) stderr_file = Tempfile.new('reek-world') stderr_file.close @last_stdout = `#{cmd} 2> #{stderr_file.path}` @last_exit_status = $?.exitstatus @last_stderr = IO.read(stderr_file.path) end def reek(args) run("ruby -Ilib bin/reek --no-color #{args}") end def reek_with_pipe(stdin, args) run("echo \"#{stdin}\" | ruby -Ilib bin/reek --no-color #{args}") end def rake(name, task_def) header = <<EOS $:.unshift('lib') require 'reek/rake/task' EOS rakefile = Tempfile.new('rake_task', '.') rakefile.puts(header + task_def) rakefile.close run("rake -f #{rakefile.path} #{name}") lines = @last_stdout.split("\n") if lines.length > 0 && lines[0] =~ /^\(/ @last_stdout = lines[1..-1].join("\n") end end end World do ReekWorld.new end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-1.5.1 | features/support/env.rb |
reek-1.5.0 | features/support/env.rb |