<commit_before>#!/usr/bin/env ruby
require 'json'
require 'toml'
require 'tmpdir'
require 'date'
require_relative './dependencies'

CNB_STACKS = {
  'cflinuxfs3' => 'org.cloudfoundry.stacks.cflinuxfs3',
  'bionic'     => 'io.buildpacks.stacks.bionic'
}

V3_DEP_IDS = {
  'php' => 'php-binary'
}

V3_DEP_NAMES = {
  'node' => 'Node Engine',
  'yarn' => 'Yarn',
  'python' => 'Python',
  'php' => 'PHP',
  'httpd' => 'Apache HTTP Server',
  'go' => 'Go'
}

buildpacks_ci_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
require_relative "#{buildpacks_ci_dir}/lib/git-client"

buildpack_toml_file = File.file?("buildpack/buildpack.toml.tmpl") ? 'buildpack.toml.tmpl' : 'buildpack.toml'
buildpack_toml = TOML.load_file("buildpack/#{buildpack_toml_file}")
# Releases have buildpack.toml files, compiled by the release process
buildpack_toml_latest_released = begin
  TOML.load_file('buildpack-latest-released/buildpack.toml')
rescue
  {'metadata' => {'dependencies' => []}}
end

data = JSON.parse(open('source/data.json').read)
manifest_name = data.dig('source', 'name')
resource_version = data.dig('version', 'ref')
story_id = JSON.parse(open("builds/binary-builds-new/#{manifest_name}/#{resource_version}.json").read)['tracker_story_id']
removal_strategy  = ENV['REMOVAL_STRATEGY']
version_line_type = ENV['VERSION_LINE_TYPE']
version_line      = ENV['VERSION_LINE']<commit_msg>Fix reading dependencies of latest released cnb<commit_after>#!/usr/bin/env ruby
require 'json'
require 'toml'
require 'tmpdir'
require 'date'
require_relative './dependencies'

CNB_STACKS = {
  'cflinuxfs3' => 'org.cloudfoundry.stacks.cflinuxfs3',
  'bionic'     => 'io.buildpacks.stacks.bionic'
}

V3_DEP_IDS = {
  'php' => 'php-binary'
}

V3_DEP_NAMES = {
  'node' => 'Node Engine',
  'yarn' => 'Yarn',
  'python' => 'Python',
  'php' => 'PHP',
  'httpd' => 'Apache HTTP Server',
  'go' => 'Go'
}

buildpacks_ci_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
require_relative "#{buildpacks_ci_dir}/lib/git-client"

buildpack_toml_file = File.file?("buildpack/buildpack.toml.tmpl") ? 'buildpack.toml.tmpl' : 'buildpack.toml'
buildpack_toml = TOML.load_file("buildpack/#{buildpack_toml_file}")
buildpack_toml_latest_released = TOML.load_file('buildpack-latest-released/buildpack.toml.tmpl')

data = JSON.parse(open('source/data.json').read)
manifest_name = data.dig('source', 'name')
resource_version = data.dig('version', 'ref')
story_id = JSON.parse(open("builds/binary-builds-new/#{manifest_name}/#{resource_version}.json").read)['tracker_story_id']
removal_strategy  = ENV['REMOVAL_STRATEGY']
version_line_type = ENV['VERSION_LINE_TYPE']
version_line      = ENV['VERSION_LINE']
{'fraction_non_alphanumeric': 0.17845242502776748, 'fraction_numerical': 0.002961865975564606, 'mean_word_length': 5.910485933503836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '2868696', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1043, 'n_words': 147}