<commit_before>set :application, "phpsw"
set :domain, "phpsw.org.uk"
set :deploy_to, "/var/www/#{fetch(:domain)}"
set :repo_url,  "git<EMAIL>:phpsw/#{fetch(:application)}.git"
set :linked_files, %w{config/secrets.yml}

namespace :composer do
  desc "Copy vendors from previous release"
  task :copy_vendors do
    on roles :all, reject: lambda { |h| h.properties.no_release } do
      last_release = releases_path.join(capture(:ls, '-xr', releases_path).split[1])
      execute "if [ -d #{last_release}/vendor ]; then cp -a #{last_release}/vendor #{release_path}/vendor; fi"
    end
  end

  desc "Install"
  task :install do
    on roles :all do
      execute "composer install --no-dev --optimize-autoloader --prefer-source --working-dir #{release_path} --verbose"
    end
  end
end

namespace :mod_pagespeed do
  task :flush do
    on roles :all do
      execute "sudo touch /var/cache/mod_pagespeed/cache.flush"
    end
  end
end

namespace :varnish do
  task :restart do<commit_msg>Adjusted cap composer tasks<commit_after>set :application, "phpsw"
set :domain, "phpsw.org.uk"
set :deploy_to, "/var/www/#{fetch(:domain)}"
set :repo_url,  "git@github.com:phpsw/#{fetch(:application)}.git"
set :linked_files, %w{config/secrets.yml}

namespace :composer do
  task :install do
    on roles :all do
      execute "composer install --no-dev --optimize-autoloader --prefer-source --working-dir #{release_path} --verbose"
    end
  end

  before :install, :copy do
    on roles :all, reject: lambda { |h| h.properties.no_release } do
      last_release = releases_path.join(capture(:ls, '-xr', releases_path).split[1])
      execute "if [ -d #{last_release}/vendor ]; then cp -a #{last_release}/vendor #{release_path}/vendor; fi"
    end
  end
end

namespace :mod_pagespeed do
  task :flush do
    on roles :all do
      execute "sudo touch /var/cache/mod_pagespeed/cache.flush"
    end
  end
end

namespace :varnish do
  task :restart do
{'fraction_non_alphanumeric': 0.1343669250645995, 'fraction_numerical': 0.0010335917312661498, 'mean_word_length': 3.7219512195121953, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, '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': '2434762', 'n_tokens_mistral': 675, 'n_tokens_neox': 666, 'n_words': 185}