<commit_before>$LOAD_PATH << './lib'

require 'logger'
require 'cas_fuji'
require 'sinatra/activerecord/rake'

namespace :casfuji do
  namespace :db do
    task :config do 
      require './lib/cas_fuji'
      ActiveRecord::Migration.verbose = true
      ActiveRecord::Base.logger = Logger.new(STDOUT)
      ActiveRecord::Base.establish_connection(CasFuji.config[:database])
      ap CasFuji.config[:database]
    end

    task :create => :config do
      ActiveRecord::Base.connection.create_database(CasFuji.config[:database])
    end

    task :drop => :config do
      ActiveRecord::Base.connection.drop_database(CasFuji.config[:database])
    end

    desc "Bring your CasFuji server database schema up to date (options CAS_FUJI_CONFIG=/path/to/config.yml)"
    task :migrate => :config do |t|
      #CASServer::Model::Base.logger = Logger.new(STDOUT)
      ActiveRecord::Migration.verbose = true
      ActiveRecord::Migrator.migrate("lib/db/migrate")
    end
  end
end<commit_msg>Adds working cas_fuji:db:migrate rake task, although cas_fuji:db:create and cas_fuji:db:drop don't work locally<commit_after>$LOAD_PATH << './lib'

require 'logger'
require 'cas_fuji'
require 'sinatra/activerecord/rake'

namespace :casfuji do
  namespace :db do
    task :config do 
      require './lib/cas_fuji'
      ActiveRecord::Migration.verbose = true
      ActiveRecord::Base.logger = Logger.new(STDOUT)
      ActiveRecord::Base.establish_connection(CasFuji.config[:database].merge('database' => 'template1'))
    end

    task :create => :config do
      ActiveRecord::Base.connection.create_database(CasFuji.config[:database])
    end

    task :drop => :config do
      ActiveRecord::Base.connection.drop_database(CasFuji.config[:database])
    end

    desc "Bring your CasFuji server database schema up to date (options CAS_FUJI_CONFIG=/path/to/config.yml)"
    # task :migrate => :config do |t|
    #   #CASServer::Model::Base.logger = Logger.new(STDOUT)
    #   ActiveRecord::Migration.verbose = true
    #   puts ActiveRecord::Migrator.method(:migrate).source_location
    #   ActiveRecord::Migrator.migrate("lib/db/migrate")
    # end

    task :migrate do
      ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
    end
  end
end
{'fraction_non_alphanumeric': 0.12279929577464789, 'fraction_numerical': 0.00044014084507042255, 'mean_word_length': 3.91991341991342, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '6916004', 'n_tokens_mistral': 755, 'n_tokens_neox': 719, 'n_words': 147}