<commit_before>require 'deployinator'
require 'deployinator/helpers/deploy'
require 'deployinator/helpers/version'
require 'deployinator/helpers/git'

module Deployinator
  class DeployinatorApp < Sinatra::Base
    register Mustache::Sinatra
    helpers Deployinator::Helpers,
      Deployinator::Helpers::DeployHelpers,
      Deployinator::Helpers::GitHelpers,
      Deployinator::Helpers::VersionHelpers

    def github_diff_url(params)
      stack = params[:stack].intern
      gh_info = git_info_for_stack[stack]
      "https://#{which_github_host(stack)}/#{gh_info[:user]}/#{gh_info[:repository]}/compare/#{params[:r1]}...#{params[:r2]}"
    end

    set :mustache, {
      :views     => File.join(Deployinator.root_dir, 'views/'),
      :templates => File.join(Deployinator.root_dir, 'templates/'),
      :namespace => Deployinator
    }

    set :public_folder, File.join(Deployinator.root_dir, "public/")
    set :static, true

    before do
      init(env)
      @disabled_override = params[:override].nil? ? false : true
    end

    get '/' do
        mustache :index
    end

    get '/run_logs/view/:log' do
      template = open(settings.mustache[:templates] + "stream.mustache").read<commit_msg>Switch to using Deployinator.root helper instead of direct root_dir access<commit_after>require 'deployinator'
require 'deployinator/helpers/deploy'
require 'deployinator/helpers/version'
require 'deployinator/helpers/git'

module Deployinator
  class DeployinatorApp < Sinatra::Base
    register Mustache::Sinatra
    helpers Deployinator::Helpers,
      Deployinator::Helpers::DeployHelpers,
      Deployinator::Helpers::GitHelpers,
      Deployinator::Helpers::VersionHelpers

    def github_diff_url(params)
      stack = params[:stack].intern
      gh_info = git_info_for_stack[stack]
      "https://#{which_github_host(stack)}/#{gh_info[:user]}/#{gh_info[:repository]}/compare/#{params[:r1]}...#{params[:r2]}"
    end

    set :mustache, {
      :views     => Deployinator.root('views'),
      :templates => Deployinator.root('templates'),
      :namespace => Deployinator
    }

    set :public_folder, Deployinator.root('public')
    set :static, true

    before do
      init(env)
      @disabled_override = params[:override].nil? ? false : true
    end

    get '/' do
        mustache :index
    end

    get '/run_logs/view/:log' do
      template = open(settings.mustache[:templates] + "stream.mustache").read
{'fraction_non_alphanumeric': 0.13316892725030827, 'fraction_numerical': 0.0016440608302507192, 'mean_word_length': 3.75390625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '885970', 'n_tokens_mistral': 762, 'n_tokens_neox': 759, 'n_words': 133}