lib/seedbank.rb in seedbank-0.4.0 vs lib/seedbank.rb in seedbank-0.5.0.pre
- old
+ new
@@ -1,22 +1,31 @@
+# frozen_string_literal: true
require 'seedbank/dsl'
require 'seedbank/runner'
module Seedbank
-
class << self
+ attr_writer :application_root, :seeds_root, :nesting, :matcher
- attr_writer :seeds_root
+ def application_root
+ @application_root ||= Pathname.new(Rake.application.original_dir)
+ end
def seeds_root
- @seeds_root ||= 'db/seeds'
+ @seeds_root ||= File.join(application_root, 'db', 'seeds')
end
+ def nesting
+ @nesting ||= 2
+ end
+
+ def matcher
+ @matcher ||= '*.seeds.rb'
+ end
end
def self.load_tasks
- Dir[File.expand_path("tasks/*.rake", File.dirname(__FILE__))].each { |ext| load ext }
+ Dir[File.expand_path('../tasks/*.rake', __FILE__)].each { |ext| load ext }
end
require 'seedbank/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
-
-end
\ No newline at end of file
+end