<commit_before>require 'benchmark'
require 'timeout'
require 'deployinator/helpers/version'
require 'deployinator/helpers/plugin'

module Deployinator
  module Helpers
    include Deployinator::Helpers::VersionHelpers,
      Deployinator::Helpers::PluginHelpers

    RUN_LOG_PATH = "run_logs/"

    def dev_context?
      Deployinator.app_context['context'] == 'dev'
    end

    def not_dev?
      Deployinator.app_context['context'] != 'dev'
    end

    def run_log_path
      RUN_LOG_PATH
    end

    def init(env)
      @username = 'nobody'
      @groups = ['nogroup']
      @local = false
      @host = env['HTTP_HOST']
      auth_info = raise_event(:auth, {:env => env})
      if !auth_info.nil?
        raise "You must login." unless auth_info[:authorized]
        @username = auth_info[:username]
        @groups = auth_info[:groups]
        @host = auth_info[:host]
        @local = auth_info[:local]
      end
    end

    def write_file(str, file)
      File.open("#{RUN_LOG_PATH}#{file}", "a:UTF-8") do |f|
        f.print str.force_encoding("UTF-8")
      end
    end

    # Creates a current-stackname symlink for each deploy for easier tailing
    #
    # filename - String of the current run log filename
    # stack - String containing the stack for this deploy<commit_msg>Passing more state to auth plugin<commit_after>require 'benchmark'
require 'timeout'
require 'deployinator/helpers/version'
require 'deployinator/helpers/plugin'

module Deployinator
  module Helpers
    include Deployinator::Helpers::VersionHelpers,
      Deployinator::Helpers::PluginHelpers

    RUN_LOG_PATH = "run_logs/"

    def dev_context?
      Deployinator.app_context['context'] == 'dev'
    end

    def not_dev?
      Deployinator.app_context['context'] != 'dev'
    end

    def run_log_path
      RUN_LOG_PATH
    end

    def init(env)
      @username = 'nobody'
      @groups = ['nogroup']
      @local = false
      @host = env['HTTP_HOST']
      auth_info = raise_event(:auth, {:env => env, :request => request})
      if !auth_info.nil?
        raise "You must login." unless auth_info[:authorized]
        @username = auth_info[:username]
        @groups = auth_info[:groups]
        @host = auth_info[:host]
        @local = auth_info[:local]
      end
    end

    def write_file(str, file)
      File.open("#{RUN_LOG_PATH}#{file}", "a:UTF-8") do |f|
        f.print str.force_encoding("UTF-8")
      end
    end

    # Creates a current-stackname symlink for each deploy for easier tailing
    #
    # filename - String of the current run log filename
    # stack - String containing the stack for this deploy
{'fraction_non_alphanumeric': 0.10971428571428571, 'fraction_numerical': 0.0015238095238095239, 'mean_word_length': 2.8674521354933726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '92692', 'n_tokens_mistral': 820, 'n_tokens_neox': 813, 'n_words': 206}