<commit_before>$: << 'cf_spec'
require 'cf_spec_helper'

describe 'Compile' do
  context 'when running in an unsupported stack' do
    def run(cmd, env: {})
      if RUBY_PLATFORM =~ /darwin/i
        env_flags = env.map{|k,v| "-e #{k}=#{v}"}.join(' ')
        `docker run --rm #{env_flags} -v #{Dir.pwd}:/buildpack:ro -w /buildpack cloudfoundry/cflinuxfs2 #{cmd}`
      else
        `env #{env.map{|k,v| "#{k}=#{v}"}.join(' ')} #{cmd}`
      end
    end

    it 'fails with a helpful error message' do
      output = run('./bin/compile /tmp /tmp 2>&1', env: {CF_STACK: 'unsupported'})
      expect(output).to include('not supported by this buildpack')
    end
  end
end<commit_msg>Don't build into /tmp, because it's important<commit_after>$: << 'cf_spec'
require 'cf_spec_helper'

describe 'Compile' do
  context 'when running in an unsupported stack' do
    def run(cmd, env: {})
      if RUBY_PLATFORM =~ /darwin/i
        env_flags = env.map{|k,v| "-e #{k}=#{v}"}.join(' ')
        `docker run --rm #{env_flags} -v #{Dir.pwd}:/buildpack:ro -w /buildpack cloudfoundry/cflinuxfs2 #{cmd}`
      else
        `env #{env.map{|k,v| "#{k}=#{v}"}.join(' ')} #{cmd}`
      end
    end

    it 'fails with a helpful error message' do
      output = run("./bin/compile #{Dir.mktmpdir} #{Dir.mktmpdir} 2>&1", env: {CF_STACK: 'unsupported'})
      expect(output).to include('not supported by this buildpack')
    end
  end
end
{'fraction_non_alphanumeric': 0.18194640338504936, 'fraction_numerical': 0.004231311706629055, 'mean_word_length': 3.0775862068965516, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '490830', 'n_tokens_mistral': 528, 'n_tokens_neox': 515, 'n_words': 139}