Skip to content

Commit

Permalink
split gem into database_cleaner-core and database_cleaner metagem.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Feb 2, 2020
1 parent 22192c8 commit 0b3491b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gemspec
gemspec name: "database_cleaner-core"

gem "byebug"
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
database_cleaner (2.0.0.beta)
database_cleaner-core (2.0.0.beta)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -84,7 +84,7 @@ DEPENDENCIES
bundler
byebug
cucumber
database_cleaner!
database_cleaner-core!
guard-rspec
listen
rake
Expand Down
38 changes: 9 additions & 29 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
require "rubygems"
require "bundler"
require "bundler/gem_tasks"
Bundler.setup

require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end

RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end

# testing
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

desc "Cleans the project of any tmp file that should not be included in the gemspec."
task :clean do
["examples/config/database.yml", "examples/db/activerecord_one.db", "examples/db/activerecord_two.db", "examples/db/datamapper_default.db",
"examples/db/datamapper_one.db", "examples/db/datamapper_two.db"].each do |f|
FileUtils.rm_f(f)
end
%w[*.sqlite3 *.log #* *.swp *.swo].each do |pattern|
`find . -name "#{pattern}" -delete`
end
end
# releasing
require "rake/clean"
CLOBBER.include "pkg"
require "bundler/gem_helper"
Bundler::GemHelper.install_tasks name: :database_cleaner
Bundler::GemHelper.install_tasks name: :"database_cleaner-core"

desc "Cleans the dir and builds the gem"
task :prep => [:clean, :gemspec, :build]
30 changes: 30 additions & 0 deletions database_cleaner-core.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "database_cleaner/version"

Gem::Specification.new do |spec|
spec.name = "database_cleaner-core"
spec.version = DatabaseCleaner::VERSION
spec.authors = ["Ben Mabey", "Ernesto Tagwerker"]
spec.email = ["[email protected]"]

spec.summary = "Strategies for cleaning databases. Can be used to ensure a clean slate for testing."
spec.description = "Strategies for cleaning databases. Can be used to ensure a clean slate for testing."
spec.homepage = "https://github.com/DatabaseCleaner/database_cleaner"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "rake"
spec.add_development_dependency "bundler"
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency "listen"
spec.add_development_dependency "rspec"
spec.add_development_dependency "cucumber"
end
19 changes: 2 additions & 17 deletions database_cleaner.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "database_cleaner/version"
require_relative "./lib/database_cleaner/version"

Gem::Specification.new do |spec|
spec.name = "database_cleaner"
Expand All @@ -14,17 +11,5 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/DatabaseCleaner/database_cleaner"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "rake"
spec.add_development_dependency "bundler"
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency "listen"
spec.add_development_dependency "rspec"
spec.add_development_dependency "cucumber"
spec.add_dependency "database_cleaner-active_record"
end
1 change: 1 addition & 0 deletions lib/database_cleaner-core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty file to avoid LoadError if someone requires database_cleaner-core directly

0 comments on commit 0b3491b

Please sign in to comment.