<commit_before>require 'simple_shell'

class Heidi
  class Hook
    attr_reader :build
    def initialize(build, script)
      @build  = build
      @script = script
    end

    def perform(where=build.build_root)
      # before / failure hooks might like this
      if !File.exists?(where)
        where = build.root
      end

      env = {
        'HEIDI_LOG_DIR'   => build.log_root,
        'HEIDI_BUILD_DIR' => where,
        'RUBYOPT'         => nil,
        'BUNDLE_BIN_PATH' => nil,
        'BUNDLE_GEMFILE'  => nil,
        'GEM_HOME'        => nil,
        'GEM_PATH'        => nil,
      }

      shell = SimpleShell.new(where, env)
      res = shell.do @script
      return res
    end

    def name
      File.basename(@script)
    end
  end
end
<commit_msg>Passing the name of the current build to the ENV<commit_after>require 'simple_shell'

class Heidi
  class Hook
    attr_reader :build
    def initialize(build, script)
      @build  = build
      @script = script
    end

    def perform(where=build.build_root)
      # before / failure hooks might like this
      if !File.exists?(where)
        where = build.root
      end

      env = {
        'HEIDI_LOG_DIR'      => build.log_root,
        'HEIDI_BUILD_DIR'    => where,
        'HEIDI_BUILD_COMMIT' => build.commit,

        'RUBYOPT'         => nil,
        'BUNDLE_BIN_PATH' => nil,
        'BUNDLE_GEMFILE'  => nil,
        'GEM_HOME'        => nil,
        'GEM_PATH'        => nil,
      }

      shell = SimpleShell.new(where, env)
      res = shell.do @script
      return res
    end

    def name
      File.basename(@script)
    end
  end
end

{'fraction_non_alphanumeric': 0.09791921664626684, 'fraction_numerical': 0.0, 'mean_word_length': 1.804459691252144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '1630413', 'n_tokens_mistral': 549, 'n_tokens_neox': 543, 'n_words': 129}