<commit_before>namespace :db do
  namespace :migrate do
    desc "Runs the Alchemy database migrations"
    task :alchemy => :environment do
      Alchemy::Migrator.create_schema_migrations_table if Alchemy::Migrator.schema_migrations_table_missing?
      if Alchemy::Migrator.available_database_versions.length != Alchemy::Migrator.available_versions.length
        Alchemy::Migrator.run_migration(Alchemy::Migrator.available_versions.max)
      else
        puts "No Migration required."
      end
    end
  end
  
  # TODO: fix schema convertion task
  # namespace :convert do
  #   desc "Convert the schema_migrations table to alchemy layout"
  #   task :alchemy_migrations => :environment do
  #     if Alchemy::Migrator.schema_already_converted?
  #       puts('Already converted')
  #       abort
  #     else
  #       ActiveRecord::Base.connection.update(
  #         "UPDATE #{ActiveRecord::Migrator.schema_migrations_table_name} SET version = INSERT(version, LENGTH(version), 8, '-alchemy') WHERE version IN ('#{Alchemy::Migrator.available_versions.join('\',\'')}')"
  #       )
  #     end
  #   end
  # end
  
end

namespace 'alchemy' do
  
  desc 'Turns everything in Alchemy. Voodooo'
  task 'run_upgrade' do
    Rake::Task['alchemy:upgrades:cleanup'].invoke
    Rake::Task['alchemy:upgrades:environment_file'].invoke
    Rake::Task['alchemy:upgrades:write_rake_task'].invoke
    Rake::Task['alchemy:upgrades:generate_migration'].invoke
    Rake::Task['db:migrate'].invoke
    Rake::Task['alchemy:upgrades:rename_files_and_folders'].invoke
    Rake::Task['alchemy:upgrades:add_locales'].invoke
    Rake::Task['alchemy:upgrades:svn_commit'].invoke
  end
  
  namespace 'migrations' do
    desc "Syncs Alchemy migrations into db/migrate"
    task 'sync' do
      system "rsync -ruv #{File.join(File.dirname(__FILE__), '..', '..', 'db', 'migrate')} #{Rails.root}/db"
    end
  end
  
  namespace 'assets' do
    namespace 'copy' do
      
      desc "Copy all assets for Alchemy into apps public folder"
      task "all" do
        Rake::Task['alchemy:assets:copy:javascripts'].invoke
        Rake::Task['alchemy:assets:copy:stylesheets'].invoke
        Rake::Task['alchemy:assets:copy:images'].invoke
      end
      <commit_msg>adding rake tasks for creating application configfiles and folders for storing page_layouts and elements<commit_after>namespace :db do
  namespace :migrate do
    desc "Runs the Alchemy database migrations"
    task :alchemy => :environment do
      Alchemy::Migrator.create_schema_migrations_table if Alchemy::Migrator.schema_migrations_table_missing?
      if Alchemy::Migrator.available_database_versions.length != Alchemy::Migrator.available_versions.length
        Alchemy::Migrator.run_migration(Alchemy::Migrator.available_versions.max)
      else
        puts "No Migration required."
      end
    end
  end
  
  # TODO: fix schema convertion task
  # namespace :convert do
  #   desc "Convert the schema_migrations table to alchemy layout"
  #   task :alchemy_migrations => :environment do
  #     if Alchemy::Migrator.schema_already_converted?
  #       puts('Already converted')
  #       abort
  #     else
  #       ActiveRecord::Base.connection.update(
  #         "UPDATE #{ActiveRecord::Migrator.schema_migrations_table_name} SET version = INSERT(version, LENGTH(version), 8, '-alchemy') WHERE version IN ('#{Alchemy::Migrator.available_versions.join('\',\'')}')"
  #       )
  #     end
  #   end
  # end
  
end

namespace 'alchemy' do
  
  desc 'Turns everything in Alchemy. Voodooo'
  task 'run_upgrade' do
    Rake::Task['alchemy:upgrades:cleanup'].invoke
    Rake::Task['alchemy:upgrades:environment_file'].invoke
    Rake::Task['alchemy:upgrades:write_rake_task'].invoke
    Rake::Task['alchemy:upgrades:generate_migration'].invoke
    Rake::Task['db:migrate'].invoke
    Rake::Task['alchemy:upgrades:rename_files_and_folders'].invoke
    Rake::Task['alchemy:upgrades:add_locales'].invoke
    Rake::Task['alchemy:upgrades:svn_commit'].invoke
  end
  
  namespace 'migrations' do
    desc "Syncs Alchemy migrations into db/migrate"
    task 'sync' do
      system "rsync -ruv #{File.join(File.dirname(__FILE__), '..', '..', 'db', 'migrate')} #{Rails.root}/db"
    end
  end
  
  namespace 'app_structure' do
    namespace 'create' do
    
      desc "Creates all necessary folders and files needed for creating your own pagelayouts and elements for your website"
      task "all" do
        Rake::Task['alchemy:app_structure:create:config'].invoke
        Rake::Task['alchemy:app_structure:create:page_layouts'].invoke
        Rake::Task['alchemy:app_structure:create:elements'].invoke
      end
      
      desc "Creates alchemys configuration folder including its necessary files."
      task "config" do
        if File.directory? "#{Rails.root}/config/alchemy"
          puts "Task Aborted: Config folder already exists: #{Rails.root}/config/alchemy"
        else
          system "mkdir -p #{Rails.root}/config/alchemy"
          system "rsync -r #{File.join(File.dirname(__FILE__), '..', '..', 'config', 'alchemy', '*')} #{RAILS_ROOT}/config/alchemy/"
          puts "Created folder with configuration files:\n#{Rails.root}/config/alchemy"
        end
      end
      
      desc "Creates alchemys pagelayout folder."
      task "page_layouts" do
        if File.directory? "#{Rails.root}/app/views/page_layouts"
          puts "Task Aborted: page_layouts folder already exists: #{Rails.root}/app/views/page_layouts"
        else
          system "mkdir -p #{Rails.root}/app/views/page_layouts"
        end
      end
      
      desc "Creates alchemys elements folder."
      task "elements" do
        if File.directory? "#{Rails.root}/app/views/elements"
          puts "Task Aborted: elements folder already exists: #{Rails.root}/app/views/elements"
        else
          system "mkdir -p #{Rails.root}/app/views/elements"
        end
      end
      
    end    
  end
  
  namespace 'assets' do
    namespace 'copy' do
      
      desc "Copy all assets for Alchemy into apps public folder"
      task "all" do
        Rake::Task['alchemy:assets:copy:javascripts'].invoke
        Rake::Task['alchemy:assets:copy:stylesheets'].invoke
        Rake::Task['alchemy:assets:copy:images'].invoke
      end
      
{'fraction_non_alphanumeric': 0.11714149291739615, 'fraction_numerical': 0.0003183192742320548, 'mean_word_length': 3.339779005524862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4588636', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1966, 'n_words': 419}