<commit_before>require 'delegate'

module LicenseFinder::TestingDSL
  class User
    def run_license_finder
      execute_command "license_finder --quiet"
    end

    def create_empty_project
      EmptyProject.create
    end

    def create_ruby_app
      BundlerProject.create
    end

    def create_gem(name, options)
      GemProject.create(name, options)
    end

    def execute_command(command)
      @output, @exit_code = Paths.project.shell_out(command, true)
    end

    def seeing?(content)
      @output.include? content
    end

    def seeing_line?(content)
      seeing_something_like? /^#{Regexp.escape content}$/
    end

    def seeing_something_like?(regex)
      @output =~ regex
    end

    def receiving_exit_code?(code)
      @exit_code == code
    end

    def view_html
      execute_command 'license_finder report --format html'
      HtmlReport.from_string(@output)
    end
  end

  require 'forwardable'
  class Project
    extend Forwardable
    def_delegators :project_dir, :shell_out, :add_to_file, :install_fixture

    def self.create
      project = new
      project.add_dep
      project.install
      project
    end

    def initialize
      Paths.reset_projects!
      project_dir.make
    end

    def add_dep
    end

    def install
    end

    private

    def project_dir
      Paths.project
    end
  end

  class EmptyProject < Project
  end

  class PipProject < Project
    def add_dep
      add_to_file("requirements.txt", 'rsa==3.1.4')
    end

    def install
      shell_out("pip install -r requirements.txt")
    end<commit_msg>Try to get Travis tests passing<commit_after>require 'delegate'

module LicenseFinder::TestingDSL
  class User
    def run_license_finder
      execute_command "license_finder --quiet"
    end

    def create_empty_project
      EmptyProject.create
    end

    def create_ruby_app
      BundlerProject.create
    end

    def create_gem(name, options)
      GemProject.create(name, options)
    end

    def execute_command(command)
      @output, @exit_code = Paths.project.shell_out(command, true)
    end

    def seeing?(content)
      @output.include? content
    end

    def seeing_line?(content)
      seeing_something_like? /^#{Regexp.escape content}$/
    end

    def seeing_something_like?(regex)
      @output =~ regex
    end

    def receiving_exit_code?(code)
      @exit_code == code
    end

    def view_html
      execute_command 'license_finder report --format html'
      HtmlReport.from_string(@output)
    end
  end

  require 'forwardable'
  class Project
    extend Forwardable
    def_delegators :project_dir, :shell_out, :add_to_file, :install_fixture

    def self.create
      project = new
      project.add_dep
      project.install
      project
    end

    def initialize
      Paths.reset_projects!
      make_project
    end

    def add_dep
    end

    def install
    end

    private

    def project_dir
      Paths.project
    end

    def make_project
      project_dir.make
    end
  end

  class EmptyProject < Project
  end

  class PipProject < Project
    def add_dep
      add_to_file("requirements.txt", 'rsa==3.1.4')
    end

    def install
      shell_out("pip install -r requirements.txt")
    end

    def make_project
      Shell.run("cd #{Paths.projects} && virtualenv my_app")
    end
{'fraction_non_alphanumeric': 0.06696696696696697, 'fraction_numerical': 0.0018018018018018018, 'mean_word_length': 2.4843096234309625, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3198701', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1011, 'n_words': 253}