Sha256: 28d01ac4b8f5fa7874b8920fb7e98ed09fd93a460df64e21127434b0a4d83f9b

Contents?: true

Size: 1.17 KB

Versions: 14

Compression:

Stored size: 1.17 KB

Contents

require 'autotest'

Autotest.add_hook :initialize do |at|
  at.clear_mappings
  # watch out: Ruby bug (1.8.6):
  # %r(/) != /\//
  at.add_mapping(%r%^examples/.*_example.rb$%) { |filename, _| 
    filename 
  }
  at.add_mapping(%r%^lib/(.*)\.rb$%) { |filename, m| 
    ["examples/lib/#{m[1]}_example.rb"]
  }
  at.add_mapping(%r%^examples/(example_helper|shared/.*)\.rb$%) { 
    at.files_matching %r%^examples/.*_example\.rb$%
  }
end

class MicronautCommandError < StandardError; end

class Autotest::Micronaut < Autotest

  def initialize
    super
    self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m
    self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
  end
  
  def consolidate_failures(failed)
    filters = new_hash_of_arrays
    failed.each do |spec, trace|
      if trace =~ /\n(\.\/)?(.*example\.rb):[\d]+:\Z?/
        filters[$2] << spec
      end
    end
    return filters
  end

  def make_test_cmd(files_to_test)
    return '' if files_to_test.empty?
    
    examples = files_to_test.keys.flatten
    
    examples.map! {|f| %Q(require "#{f}")}

    return "#{ruby} -e '#{examples.join("; ")}'"
  end
  
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
spicycode-micronaut-0.0.3 lib/autotest/micronaut.rb
spicycode-micronaut-0.0.4 lib/autotest/micronaut.rb
spicycode-micronaut-0.0.5 lib/autotest/micronaut.rb
spicycode-micronaut-0.0.6 lib/autotest/micronaut.rb
spicycode-micronaut-0.0.7 lib/autotest/micronaut.rb
spicycode-micronaut-0.0.9 lib/autotest/micronaut.rb
spicycode-micronaut-0.1.0 lib/autotest/micronaut.rb
spicycode-micronaut-0.1.1 lib/autotest/micronaut.rb
spicycode-micronaut-rails-0.0.6.1 lib/autotest/micronaut-rails.rb
spicycode-micronaut-rails-0.0.6.2 lib/autotest/micronaut-rails.rb
spicycode-micronaut-rails-0.1.7.0 lib/autotest/micronaut-rails.rb
spicycode-micronaut-rails-0.1.7.1 lib/autotest/micronaut-rails.rb
spicycode-micronaut-rails-0.1.8.0 lib/autotest/micronaut-rails.rb
spicycode-micronaut-rails-0.1.8.1 lib/autotest/micronaut-rails.rb