<commit_before>Capistrano::Configuration.instance(:must_exist).load do

  require 'erb'

  # =========================================================================
  # Settings
  # =========================================================================

  _cset :shared_app_dirs, []
  _cset(:cakephp_branch)  { "master" }
  _cset(:cakephp_repo)    { "https://github.com/cakephp/cakephp.git" }
  _cset :cakephp_version, 2
  _cset :tmp_children,    %w(cache logs sessions tests)
  _cset :cache_children,  %w(models persistent views)
  _cset :logs_files,      %w(debug error)
  _cset(:tmp_path)        { File.join(shared_path, "tmp") }
  _cset(:cache_path)      { File.join(tmp_path, "cache") }
  _cset(:logs_path)       { File.join(tmp_path, "logs") }
  if cakephp_version >= 2
    set :shared_children,       %w(Config tmp)
    set :database_partial_path, "Config/database.php"
  else
    set :shared_children,       %w(config tmp)
    set :database_partial_path, "config/database.php"
  end
  set(:database_path)     { File.join(shared_path, database_partial_path) }

  # =========================================================================
  # Hooks
  # =========================================================================

  after('deploy:setup',           'cakephp:setup')
  after('deploy:create_symlink',  'cakephp:create_symlink')
  after('deploy:finalize_update', 'cakephp:cache:clear')

  # =========================================================================
  # Tasks
  # =========================================================================

  namespace :cakephp do

    desc <<-DESC
      Prepares server for deployment of a CakePHP application. \

      By default, it will create a shallow clone of the CakePHP repository \
      inside #{shared_path}/cakephp and run deploy:cake:update.
    DESC
    task :setup do
      transaction do
        run "cd #{shared_path} && git clone --depth 1 #{cakephp_repo} cakephp"
        checkout
        shared.setup
        database.config.setup
      end
    end

    desc <<-DESC
      Checkout a new branch/tag.
    DESC
    task :checkout do
      stream "cd #{shared_path}/cakephp && git checkout -q #{cakephp_branch}"
    end

    desc <<-DESC
      Update the cake repository to the latest version.
    DESC
    task :update do
      stream "cd #{shared_path}/cakephp && git pull"
    end

    desc <<-DESC
      This is a task that will get called from the deploy:create_symlink task \
      It runs just before the release is symlinked to the current directory \<commit_msg>fixing incorrect namespace call for database.config<commit_after>Capistrano::Configuration.instance(:must_exist).load do

  require 'erb'

  # =========================================================================
  # Settings
  # =========================================================================

  _cset :shared_app_dirs, []
  _cset(:cakephp_branch)  { "master" }
  _cset(:cakephp_repo)    { "https://github.com/cakephp/cakephp.git" }
  _cset :cakephp_version, 2
  _cset :tmp_children,    %w(cache logs sessions tests)
  _cset :cache_children,  %w(models persistent views)
  _cset :logs_files,      %w(debug error)
  _cset(:tmp_path)        { File.join(shared_path, "tmp") }
  _cset(:cache_path)      { File.join(tmp_path, "cache") }
  _cset(:logs_path)       { File.join(tmp_path, "logs") }
  if cakephp_version >= 2
    set :shared_children,       %w(Config tmp)
    set :database_partial_path, "Config/database.php"
  else
    set :shared_children,       %w(config tmp)
    set :database_partial_path, "config/database.php"
  end
  set(:database_path)     { File.join(shared_path, database_partial_path) }

  # =========================================================================
  # Hooks
  # =========================================================================

  after('deploy:setup',           'cakephp:setup')
  after('deploy:create_symlink',  'cakephp:create_symlink')
  after('deploy:finalize_update', 'cakephp:cache:clear')

  # =========================================================================
  # Tasks
  # =========================================================================

  namespace :cakephp do

    desc <<-DESC
      Prepares server for deployment of a CakePHP application. \

      By default, it will create a shallow clone of the CakePHP repository \
      inside #{shared_path}/cakephp and run deploy:cake:update.
    DESC
    task :setup do
      transaction do
        run "cd #{shared_path} && git clone --depth 1 #{cakephp_repo} cakephp"
        checkout
        shared.setup
        database.config
      end
    end

    desc <<-DESC
      Checkout a new branch/tag.
    DESC
    task :checkout do
      stream "cd #{shared_path}/cakephp && git checkout -q #{cakephp_branch}"
    end

    desc <<-DESC
      Update the cake repository to the latest version.
    DESC
    task :update do
      stream "cd #{shared_path}/cakephp && git pull"
    end

    desc <<-DESC
      This is a task that will get called from the deploy:create_symlink task \
      It runs just before the release is symlinked to the current directory \
{'fraction_non_alphanumeric': 0.25757575757575757, 'fraction_numerical': 0.0011655011655011655, 'mean_word_length': 3.680909090909091, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '665709', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1391, 'n_words': 369}