<commit_before>require "capistrano_nrel_ext/actions/install_deploy_files"
require "capistrano_nrel_ext/actions/remote_tests"
require "capistrano_nrel_ext/recipes/shared_children"

Capistrano::Configuration.instance(true).load do
  #
  # Varabiles
  #

  # Set the paths to any rails applications that are part of this project. The
  # key of this hash is the path, relative to latest_release, of the rails
  # application. The value of the hash is the public path this application should
  # be deployed to.
  set :rails_app_paths, {}

  set(:rails_apps) do
    apps = []

    rails_app_paths.each do |app_path, base_uri|
      # Come up with a unique name for this application, suitable for use in
      # file names.
      app_name = app_path.gsub(%r{(^/|/$)}, "").gsub(/[\/\.]/, "-")
      if(app_name.empty?)
        app_name = "app"
      end

      apps << {
        :name => "#{deploy_name}-#{app_name}".gsub(/-+/, "-").gsub(/-$/, ""),
        :path => app_path,
        :base_uri => base_uri,
      }
    end

    apps
  end

  # Setup any shared folders that should be kept between deployments inside a
  # Rails application.
  set :rails_shared_children, %w(log tmp/pids)

  set(:rails_shared_children_dirs) do
    dirs = []

    rails_apps.each do |app|
      rails_shared_children.each do |shared_dir|
        dirs << File.join(app[:path], shared_dir)
      end
    end

    dirs
  end

  # Set any folders or files that need to be writable by the Apache user inside
  # every Rails application. Since this applies to every Rails application, the
  # project-specific "writable_children_dirs" configuration option should be
  # used for any special cases where additional folders need to be writable
  # inside specific Rails applications.
  set :rails_writable_children, %w(log tmp tmp/cache public)

  set(:rails_writable_children_dirs) do
    dirs = []

    rails_apps.each do |app|
      rails_writable_children.each do |writable_dir|
        dirs << File.join(app[:path], writable_dir)
      end
    end

    dirs
  end

  # Set the default Rails environment.
  set :rails_env, "development"

  #
  # Hooks
  #
  after "deploy:update_code", "deploy:rails:config"

  #
  # Tasks
  #
  namespace :deploy do
    namespace :rails do
      desc <<-DESC
        Create any Rails configuration files.
      DESC
      task :config, :roles => :app, :except => { :no_release => true } do
        files = []
        rails_apps.each do |app|
          files << File.join(app[:path], "config/database.yml")
          files << File.join(app[:path], "config/mongoid.yml")
        end

        install_deploy_files(files)
      end
    end

    task :cold do
      update
      schema_load<commit_msg>Add elasticsearch.yml to the list of deploy config files for Rails.<commit_after>require "capistrano_nrel_ext/actions/install_deploy_files"
require "capistrano_nrel_ext/actions/remote_tests"
require "capistrano_nrel_ext/recipes/shared_children"

Capistrano::Configuration.instance(true).load do
  #
  # Varabiles
  #

  # Set the paths to any rails applications that are part of this project. The
  # key of this hash is the path, relative to latest_release, of the rails
  # application. The value of the hash is the public path this application should
  # be deployed to.
  set :rails_app_paths, {}

  set(:rails_apps) do
    apps = []

    rails_app_paths.each do |app_path, base_uri|
      # Come up with a unique name for this application, suitable for use in
      # file names.
      app_name = app_path.gsub(%r{(^/|/$)}, "").gsub(/[\/\.]/, "-")
      if(app_name.empty?)
        app_name = "app"
      end

      apps << {
        :name => "#{deploy_name}-#{app_name}".gsub(/-+/, "-").gsub(/-$/, ""),
        :path => app_path,
        :base_uri => base_uri,
      }
    end

    apps
  end

  # Setup any shared folders that should be kept between deployments inside a
  # Rails application.
  set :rails_shared_children, %w(log tmp/pids)

  set(:rails_shared_children_dirs) do
    dirs = []

    rails_apps.each do |app|
      rails_shared_children.each do |shared_dir|
        dirs << File.join(app[:path], shared_dir)
      end
    end

    dirs
  end

  # Set any folders or files that need to be writable by the Apache user inside
  # every Rails application. Since this applies to every Rails application, the
  # project-specific "writable_children_dirs" configuration option should be
  # used for any special cases where additional folders need to be writable
  # inside specific Rails applications.
  set :rails_writable_children, %w(log tmp tmp/cache public)

  set(:rails_writable_children_dirs) do
    dirs = []

    rails_apps.each do |app|
      rails_writable_children.each do |writable_dir|
        dirs << File.join(app[:path], writable_dir)
      end
    end

    dirs
  end

  # Set the default Rails environment.
  set :rails_env, "development"

  #
  # Hooks
  #
  after "deploy:update_code", "deploy:rails:config"

  #
  # Tasks
  #
  namespace :deploy do
    namespace :rails do
      desc <<-DESC
        Create any Rails configuration files.
      DESC
      task :config, :roles => :app, :except => { :no_release => true } do
        files = []
        rails_apps.each do |app|
          files << File.join(app[:path], "config/database.yml")
          files << File.join(app[:path], "config/elasticsearch.yml")
          files << File.join(app[:path], "config/mongoid.yml")
        end

        install_deploy_files(files)
      end
    end

    task :cold do
      update
      schema_load
{'fraction_non_alphanumeric': 0.10399710616748056, 'fraction_numerical': 0.0, 'mean_word_length': 2.792866941015089, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 15, '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': '919158', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1713, 'n_words': 516}