<commit_before>require 'capybara'

module Sauce
  module Capybara
    class Driver < ::Capybara::Selenium::Driver
      def browser
        unless @browser
          puts "[Connecting to Sauce OnDemand...]"
          config = Sauce::Config.new
          @domain = "#{rand(10000)}.test"
          @sauce_tunnel = Sauce::Connect.new(:host => "127.0.0.1",
                                             :port => rack_server.port,
                                             :domain => @domain,
                                             :quiet => true)
          @sauce_tunnel.wait_until_ready
          @browser = Sauce::Selenium2.new(:name => "Capybara", :browser_url => "http://#{@domain}")
          at_exit do
            @browser.quit<commit_msg>pulling info from Capybara.app_host for users willing to test external apps<commit_after>require 'capybara'
require 'uri'

$uri = URI.parse Capybara.app_host || ""

module Sauce
  module Capybara
    class Driver < ::Capybara::Selenium::Driver
      def browser
        unless @browser
          puts "[Connecting to Sauce OnDemand...]"
          config = Sauce::Config.new
          @domain = "#{rand(10000)}.test"
          @sauce_tunnel = Sauce::Connect.new(:host => $uri.host || rack_server.host,
                                             :port => $uri.port || rack_server.port,
                                             :domain => @domain,
                                             :quiet => true)
          @sauce_tunnel.wait_until_ready
          @browser = Sauce::Selenium2.new(:name => "Capybara test",
                                          :browser_url => "http://#{@domain}")
          at_exit do
            @browser.quit
{'fraction_non_alphanumeric': 0.11733490566037735, 'fraction_numerical': 0.01061320754716981, 'mean_word_length': 1.5103550295857988, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4293961', 'n_tokens_mistral': 463, 'n_tokens_neox': 442, 'n_words': 97}