<commit_before>Capistrano::Configuration.instance(:must_exist).load do
  namespace :multistage do
    namespace :sync do
      # Synchronisations tasks
      # Don't you just love metaprogramming? I know I fucking do!
      stages.each do |target_stage|
        stages.reject { |s| s == target_stage }.each do |source_stage|
          desc "Synchronise #{target_stage}'s database with #{source_stage}"
          task "#{target_stage}_database_with_#{source_stage}", :roles => :db do
            # Ask for a confirmation
            ask_for_confirmation "I am going to synchronise '#{target_stage}' database with '#{source_stage}', it means I will overwrite the database of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'

            # Generate a random folder name
            random_folder = random_tmp_file

            # Create the folder
            FileUtils.mkdir_p random_folder

            # Get the database of the source
            system "bundle exec cap #{source_stage} db:export #{random_folder}/database.sql"

            # Send it to the target
            system "bundle exec cap #{target_stage} db:import #{random_folder}/database.sql"

            # Remove the entire folder
            FileUtils.rm_rf random_folder
          end

          desc "Synchronise #{target_stage}'s contents with #{source_stage}"
          task "#{target_stage}_contents_with_#{source_stage}", :roles => :app do
            # Ask for a confirmation
            ask_for_confirmation "I am going to synchronise '#{target_stage}' contents with '#{source_stage}', it means I will overwrite the contents of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'

            # Generate a random folder name
            random_folder = random_tmp_file

            # Create the folder
            FileUtils.mkdir_p random_folder

            # Get the contents of the source
            system "bundle exec cap #{source_stage} content:export #{random_folder}/contents.tar.gz"

            # Send them to the target
            system "bundle exec cap #{target_stage} content:import #{random_folder}/contents.tar.gz"

            # Remove the entire folder
            FileUtils.rm_rf random_folder
          end

          desc "Synchronise #{target_stage} with #{source_stage}"
          task "#{target_stage}_with_#{source_stage}", :roles => [:app, :db], :except => { :no_release => true } do<commit_msg>bunzip the SQL file<commit_after>Capistrano::Configuration.instance(:must_exist).load do
  namespace :multistage do
    namespace :sync do
      # Synchronisations tasks
      # Don't you just love metaprogramming? I know I fucking do!
      stages.each do |target_stage|
        stages.reject { |s| s == target_stage }.each do |source_stage|
          desc "Synchronise #{target_stage}'s database with #{source_stage}"
          task "#{target_stage}_database_with_#{source_stage}", :roles => :db do
            # Ask for a confirmation
            ask_for_confirmation "I am going to synchronise '#{target_stage}' database with '#{source_stage}', it means I will overwrite the database of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'

            # Generate a random folder name
            random_folder = random_tmp_file

            # Create the folder
            FileUtils.mkdir_p random_folder

            # Get the database of the source
            system "bundle exec cap #{source_stage} db:export #{random_folder}/database.sql"
            system "bunzip2 #{random_folder}/database.sql.bz2"

            # Send it to the target
            system "bundle exec cap #{target_stage} db:import #{random_folder}/database.sql"

            # Remove the entire folder
            FileUtils.rm_rf random_folder
          end

          desc "Synchronise #{target_stage}'s contents with #{source_stage}"
          task "#{target_stage}_contents_with_#{source_stage}", :roles => :app do
            # Ask for a confirmation
            ask_for_confirmation "I am going to synchronise '#{target_stage}' contents with '#{source_stage}', it means I will overwrite the contents of '#{target_stage}' with those of '#{source_stage}', are you really sure you would like to continue (Yes, [No], Abort)", default:'N'

            # Generate a random folder name
            random_folder = random_tmp_file

            # Create the folder
            FileUtils.mkdir_p random_folder

            # Get the contents of the source
            system "bundle exec cap #{source_stage} content:export #{random_folder}/contents.tar.gz"

            # Send them to the target
            system "bundle exec cap #{target_stage} content:import #{random_folder}/contents.tar.gz"

            # Remove the entire folder
            FileUtils.rm_rf random_folder
          end

          desc "Synchronise #{target_stage} with #{source_stage}"
          task "#{target_stage}_with_#{source_stage}", :roles => [:app, :db], :except => { :no_release => true } do
{'fraction_non_alphanumeric': 0.09408135723925197, 'fraction_numerical': 0.000385579332947754, 'mean_word_length': 2.7057142857142855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3943543', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1349, 'n_words': 473}