<commit_before>namespace :composer do
  desc <<-DESC
    Installs composer.phar to the shared directory
    In order to use the .phar file, the composer command needs to be mapped:
      SSHKit.config.command_map[:composer] = "\#{shared_path.join("composer.phar")}"
    This is best used before deploy:starting:
      namespace :deploy do
        before :starting, 'composer:install_executable'
      end
  DESC
  task :install_executable do
    on roles fetch(:composer_roles) do
      within shared_path do
        unless test "[", "-e", "composer.phar", "]"
          execute :curl, "-s", fetch(:composer_download_url), "|", :php
        end
      end
    end
  end

  task :run, :command do |t, args|
    args.with_defaults(:command => :list)
    on roles fetch(:composer_roles) do
      within release_path do
        execute :composer, args[:command], *args.extras
      end
    end
  end

  desc <<-DESC
        Install the project dependencies via Composer. By default, require-dev \
        dependencies will not be installed.

        You can override any of the defaults by setting the variables shown below.

          set :composer_flags, '--no-dev --no-scripts --quiet --optimize-autoloader'
          set :composer_roles, :all
    DESC
  task :install do
    invoke "composer:run", :install, fetch(:composer_install_flags)
  end

  task :dump_autoload do
    invoke "composer:run", :dumpautoload, fetch(:composer_dump_autoload_flags)
  end

  desc "Run the self-update command for composer.phar"
  task :self_update do
    invoke "composer:run", :selfupdate
  end

  before 'deploy:updated', 'composer:install'
end

namespace :load do
  task :defaults do
    set :composer_install_flags, '--no-dev --no-scripts --quiet --optimize-autoloader'
    set :composer_roles, :all
    set :composer_dump_autoload_flags, '--optimize'
    set :composer_download_url, "https://getcomposer.org/installer"
  end
end
<commit_msg>Put WordPress code in<commit_after>namespace :wordpress do

  namespace :db do
    desc "Pull the remote database"
    task :pull do
      on roles(:web) do
        within release_path do
          with path: "#{fetch(:path)}:$PATH" do
            execute :wp, "migrate to #{fetch(:tmp_dir)} #{fetch(:local_url)} #{fetch(:tmp_dir)}/database.sql"
            download! "#{fetch(:tmp_dir)}/database.sql", "database.sql"
            execute :rm, "#{fetch(:tmp_dir)}/database.sql"
          end
        end

        run_locally do
          execute "mysql -u #{fetch(:wpdb)[:local][:user]} -p#{fetch(:wpdb)[:local][:password]} -h #{fetch(:wpdb)[:local][:host]} #{fetch(:wpdb)[:local][:name]} < database.sql"
          execute :rm, "database.sql"
        end
      end
    end

    desc "Push the local database"
    task :push do
      on roles(:web) do
        run_locally do
          execute :wp, "db export database.sql"
        end

        upload! "database.sql", "#{fetch(:tmp_dir)}/database.sql"

        run_locally do
          execute :rm, "database.sql"
        end

        within release_path do
          with path: "#{fetch(:path)}:$PATH" do
            execute :wp, "db import #{fetch(:tmp_dir)}/database.sql"
            execute :wp, "search-replace #{fetch(:local_url)} #{fetch(:url)}"
            execute :rm, "#{fetch(:tmp_dir)}/database.sql"
          end
        end
      end
    end

    desc "Push the database in version control"
    task :deploy do
      on roles(:db) do
        upload! "#{fetch(:application)}.sql", "#{fetch(:tmp_dir)}/database.sql"

        within release_path do
          with path: "#{fetch(:path)}:$PATH" do
            execute :wp, "db import #{fetch(:tmp_dir)}/database.sql"
            execute :wp, "search-replace #{fetch(:local_url)} #{fetch(:url)}"
            execute :rm, "#{fetch(:tmp_dir)}/database.sql"
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12721123829344433, 'fraction_numerical': 0.0, 'mean_word_length': 2.630783758262512, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1767879', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1177, 'n_words': 335}