<commit_before>require "fileutils"

class StackCommands

  def initialize(stack)
    @stack = stack
  end

  def bundle_install
    Command.new('bundle', 'install')
  end

  def deploy(commit)
    env = {'SHA' => commit.sha, 'ENVIRONMENT' => @stack.environment}
    Command.new('bundle', 'exec', 'cap', @stack.environment, 'deploy', env)
  end

  def checkout(commit)
    git("checkout", "-q", commit.sha)
  end

  def clone(deploy)
    git("clone", "--local", @stack.git_path, deploy.working_directory)
  end

  def create_directories
    FileUtils.mkdir_p(@stack.deploys_path)
  end

  def fetch
    create_directories
    if Dir.exists?(@stack.git_path)
      git("fetch", @stack.git_path)
    else
      git("clone", @stack.repo_git_url, @stack.git_path)
    end
  end

  def git(*args)
    Command.new("git", *args)
  end
end
<commit_msg>Env var stub to make deploys works in production<commit_after>require "fileutils"

class StackCommands

  def initialize(stack)
    @stack = stack
  end

  def bundle_install
    Command.new('bundle', 'install')
  end

  def deploy(commit)
    env = {'SHA' => commit.sha, 'ENVIRONMENT' => @stack.environment, 'SSH_AUTH_SOCK' => '/u/apps/shipit2/shared/ssh/auth_sock'}
    Command.new('bundle', 'exec', 'cap', @stack.environment, 'deploy', env)
  end

  def checkout(commit)
    git("checkout", "-q", commit.sha)
  end

  def clone(deploy)
    git("clone", "--local", @stack.git_path, deploy.working_directory)
  end

  def create_directories
    FileUtils.mkdir_p(@stack.deploys_path)
  end

  def fetch
    create_directories
    if Dir.exists?(@stack.git_path)
      git("fetch", @stack.git_path)
    else
      git("clone", @stack.repo_git_url, @stack.git_path)
    end
  end

  def git(*args)
    Command.new("git", *args)
  end
end

{'fraction_non_alphanumeric': 0.1398876404494382, 'fraction_numerical': 0.0005617977528089888, 'mean_word_length': 3.520304568527919, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '1640597', 'n_tokens_mistral': 637, 'n_tokens_neox': 611, 'n_words': 138}