mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
fix gem loading situation.
This commit is contained in:
parent
21374afb35
commit
77dece1e14
8 changed files with 41 additions and 42 deletions
|
@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
||||||
spec.license = "MIT"
|
spec.license = "MIT"
|
||||||
|
|
||||||
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
||||||
f.match(%r{^(test|spec|features)/})
|
f.match(%r{^(test|spec|features|examples)/})
|
||||||
end
|
end - ["lib/database_cleaner.rb"] # should only exist in database_cleaner gem
|
||||||
spec.bindir = "exe"
|
spec.bindir = "exe"
|
||||||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||||
spec.require_paths = ["lib"]
|
spec.require_paths = ["lib"]
|
||||||
|
@ -27,4 +27,3 @@ Gem::Specification.new do |spec|
|
||||||
spec.add_development_dependency "rspec"
|
spec.add_development_dependency "rspec"
|
||||||
spec.add_development_dependency "cucumber"
|
spec.add_development_dependency "cucumber"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,8 @@ Gem::Specification.new do |spec|
|
||||||
spec.homepage = "https://github.com/DatabaseCleaner/database_cleaner"
|
spec.homepage = "https://github.com/DatabaseCleaner/database_cleaner"
|
||||||
spec.license = "MIT"
|
spec.license = "MIT"
|
||||||
|
|
||||||
|
spec.files = ["lib/database_cleaner.rb"]
|
||||||
|
spec.require_paths = ["lib"]
|
||||||
|
|
||||||
spec.add_dependency "database_cleaner-active_record"
|
spec.add_dependency "database_cleaner-active_record"
|
||||||
end
|
end
|
||||||
|
|
|
@ -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)
|
#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)
|
Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
|
||||||
|
|
||||||
require 'rubygems'
|
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
|
|
||||||
Bundler.setup
|
Bundler.setup
|
||||||
require 'rspec/expectations'
|
require 'rspec/expectations'
|
||||||
#require 'ruby-debug'
|
#require 'byebug'
|
||||||
|
|
||||||
DB_DIR = "#{File.dirname(__FILE__)}/../../db"
|
DB_DIR = "#{File.dirname(__FILE__)}/../../db"
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ if orm && strategy
|
||||||
require "database_cleaner-#{orm.underscore}"
|
require "database_cleaner-#{orm.underscore}"
|
||||||
else
|
else
|
||||||
$:.unshift(File.dirname(__FILE__) + '/../../../lib')
|
$:.unshift(File.dirname(__FILE__) + '/../../../lib')
|
||||||
require "database_cleaner"
|
require "database_cleaner-core"
|
||||||
end
|
end
|
||||||
|
|
||||||
if another_orm
|
if another_orm
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
||||||
require 'database_cleaner'
|
require 'database_cleaner-core'
|
||||||
|
|
||||||
require 'rspec/expectations'
|
require 'rspec/expectations'
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
# empty file to avoid LoadError if someone requires database_cleaner-core directly
|
require "database_cleaner/core"
|
||||||
|
|
|
@ -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/active_record"
|
||||||
require 'database_cleaner/version'
|
|
||||||
require 'database_cleaner/configuration'
|
|
||||||
require 'database_cleaner/deprecation'
|
|
||||||
require 'forwardable'
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
30
lib/database_cleaner/core.rb
Normal file
30
lib/database_cleaner/core.rb
Normal 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
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
require "database_cleaner"
|
require "database_cleaner-core"
|
||||||
require "byebug"
|
require "byebug"
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue