Sha256: d3b2f95430a80e292ec31e5d5a4ef57e324fbc5ac79e6840298abd9b0cc53a68
Contents?: true
Size: 962 Bytes
Versions: 21
Compression:
Stored size: 962 Bytes
Contents
require 'shellwords' require 'alchemy/seeder' require 'alchemy/tasks/helpers' include Alchemy::Tasks::Helpers namespace :alchemy do namespace :db do desc "Seeds the database with Alchemy defaults" task seed: [:environment] do Alchemy::Seeder.seed! end desc "Dumps the database to STDOUT (Pass DUMP_FILENAME to store the dump into a file)." task dump: :environment do dump_store = ENV['DUMP_FILENAME'] ? " > #{ENV['DUMP_FILENAME']}" : "" dump_cmd = database_dump_command(database_config['adapter']) system "#{dump_cmd}#{dump_store}" end desc "Imports the database from STDIN (Pass DUMP_FILENAME to read the dump from file)." task import: :environment do dump_store = ENV['DUMP_FILENAME'] ? "cat #{ENV['DUMP_FILENAME']}" : "echo #{Shellwords.escape(STDIN.read)}" import_cmd = database_import_command(database_config['adapter']) system "#{dump_store} | #{import_cmd}" end end end
Version data entries
21 entries across 21 versions & 1 rubygems