<commit_before>class DemoApp
  include ADB

  def initialize
    @app = {:apk => 'features/support/ApiDemos.apk', :package => 'com.example.android.apis' }
    @test_app = {:apk => 'driver/bin/gametel_driver-debug.apk', :package => 'com.leandog.gametel.driver' }
  end

  def setup
    install_app
    port_forward
  end

  def teardown
    all_apks do |app|
      puts "Removing #{app[:package]}..."
      `adb uninstall #{app[:package]}`
    end
  end

  def start_and_wait(wait=5)
    shell "am instrument -e packageName #{@app[:package]} -e fullLauncherName #{@app[:package]}.ApiDemos -e class com.leandog.gametel.driver.TheTest #{@test_app[:package]}/com.leandog.gametel.driver.GametelInstrumentation"
    sleep wait
  end

  private
  def install_app
    all_apks do |app|
      puts "Installing #{app[:apk]}..."
      `adb install #{app[:apk]}`
    end
  end

  def port_forward
    local = 'tcp:7777'
    host = 'tcp:54767'
    puts "Forwarding #{local} to #{host}..."
    forward local, host
  end

  def all_apks(&block)
    [@app, @test_app].each do |app|
      block.call app
    end
  end
end<commit_msg>favor backtick over adb gem for port forwarding<commit_after>class DemoApp
  include ADB

  def initialize
    @app = {:apk => 'features/support/ApiDemos.apk', :package => 'com.example.android.apis' }
    @test_app = {:apk => 'driver/bin/gametel_driver-debug.apk', :package => 'com.leandog.gametel.driver' }
  end

  def setup
    install_app
    port_forward
  end

  def teardown
    all_apks do |app|
      puts "Removing #{app[:package]}..."
      `adb uninstall #{app[:package]}`
    end
  end

  def start_and_wait(wait=5)
    shell "am instrument -e packageName #{@app[:package]} -e fullLauncherName #{@app[:package]}.ApiDemos -e class com.leandog.gametel.driver.TheTest #{@test_app[:package]}/com.leandog.gametel.driver.GametelInstrumentation"
    sleep wait
  end

  private
  def install_app
    all_apks do |app|
      puts "Installing #{app[:apk]}..."
      `adb install #{app[:apk]}`
    end
  end

  def port_forward
    local = 'tcp:7777'
    host = 'tcp:54767'
    `adb forward #{local} #{host}`
    puts "Forwarding #{local} to #{host}..."
  end

  def all_apks(&block)
    [@app, @test_app].each do |app|
      block.call app
    end
  end
end
{'fraction_non_alphanumeric': 0.1427316644707949, 'fraction_numerical': 0.00878348704435661, 'mean_word_length': 3.119349005424955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3488841', 'n_tokens_mistral': 862, 'n_tokens_neox': 825, 'n_words': 193}