<commit_before>require 'erb'

after 'deploy:setup', 'deploy:create_shared_config_dir'
after "deploy:setup", "deploy:db:create_config"
# after "deploy:setup", "deploy:set_file_permissions"
after "deploy:update_code", "deploy:db:symlink_config"
after "deploy:update_code", "mongrel:create_config_file_symlink"
after "deploy:symlink", "deploy:build_public_symlinks"
after "deploy:symlink", "mongrel:restart"

namespace :deploy do
  namespace :db do
    desc "Runs rake db:create on remote server"
    task :create do
      run "cd #{current_path} && #{app_framework}_ENV=#{mongrel_environment} rake db:create"
    end
    
    desc "Auto-generate production database.yml"
    task :create_config do
      db_config = ERB.new <<-EOF
      production:
        adapter: mysql
        database: #{db_name}
        username: #{db_user}
        password: <PASSWORD>}
        host: localhost
      EOF
      put db_config.result, "#{shared_config_path}/database.yml"
    end
    
    desc "Create a symlink to the database yaml file"
    task :symlink_config do
      run "ln -nfs #{shared_config_path}/database.yml #{release_path}/config/database.yml"
    end
  end

  task :restart do
    eval("#{app_server.to_s}.restart")
  end
  
  task :start do
    eval("#{app_server.to_s}.start")
  end
  
  task :stop do
    eval("#{app_server.to_s}.stop")
  end

  desc "Shows tail of production log"
  task :tail do
    stream "tail -f #{current_path}/log/#{app_environment}.log"
  end
  
  desc "Creates the shared config file directory"
  task :create_shared_config_dir do
    run "mkdir -p #{shared_config_path}"
  end
  
  desc "Copy production database.yml to live app"
  task :copy_config_files do    
    config_files.each do |file|
      run "cp #{shared_path}/config/#{file} #{release_path}/config/"
    end
  end
  
  task :build_public_symlinks do
    run "mkdir -p #{shared_path}/system/photos"
    run "ln -nfs #{shared_path}/system/photos #{release_path}/public/photos"
    run "mkdir -p #{shared_path}/system/videos"
    run "ln -nfs #{shared_path}/system/videos #{release_path}/public/videos"
  end
end<commit_msg>deleted deploy:copy_config_files task<commit_after>require 'erb'

after 'deploy:setup', 'deploy:create_shared_config_dir'
after "deploy:setup", "deploy:db:create_config"
# after "deploy:setup", "deploy:set_file_permissions"
after "deploy:update_code", "deploy:db:symlink_config"
after "deploy:update_code", "mongrel:create_config_file_symlink"
after "deploy:symlink", "deploy:build_public_symlinks"
after "deploy:symlink", "mongrel:restart"

namespace :deploy do
  namespace :db do
    desc "Runs rake db:create on remote server"
    task :create do
      run "cd #{current_path} && #{app_framework}_ENV=#{mongrel_environment} rake db:create"
    end
    
    desc "Auto-generate production database.yml"
    task :create_config do
      db_config = ERB.new <<-EOF
      production:
        adapter: mysql
        database: #{db_name}
        username: #{db_user}
        password: #{<PASSWORD>}
        host: localhost
      EOF
      put db_config.result, "#{shared_config_path}/database.yml"
    end
    
    desc "Create a symlink to the database yaml file"
    task :symlink_config do
      run "ln -nfs #{shared_config_path}/database.yml #{release_path}/config/database.yml"
    end
  end

  task :restart do
    eval("#{app_server.to_s}.restart")
  end
  
  task :start do
    eval("#{app_server.to_s}.start")
  end
  
  task :stop do
    eval("#{app_server.to_s}.stop")
  end

  desc "Shows tail of production log"
  task :tail do
    stream "tail -f #{current_path}/log/#{app_environment}.log"
  end
  
  desc "Creates the shared config file directory"
  task :create_shared_config_dir do
    run "mkdir -p #{shared_config_path}"
  end
  
  task :build_public_symlinks do
    run "mkdir -p #{shared_path}/system/photos"
    run "ln -nfs #{shared_path}/system/photos #{release_path}/public/photos"
    run "mkdir -p #{shared_path}/system/videos"
    run "ln -nfs #{shared_path}/system/videos #{release_path}/public/videos"
  end
end
{'fraction_non_alphanumeric': 0.11763255240443897, 'fraction_numerical': 0.0, 'mean_word_length': 3.6782006920415227, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '6913978', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1345, 'n_words': 336}