<commit_before>Capistrano::Configuration.instance(:must_exist).load do
  set :shared_content_path, -> { "#{fetch :shared_path}/shared_contents" }

  namespace :content do
    desc 'setup the content folders'
    task :setup, :roles => :app do
      commands = "#{try_sudo} mkdir -p #{fetch :shared_content_path};"
      fetch(:content_folders, []).each do |folder, path|
        commands << "#{try_sudo} mkdir -p #{fetch :shared_content_path}/#{folder};"
      end

      run commands
    end

    desc 'Import content'
    task :import, :roles => :app do
      tmp_file = random_tmp_file
      on_rollback { run "rm -f #{tmp_file}" }

      transaction do
        backup
        write File.read(arguments), tmp_file
        run <<-CMD
          cd #{fetch :shared_content_path} &&
          tar xf #{tmp_file} &&
          rm -f #{tmp_file}
        CMD
        clean
      end
    end

    desc 'Export content'
    task :export, :roles => :app do
      tmp_file = "#{random_tmp_file}.tar.gz"
      on_rollback { run "rm -f #{fetch :latest_content_backup}" }
      on_rollback { run_locally "rm -f #{tmp_file}" }

      transaction do
        backup<commit_msg>If an argument was given, use that as the filename<commit_after>Capistrano::Configuration.instance(:must_exist).load do
  set :shared_content_path, -> { "#{fetch :shared_path}/shared_contents" }

  namespace :content do
    desc 'setup the content folders'
    task :setup, :roles => :app do
      commands = "#{try_sudo} mkdir -p #{fetch :shared_content_path};"
      fetch(:content_folders, []).each do |folder, path|
        commands << "#{try_sudo} mkdir -p #{fetch :shared_content_path}/#{folder};"
      end

      run commands
    end

    desc 'Import content'
    task :import, :roles => :app do
      tmp_file = random_tmp_file
      on_rollback { run "rm -f #{tmp_file}" }

      transaction do
        backup
        write File.read(arguments.first), tmp_file
        run <<-CMD
          cd #{fetch :shared_content_path} &&
          tar xf #{tmp_file} &&
          rm -f #{tmp_file}
        CMD
        clean
      end
    end

    desc 'Export content'
    task :export, :roles => :app do
      tmp_file = "#{arguments(false).first || random_tmp_file}"
      tmp_file << '.tar.gz' unless tmp_file =~ /\.tar\.gz$/
      on_rollback { run "rm -f #{fetch :latest_content_backup}" }
      on_rollback { run_locally "rm -f #{tmp_file}" }

      transaction do
        backup
{'fraction_non_alphanumeric': 0.12510220768601799, 'fraction_numerical': 0.0, 'mean_word_length': 2.5007153075822606, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '6117710', 'n_tokens_mistral': 785, 'n_tokens_neox': 763, 'n_words': 214}