diff --git a/Gemfile b/Gemfile index 0b98f7b..ec415ae 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ -gemspec +gemspec name: "database_cleaner-core" gem "byebug" diff --git a/Gemfile.lock b/Gemfile.lock index 7519c50..a9761aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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/ @@ -84,7 +84,7 @@ DEPENDENCIES bundler byebug cucumber - database_cleaner! + database_cleaner-core! guard-rspec listen rake diff --git a/Rakefile b/Rakefile index 97879de..c6daf51 100644 --- a/Rakefile +++ b/Rakefile @@ -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] diff --git a/database_cleaner-core.gemspec b/database_cleaner-core.gemspec new file mode 100644 index 0000000..65b5119 --- /dev/null +++ b/database_cleaner-core.gemspec @@ -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 = ["ernesto@ombulabs.com"] + + 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 + diff --git a/database_cleaner.gemspec b/database_cleaner.gemspec index ad8f4d8..e8c7a06 100644 --- a/database_cleaner.gemspec +++ b/database_cleaner.gemspec @@ -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" @@ -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 diff --git a/lib/database_cleaner-core.rb b/lib/database_cleaner-core.rb new file mode 100644 index 0000000..9b65f62 --- /dev/null +++ b/lib/database_cleaner-core.rb @@ -0,0 +1 @@ +# empty file to avoid LoadError if someone requires database_cleaner-core directly