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

Version Path
alchemy_cms-4.0.6 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.7 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.6 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.5 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.4 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.3 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.5 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.2 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.1 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.4 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.0 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.3 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.2 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.0.rc2 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.0.rc1 lib/tasks/alchemy/db.rake
alchemy_cms-3.6.1 lib/tasks/alchemy/db.rake
alchemy_cms-4.0.0.beta lib/tasks/alchemy/db.rake
alchemy_cms-3.6.0 lib/tasks/alchemy/db.rake
alchemy_cms-3.5.0 lib/tasks/alchemy/db.rake
alchemy_cms-3.5.0.rc2 lib/tasks/alchemy/db.rake