<commit_before>%w{
  libpcre3
  libpcre3-dev
}.each { |p| package p }

include_recipe "git"
include_recipe "postfix"
include_recipe "ruby_build"
include_recipe "rbenv::system_install"

ruby_components = []

if node['adam']['memory']['install']
  ruby_components << 'memory'
end

if node['adam']['ears']['install']
  ruby_components << 'ears'
end

if node['adam']['fingers']['install']
  ruby_components << 'fingers'
end

if node['adam']['brain']['install']
  ruby_components << 'brain'
end

unless ruby_components.empty?
  ruby_version = '2.0.0-p0'

  rbenv_ruby ruby_version
  rbenv_global ruby_version

  rbenv_gem 'bundler' do
    rbenv_version ruby_version
  end

  rbenv_gem 'foreman' do
    rbenv_version ruby_version
  end

  if node[:adam][:standalone_deployment]
    links = {}
    ruby_components.each do |component|
      links["#{component}/vendor/ruby"] = "#{component}/vendor/ruby"
    end

    links.each_pair do |source_dir, symlink|
      directory File.join(node['adam']['deployment_path'], 'shared', source_dir) do
        recursive true
        owner "adam"
        group "adam"
      end
    end

    directory "/var/log/adam" do
      owner "adam"
    end

    directory "/var/run/adam" do
      owner "adam"
    end

    directory "/etc/adam" do
      owner "adam"
    end

    application "adam" do
      path node['adam']['deployment_path']
      owner "adam"
      group "adam"

      repository node['adam']['app_repo_url']
      revision node['adam']['app_repo_ref']<commit_msg>[DEPLOY] Cleanup app directory creation<commit_after>%w{
  libpcre3
  libpcre3-dev
}.each { |p| package p }

include_recipe "git"
include_recipe "postfix"
include_recipe "ruby_build"
include_recipe "rbenv::system_install"

ruby_components = []

if node['adam']['memory']['install']
  ruby_components << 'memory'
end

if node['adam']['ears']['install']
  ruby_components << 'ears'
end

if node['adam']['fingers']['install']
  ruby_components << 'fingers'
end

if node['adam']['brain']['install']
  ruby_components << 'brain'
end

unless ruby_components.empty?
  ruby_version = '2.0.0-p0'

  rbenv_ruby ruby_version
  rbenv_global ruby_version

  rbenv_gem 'bundler' do
    rbenv_version ruby_version
  end

  rbenv_gem 'foreman' do
    rbenv_version ruby_version
  end

  if node[:adam][:standalone_deployment]
    links = {}
    ruby_components.each do |component|
      links["#{component}/vendor/ruby"] = "#{component}/vendor/ruby"
    end

    links.each_pair do |source_dir, symlink|
      directory File.join(node['adam']['deployment_path'], 'shared', source_dir) do
        recursive true
        owner "adam"
        group "adam"
      end
    end

    %w{
      /etc/adam
      /var/log/adam
    }.each do |dir|
      directory dir do
        owner "adam"
      end
    end

    application "adam" do
      path node['adam']['deployment_path']
      owner "adam"
      group "adam"

      repository node['adam']['app_repo_url']
      revision node['adam']['app_repo_ref']
{'fraction_non_alphanumeric': 0.13429336905559278, 'fraction_numerical': 0.004018754186202277, 'mean_word_length': 3.4582089552238804, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, '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': '4310096', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1000, 'n_words': 224}