Sha256: 9906d262c064069fecd72fff1163c6606a0f602c567d62d57af6a63be2422d89

Contents?: true

Size: 967 Bytes

Versions: 30

Compression:

Stored size: 967 Bytes

Contents

require 'shellwords'
require 'alchemy/seeder'
require 'alchemy/tasks/helpers'

namespace :alchemy do
  namespace :db do
    include Alchemy::Tasks::Helpers

    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

30 entries across 30 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.6 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.5 lib/tasks/alchemy/db.rake
alchemy_cms-4.5.1 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.5 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.4 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.3 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.2 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.1 lib/tasks/alchemy/db.rake
alchemy_cms-4.6.0 lib/tasks/alchemy/db.rake
alchemy_cms-4.5.0 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.4 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.3 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.2 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.1 lib/tasks/alchemy/db.rake
alchemy_cms-4.4.0 lib/tasks/alchemy/db.rake
alchemy_cms-4.3.2 lib/tasks/alchemy/db.rake
alchemy_cms-4.2.4 lib/tasks/alchemy/db.rake
alchemy_cms-4.3.1 lib/tasks/alchemy/db.rake
alchemy_cms-4.2.3 lib/tasks/alchemy/db.rake