Cleanup killers and add executable to gemspec

This commit is contained in:
Markus Schirp 2012-11-22 01:42:10 +01:00
parent 63322ebfdc
commit 86acb3a409
6 changed files with 30 additions and 33 deletions

View file

@ -12,6 +12,7 @@ require 'ice_nine'
require 'ice_nine/core_ext/object'
require 'diff/lcs'
require 'diff/lcs/hunk'
require 'rspec'
# Library namespace
module Mutant

View file

@ -1,38 +1,39 @@
module Mutant
class Killer
# class Forked < self
# def initialize(killer, mutation)
# @killer = killer
# super(mutation)
# end
class Forked < self
def initialize(killer, mutation)
@killer = killer
super(mutation)
end
# def type
# @killer.type
# end
def type
@killer.type
end
# def run
# fork do
# @killer.new(@mutation)
# end
def run
fork do
@killer.new(@mutation)
end
# status = Process.wait2.last
# status.exitstatus.zero?
# end
# end
status = Process.wait2.last
status.exitstatus.zero?
end
end
# class Forking < self
# include Equalizer.new(:killer)
class Forking < self
include Equalizer.new(:killer)
# attr_reader :killer
attr_reader :killer
# def initialize(strategy)
# @killer = killer
# end
def initialize(strategy)
@killer = killer
end
def new(mutation)
Forked.new(@killer, mutation)
end
end
# def run(mutation)
# Forked.new(@killer, mutation)
# end
# end
end
end

View file

@ -62,12 +62,7 @@ module Mutant
# @api private
#
def run_rspec
require 'rspec'
self.class.nest do
require './spec/spec_helper.rb'
if RSpec.world.shared_example_groups.empty?
Dir['spec/{support,shared}/**/*.rb'].each { |f| load(f) }
end
::RSpec::Core::Runner.run(command_line_arguments, @error_stream, @output_stream)
end
end

View file

@ -15,7 +15,7 @@ module Mutant
end
def self.killer
self::KILLER
Killer::Forking.new(self::KILLER)
end
class Rspec < self

1
mutant
View file

@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require 'mutant'
require 'mutant/cli'
namespace =
if File.basename($0) == 'zombie'

View file

@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- spec`.split("\n")
gem.extra_rdoc_files = %w[TODO]
gem.executable = [ 'mutant' ]
gem.add_runtime_dependency('to_source', '~> 0.1.3')
gem.add_runtime_dependency('ice_nine', '~> 0.5.0')