-
-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These tasks were only necessary for the capistrano-alchemy gem, which now can do this without Alchemy's direct help.
- Loading branch information
Showing
1 changed file
with
1 addition
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
# frozen_string_literal: true | ||
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 |