namespace :db do

namespace :fixtures do
  desc 'Dumps all models into fixtures.'
  task :dump, [:path, :included, :excluded] => :environment do |t, args|
    path = args[:path].to_s
    included = args[:included].to_s.split(" ")
    excluded = args[:excluded].to_s.split(" ")
    yaml_creator = SmartDump::YamlCreator.new(
      path: path, included_models: included, excluded_models: excluded
    )

    yaml_creator.dump_models!
  end

  desc 'Loads fixtures into database'
  task :seed, [:path] => :environment do |t, args|
    path = args.fetch(:path)

    yaml_loader = SmartDump::YamlLoader.new(path)

    yaml_loader.load_fixtures!
  end
end

end