lib/soundcheck.rb in soundcheck-0.1.0 vs lib/soundcheck.rb in soundcheck-0.2.0

- old
+ new

@@ -1,33 +1,31 @@ +require 'soundcheck/logging' +require 'soundcheck/project' + class Soundcheck + attr_accessor :project attr_accessor :path + attr_accessor :options def initialize(path = "spec", options = {}) - @options = options - - if options[:fast] - @path = `grep -r -L 'spec_helper' #{path || "spec"} | grep '_spec.rb'`.strip.gsub("\n", " ") - else - @path = path || "spec" - end + self.project = Project.new(Dir.pwd) + self.path = path + self.options = options end def command_to_run - if has_gemfile? - if requires_spec_helper? - return "rspec --drb #{@path}" - else - return "bundle exec rspec --drb #{@path}" - end + commands = [] + project.frameworks.each do |framework| + framework.options = options + command = framework.command(*path) + commands << command if command end - - # Assume rspec - "rspec --drb #{@path}" + commands.first end def requires_spec_helper? `grep -r 'spec_helper' #{@path}` - $?.exitstatus == 1 # no match; we have a stand-alone spec + $?.exitstatus == 0 # matched end def has_gemfile? File.exist?("Gemfile") end