<commit_before>settings.releases_path ||= lambda { "#{settings.deploy_to!}/releases" }
settings.shared_path   ||= lambda { "#{settings.deploy_to!}/shared" }
settings.current_path  ||= lambda { "#{settings.deploy_to!}/current" }
settings.lock_file     ||= lambda { "#{settings.deploy_to!}/deploy.lock" }

namespace :deploy do
  desc "Forces a deploy unlock."
  task :force_unlock do
    queue %{echo "-----> Unlocking"}
    queue echo_cmd %{rm -f "#{lock_file}"}
  end

  desc "Links paths set in :shared_paths."
  task :link_shared_paths do
    dirs = settings.shared_paths!.map { |file| File.dirname("./#{file}") }.uniq

    cmds = dirs.map do |dir|
      %{mkdir -p "#{dir}"}
    end

    cmds += shared_paths.map do |file|
      %{ln -s "#{shared_path}/#{file}" "./#{file}"}
    end

    queue %{
      echo "-----> Symlinking shared paths"
      #{cmds.join(" &&\n")}
    }
  end
end

desc "Sets up a site."
task :setup do
  settings.deploy_to!

  queue %{echo "-----> Setting up"}
  queue echo_cmd %{mkdir -p "#{deploy_to}"}
  queue echo_cmd %{chmod g+r,a+rwx "#{deploy_to}"}
  queue echo_cmd %{mkdir -p "#{releases_path}"}
  queue echo_cmd %{mkdir -p "#{shared_path}"}
end<commit_msg>Make 'vh setup' ensure ownership of the deploy_to path.<commit_after>settings.releases_path ||= lambda { "#{settings.deploy_to!}/releases" }
settings.shared_path   ||= lambda { "#{settings.deploy_to!}/shared" }
settings.current_path  ||= lambda { "#{settings.deploy_to!}/current" }
settings.lock_file     ||= lambda { "#{settings.deploy_to!}/deploy.lock" }

namespace :deploy do
  desc "Forces a deploy unlock."
  task :force_unlock do
    queue %{echo "-----> Unlocking"}
    queue echo_cmd %{rm -f "#{lock_file}"}
  end

  desc "Links paths set in :shared_paths."
  task :link_shared_paths do
    dirs = settings.shared_paths!.map { |file| File.dirname("./#{file}") }.uniq

    cmds = dirs.map do |dir|
      %{mkdir -p "#{dir}"}
    end

    cmds += shared_paths.map do |file|
      %{ln -s "#{shared_path}/#{file}" "./#{file}"}
    end

    queue %{
      echo "-----> Symlinking shared paths"
      #{cmds.join(" &&\n")}
    }
  end
end

desc "Sets up a site."
task :setup do
  settings.deploy_to!

  queue %{echo "-----> Setting up"}
  queue echo_cmd %{mkdir -p "#{deploy_to}"}
  queue echo_cmd %{chown -R `whoami` "#{deploy_to}"}
  queue echo_cmd %{chmod g+r,a+rwx "#{deploy_to}"}
  queue echo_cmd %{mkdir -p "#{releases_path}"}
  queue echo_cmd %{mkdir -p "#{shared_path}"}
end
{'fraction_non_alphanumeric': 0.18666666666666668, 'fraction_numerical': 0.0, 'mean_word_length': 3.351493848857645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4088873', 'n_tokens_mistral': 944, 'n_tokens_neox': 880, 'n_words': 225}