<commit_before>dir = File.dirname(__FILE__)
require File.expand_path("#{dir}/geminstaller/requires.rb")

module GemInstaller
  def self.run(args = [], geminstaller_executable = nil)
    args_copy = args.dup
    args_copy = args_copy.split(' ') unless args.respond_to? :join
    # recursively call script with sudo, if --sudo option is specified
    if platform_supports_sudo? and (args_copy.include?("-s") or args_copy.include?("--sudo"))
      result = reinvoke_with_sudo(args_copy, geminstaller_executable)
      if result != 0 and (args_copy.include?("-e") or args_copy.include?("--exceptions"))
        message = "Error: GemInstaller failed while being invoked with --sudo option.  See prior output for error, and use '--geminstaller-output=all --rubygems-output=all' options to get more details."
        raise GemInstaller::GemInstallerError.new(message)
      end
      return result
    else
      app = create_application(args_copy)
      app.run
    end
  end 
  
  def self.autogem(args = [])
    args_copy = args.dup
    args_copy = args_copy.split(' ') unless args.respond_to? :join
    # TODO: should explicitly remove all args not applicable to autogem (anything but config, silent, and geminstaller_output)
    args_without_sudo = strip_sudo(args_copy)
    app = create_application(args_without_sudo)
    app.autogem
  end

  def self.version
    "0.2.0"
  end

  def self.create_application(args = [], registry = nil)
    registry ||= create_registry
    app = registry.app
    app.args = args
    app
  end
  
  def self.create_registry
    dependency_injector = GemInstaller::DependencyInjector.new<commit_msg> r1143@chadmac:  woolley | 2007-05-14 00:29:53 -0700  bump version to 0.3.0<commit_after>dir = File.dirname(__FILE__)
require File.expand_path("#{dir}/geminstaller/requires.rb")

module GemInstaller
  def self.run(args = [], geminstaller_executable = nil)
    args_copy = args.dup
    args_copy = args_copy.split(' ') unless args.respond_to? :join
    # recursively call script with sudo, if --sudo option is specified
    if platform_supports_sudo? and (args_copy.include?("-s") or args_copy.include?("--sudo"))
      result = reinvoke_with_sudo(args_copy, geminstaller_executable)
      if result != 0 and (args_copy.include?("-e") or args_copy.include?("--exceptions"))
        message = "Error: GemInstaller failed while being invoked with --sudo option.  See prior output for error, and use '--geminstaller-output=all --rubygems-output=all' options to get more details."
        raise GemInstaller::GemInstallerError.new(message)
      end
      return result
    else
      app = create_application(args_copy)
      app.run
    end
  end 
  
  def self.autogem(args = [])
    args_copy = args.dup
    args_copy = args_copy.split(' ') unless args.respond_to? :join
    # TODO: should explicitly remove all args not applicable to autogem (anything but config, silent, and geminstaller_output)
    args_without_sudo = strip_sudo(args_copy)
    app = create_application(args_without_sudo)
    app.autogem
  end

  def self.version
    "0.3.0"
  end

  def self.create_application(args = [], registry = nil)
    registry ||= create_registry
    app = registry.app
    app.args = args
    app
  end
  
  def self.create_registry
    dependency_injector = GemInstaller::DependencyInjector.new
{'fraction_non_alphanumeric': 0.10240963855421686, 'fraction_numerical': 0.009939759036144578, 'mean_word_length': 3.574380165289256, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2534410', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1033, 'n_words': 266}