<commit_before>require 'formula'
require 'cmd/config'
require 'net/http'
require 'net/https'
require 'stringio'

module Homebrew
  def gistify_logs f
    files = load_logs(f.name)

    s = StringIO.new
    Homebrew.dump_verbose_config(s)
    files["config.out"] = { :content => s.string }
    files["doctor.out"] = { :content => `brew doctor 2>&1` }

    url = create_gist(files)

    if ARGV.include?('--new-issue') || ARGV.switch?('n')
      auth = :AUTH_TOKEN

      unless HOMEBREW_GITHUB_API_TOKEN
        puts 'You can create an API token: https://github.com/settings/applications'
        puts 'and then set HOMEBREW_GITHUB_API_TOKEN as authentication method.'
        puts

        auth = :AUTH_BASIC
      end

      url = new_issue(f.tap, "#{f.name} failed to build on #{MACOS_FULL_VERSION}", url, auth)
    end

    puts url if url
  end

  #Hack for ruby < 1.9.3
  def noecho_gets
    system 'stty -echo'
    result = $stdin.gets
    system 'stty echo'
    puts
    result
  end

  def login request<commit_msg>gist-logs: show the formula origin for non core-formula<commit_after>require 'formula'
require 'cmd/config'
require 'net/http'
require 'net/https'
require 'stringio'

module Homebrew
  def gistify_logs f
    files = load_logs(f.name)

    s = StringIO.new
    Homebrew.dump_verbose_config(s)
    files["config.out"] = { :content => s.string }
    files["doctor.out"] = { :content => `brew doctor 2>&1` }
    unless f.core_formula?
      tap = <<-EOS.undent
        Formula: #{f.name}
        Tap: #{f.tap}
        Path: #{f.path}
      EOS
      files["tap.out"] = { :content => tap }
    end

    url = create_gist(files)

    if ARGV.include?('--new-issue') || ARGV.switch?('n')
      auth = :AUTH_TOKEN

      unless HOMEBREW_GITHUB_API_TOKEN
        puts 'You can create an API token: https://github.com/settings/applications'
        puts 'and then set HOMEBREW_GITHUB_API_TOKEN as authentication method.'
        puts

        auth = :AUTH_BASIC
      end

      url = new_issue(f.tap, "#{f.name} failed to build on #{MACOS_FULL_VERSION}", url, auth)
    end

    puts url if url
  end

  #Hack for ruby < 1.9.3
  def noecho_gets
    system 'stty -echo'
    result = $stdin.gets
    system 'stty echo'
    puts
    result
  end

  def login request
{'fraction_non_alphanumeric': 0.11769872639437857, 'fraction_numerical': 0.004391743522178305, 'mean_word_length': 2.6448, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '2626122', 'n_tokens_mistral': 822, 'n_tokens_neox': 790, 'n_words': 207}