<commit_before>require 'rubygems'
gem 'rspec', '>=1.1.3'
require 'spec'
require 'pathname'

require Pathname(__FILE__).dirname.expand_path.parent + 'lib/data_mapper'
require DataMapper.root / 'spec' / 'lib' / 'mock_adapter'

# setup mock adapters
[ :default, :mock, :legacy, :west_coast, :east_coast ].each do |repository_name|
  DataMapper.setup(repository_name, "mock://localhost/#{repository_name}")
end

def setup_adapter(name, default_uri)
  begin
    DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
    Object.const_set('ADAPTER', ENV['ADAPTER'].to_sym) if name.to_s == ENV['ADAPTER']
    true
  rescue Exception => e
    if name.to_s == ENV['ADAPTER']
      Object.const_set('ADAPTER', nil)
      warn "Could not load #{name} adapter: #{e}"
    end
    false
  end
end

ENV['ADAPTER'] ||= 'sqlite3'

HAS_SQLITE3  = setup_adapter(:sqlite3,  'sqlite3::memory:')
HAS_MYSQL    = setup_adapter(:mysql,    'mysql://dm_core_test:dm_core_test@localhost/dm_core_test')
HAS_POSTGRES = setup_adapter(:postgres, 'postgres://postgres@localhost/dm_core_test')

DataMapper::Logger.new(nil, :debug)

class Article
  include DataMapper::Resource<commit_msg>Changing mysql adapter line back to what it was.<commit_after>require 'rubygems'
gem 'rspec', '>=1.1.3'
require 'spec'
require 'pathname'

require Pathname(__FILE__).dirname.expand_path.parent + 'lib/data_mapper'
require DataMapper.root / 'spec' / 'lib' / 'mock_adapter'

# setup mock adapters
[ :default, :mock, :legacy, :west_coast, :east_coast ].each do |repository_name|
  DataMapper.setup(repository_name, "mock://localhost/#{repository_name}")
end

def setup_adapter(name, default_uri)
  begin
    DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
    Object.const_set('ADAPTER', ENV['ADAPTER'].to_sym) if name.to_s == ENV['ADAPTER']
    true
  rescue Exception => e
    if name.to_s == ENV['ADAPTER']
      Object.const_set('ADAPTER', nil)
      warn "Could not load #{name} adapter: #{e}"
    end
    false
  end
end

ENV['ADAPTER'] ||= 'sqlite3'

HAS_SQLITE3  = setup_adapter(:sqlite3,  'sqlite3::memory:')
HAS_MYSQL    = setup_adapter(:mysql,    'mysql://localhost/dm_core_test')
HAS_POSTGRES = setup_adapter(:postgres, 'postgres://postgres@localhost/dm_core_test')

DataMapper::Logger.new(nil, :debug)

class Article
  include DataMapper::Resource
{'fraction_non_alphanumeric': 0.15061518879932118, 'fraction_numerical': 0.005939753924480272, 'mean_word_length': 5.238095238095238, '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': '4290869', 'n_tokens_mistral': 844, 'n_tokens_neox': 849, 'n_words': 167}