<commit_before>#!/usr/bin/env ruby

require 'open3'

BOSH_LITE_HOSTNAME = ENV['BOSH_LITE_HOSTNAME']
CC_HOSTNAME = ENV['CC_HOSTNAME']
CF_ADMIN_USER = ENV['CF_ADMIN_USER']
CF_ADMIN_PASSWORD = ENV['CF_ADMIN_PASSWORD']

def cf(cmd)
  out, err, status = Open3.capture3("cf #{cmd}")
  puts out
  raise "cf failed:\n#{err}" unless status == 0
end

system "ssh #{BOSH_LITE_HOSTNAME} \"rm -rf $(find /opt/warden/disks/bind_mount_points -name '*cc-droplets*' 2> /dev/null)\""

cf "api #{CC_HOSTNAME} --skip-ssl-validation"
cf "auth #{CF_ADMIN_USER} #{CF_ADMIN_PASSWORD}"

%w(linux32 linux64 win32 win64 osx).each do |platform|
  user = "cats-user-#{platform}"
  org = "cats-org-#{platform}"
  cf "create-user #{user} cats-password"
  cf "delete-org -f #{org}"
  cf "create-org #{org}"

  ["cats-space-#{platform}", "persistent-space-#{platform}"].each do |space|
    cf "create-space #{space} -o #{org}"

    %w(SpaceManager SpaceDeveloper SpaceAuditor).each do |role|
      cf "set-space-role #{user} #{org} #{space} #{role}"
    end
  end
end<commit_msg>use the built version of cf to clean the litterbox<commit_after>#!/usr/bin/env ruby

require 'open3'

BOSH_LITE_HOSTNAME = ENV['BOSH_LITE_HOSTNAME']
CC_HOSTNAME = ENV['CC_HOSTNAME']
CF_ADMIN_USER = ENV['CF_ADMIN_USER']
CF_ADMIN_PASSWORD = ENV['<PASSWORD>']

def cf(cmd)
  out, err, status = Open3.capture3("out/cf #{cmd}")
  puts out
  raise "cf failed:\n#{err}" unless status == 0
end

system "ssh #{BOSH_LITE_HOSTNAME} \"rm -rf $(find /opt/warden/disks/bind_mount_points -name '*cc-droplets*' 2> /dev/null)\""

cf "api #{CC_HOSTNAME} --skip-ssl-validation"
cf "auth #{CF_ADMIN_USER} #{CF_ADMIN_PASSWORD}"

%w(linux32 linux64 win32 win64 osx).each do |platform|
  user = "cats-user-#{platform}"
  org = "cats-org-#{platform}"
  cf "create-user #{user} cats-password"
  cf "delete-org -f #{org}"
  cf "create-org #{org}"

  ["cats-space-#{platform}", "persistent-space-#{platform}"].each do |space|
    cf "create-space #{space} -o #{org}"

    %w(SpaceManager SpaceDeveloper SpaceAuditor).each do |role|
      cf "set-space-role #{user} #{org} #{space} #{role}"
    end
  end
end
{'fraction_non_alphanumeric': 0.17920978363123236, 'fraction_numerical': 0.012229539040451553, 'mean_word_length': 4.582677165354331, 'pattern_counts': {'":': 0, '<': 4, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1171072', 'n_tokens_mistral': 860, 'n_tokens_neox': 835, 'n_words': 192}