fix gem loading situation.

This commit is contained in:
Micah Geisel 2020-02-03 08:41:02 -08:00 committed by Micah Geisel
parent 21374afb35
commit 77dece1e14
8 changed files with 41 additions and 42 deletions

View file

@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
f.match(%r{^(test|spec|features|examples)/})
end - ["lib/database_cleaner.rb"] # should only exist in database_cleaner gem
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
@ -27,4 +27,3 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec"
spec.add_development_dependency "cucumber"
end

View file

@ -11,5 +11,8 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/DatabaseCleaner/database_cleaner"
spec.license = "MIT"
spec.files = ["lib/database_cleaner.rb"]
spec.require_paths = ["lib"]
spec.add_dependency "database_cleaner-active_record"
end

View file

@ -1,12 +1,11 @@
#Hilarious as it seems, this is necessary so bundle exec cucumber works for mongoid cukeage (I'm assuming mongomapper is automatically present because its a git repo)
Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
require 'rubygems'
require 'bundler'
Bundler.setup
require 'rspec/expectations'
#require 'ruby-debug'
#require 'byebug'
DB_DIR = "#{File.dirname(__FILE__)}/../../db"
@ -29,7 +28,7 @@ if orm && strategy
require "database_cleaner-#{orm.underscore}"
else
$:.unshift(File.dirname(__FILE__) + '/../../../lib')
require "database_cleaner"
require "database_cleaner-core"
end
if another_orm

View file

@ -1,4 +1,4 @@
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
require 'database_cleaner'
require 'database_cleaner-core'
require 'rspec/expectations'

View file

@ -1 +1 @@
# empty file to avoid LoadError if someone requires database_cleaner-core directly
require "database_cleaner/core"

View file

@ -1,34 +1,2 @@
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
require 'database_cleaner/version'
require 'database_cleaner/configuration'
require 'database_cleaner/deprecation'
require 'forwardable'
require "database_cleaner/active_record"
module DatabaseCleaner
class << self
extend Forwardable
delegate [
:[],
:app_root=,
:app_root,
:logger=,
:logger,
:cleaners,
:cleaners=,
:strategy=,
:orm=,
:start,
:clean,
:clean_with,
:cleaning,
] => :configuration
attr_accessor :allow_remote_database_url, :allow_production, :url_whitelist
private
def configuration
@configuration ||= Configuration.new
end
end
end

View file

@ -0,0 +1,30 @@
require 'database_cleaner/version'
require 'database_cleaner/configuration'
require 'database_cleaner/deprecation'
require 'forwardable'
module DatabaseCleaner
class << self
extend Forwardable
delegate [
:[],
:cleaners,
:cleaners=,
:strategy=,
:orm=,
:start,
:clean,
:clean_with,
:cleaning,
] => :configuration
attr_accessor :allow_remote_database_url, :allow_production, :url_whitelist
private
def configuration
@configuration ||= Configuration.new
end
end
end

View file

@ -1,5 +1,5 @@
require "bundler/setup"
require "database_cleaner"
require "database_cleaner-core"
require "byebug"
RSpec.configure do |config|