<commit_before>module Autospec

  class RspecRunner < BaseRunner

    WATCHERS = {}
    def self.watch(pattern, &blk); WATCHERS[pattern] = blk; end
    def watchers; WATCHERS; end

    # Discourse specific
    watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/components/#{m[1]}_spec.rb" }

    # Rails example
    watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
    watch(%r{^app/(.+)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
    watch(%r{^spec/.+_spec\.rb$})
    watch(%r{^spec/support/.+\.rb$})                    { "spec" }
    watch("app/controllers/application_controller.rb")  { "spec/controllers" }

    # Capybara request specs
    watch(%r{^app/views/(.+)/.+\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }

    # Fabrication
    watch(%r{^spec/fabricators/.+_fabricator\.rb$})     { "spec" }

    RELOADERS = Set.new
    def self.reload(pattern); RELOADERS << pattern; end
    def reloaders; RELOADERS; end

    # We need to reload the whole app when changing any of these files
    reload('spec/spec_helper.rb')
    reload('config/(.*).rb')
    reload('app/helpers/(.*).rb')

    def failed_specs
      specs = []
      path = './tmp/rspec_result'
      specs = File.readlines(path) if File.exist?(path)
      specs
    end

  end

end
<commit_msg>fix rspec reloaders<commit_after>module Autospec

  class RspecRunner < BaseRunner

    WATCHERS = {}
    def self.watch(pattern, &blk); WATCHERS[pattern] = blk; end
    def watchers; WATCHERS; end

    # Discourse specific
    watch(%r{^lib/(.+)\.rb$})                           { |m| "spec/components/#{m[1]}_spec.rb" }

    # Rails example
    watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
    watch(%r{^app/(.+)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
    watch(%r{^spec/.+_spec\.rb$})
    watch(%r{^spec/support/.+\.rb$})                    { "spec" }
    watch("app/controllers/application_controller.rb")  { "spec/controllers" }

    # Capybara request specs
    watch(%r{^app/views/(.+)/.+\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }

    # Fabrication
    watch(%r{^spec/fabricators/.+_fabricator\.rb$})     { "spec" }

    RELOADERS = Set.new
    def self.reload(pattern); RELOADERS << pattern; end
    def reloaders; RELOADERS; end

    # We need to reload the whole app when changing any of these files
    reload("spec/spec_helper.rb")
    reload(%r{config/.+\.rb})
    reload(%r{app/helpers/.+\.rb})

    def failed_specs
      specs = []
      path = './tmp/rspec_result'
      specs = File.readlines(path) if File.exist?(path)
      specs
    end

  end

end

{'fraction_non_alphanumeric': 0.19426048565121412, 'fraction_numerical': 0.003679175864606328, 'mean_word_length': 2.2641056422569026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3368892', 'n_tokens_mistral': 1022, 'n_tokens_neox': 978, 'n_words': 168}