Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
drupalizer
Commits
587925b4
Commit
587925b4
authored
Mar 25, 2016
by
Emmanuel Milou
Browse files
Add db_restore task
parent
16bff396
Changes
3
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
587925b4
...
@@ -2,6 +2,7 @@ from .deploy import *
...
@@ -2,6 +2,7 @@ from .deploy import *
import
drush
import
drush
import
behat
import
behat
import
docker
import
docker
import
core
from
.environments
import
e
from
.environments
import
e
from
fabric.api
import
lcd
,
cd
,
task
,
roles
,
env
,
local
,
run
,
runs_once
,
execute
from
fabric.api
import
lcd
,
cd
,
task
,
roles
,
env
,
local
,
run
,
runs_once
,
execute
...
...
core.py
0 → 100644
View file @
587925b4
from
__future__
import
unicode_literals
from
fabric.api
import
lcd
,
cd
,
task
,
roles
,
env
,
local
,
run
,
runs_once
,
execute
from
fabric.contrib.console
import
confirm
from
fabric.colors
import
red
,
green
import
helpers
as
h
import
os.path
@
task
@
roles
(
'local'
)
def
db_import
(
filename
,
role
=
'local'
):
"""Import and restore the specified database dump.
$ fab core.db_import:/tmp/db_dump.sql.gz
:param filename: a full path to a gzipped sql dump.
"""
if
os
.
path
.
isfile
(
filename
):
print
green
(
'Database dump {} found.'
.
format
(
filename
))
with
h
.
fab_cd
(
role
,
env
.
site_root
):
h
.
fab_run
(
role
,
'zcat {} | mysql -u{} -p{} -h{} {}'
.
format
(
filename
,
env
.
site_db_user
,
env
.
site_db_pass
,
env
.
container_ip
,
env
.
site_db_name
))
print
(
green
(
'Database dump successfully restored.'
))
else
:
print
red
(
'Could not find database dump at {}'
.
format
(
filename
))
drush.py
View file @
587925b4
...
@@ -163,3 +163,4 @@ def gen_doc(role='local'):
...
@@ -163,3 +163,4 @@ def gen_doc(role='local'):
h
.
fab_run
(
role
,
'asciidoctor -b html5 -o {}/CHANGELOG.html {}/CHANGELOG.adoc'
.
format
(
env
.
workspace
,
env
.
workspace
))
h
.
fab_run
(
role
,
'asciidoctor -b html5 -o {}/CHANGELOG.html {}/CHANGELOG.adoc'
.
format
(
env
.
workspace
,
env
.
workspace
))
print
(
green
(
'CHANGELOG.html generated in {}'
.
format
(
env
.
workspace
)))
print
(
green
(
'CHANGELOG.html generated in {}'
.
format
(
env
.
workspace
)))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment