lib/cleanser.rb in cleanser-0.2.0 vs lib/cleanser.rb in cleanser-0.2.1
- old
+ new
@@ -49,10 +49,11 @@
cleanser folder failing.rb
Options:
BANNER
opts.on("-r", "--rspec", "RSpec") { options[:rspec] = true }
+ opts.on("-s", "--seed=SEED", "Use seed to run tests") { |seed| options[:seed] = seed }
opts.on("-h", "--help", "Show this.") { puts opts; exit }
opts.on("-v", "--version", "Show Version") do
require 'cleanser/version' unless defined?(Cleanser::VERSION)
puts Cleanser::VERSION; exit
end
@@ -105,17 +106,21 @@
def remove_from(set, x, options)
set.dup.delete_if { |f| f != options[:not] && (x -= 1) >= 0 }
end
def success?(files, options)
+ addition = if seed = options[:seed]
+ "#{" --" unless options[:rspec]} --seed #{seed}"
+ end
+
command = if options[:rspec]
- "bundle exec rspec #{files.join(" ")}"
+ "bundle exec rspec #{files.join(" ")}#{addition}"
else
require = files.map do |f|
f = "./#{f}" unless f.start_with?("/")
"-r #{f.sub(/\.rb$/, "")}"
end.join(" ")
- "bundle exec ruby #{require} -e ''"
+ "bundle exec ruby #{require} -e ''#{addition}"
end
puts "Running: #{command}"
status = system(command)
puts "Status: #{status ? "Success" : "Failure"}"
status