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
cb54e5fa
Commit
cb54e5fa
authored
Oct 24, 2016
by
Ernesto Rodriguez Ortiz
Browse files
Testing D8
parent
6ad6fb99
Pipeline
#1092
failed with stages
in 1 minute and 16 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
behat.py
View file @
cb54e5fa
...
@@ -12,7 +12,7 @@ def init(rewrite=True):
...
@@ -12,7 +12,7 @@ def init(rewrite=True):
:param role Default 'role' where to run the task
:param role Default 'role' where to run the task
:param rewrite If the behat.yml file should be rewrited or not.
:param rewrite If the behat.yml file should be rewrited or not.
"""
"""
role
=
'docker'
role
=
'docker'
workspace
=
env
.
docker_workspace
workspace
=
env
.
docker_workspace
host
=
env
.
site_hostname
host
=
env
.
site_hostname
...
...
drush.py
View file @
cb54e5fa
...
@@ -46,9 +46,12 @@ def make(action='install'):
...
@@ -46,9 +46,12 @@ def make(action='install'):
drush_opts
=
"--prepare-install "
if
action
!=
'update'
else
''
drush_opts
=
"--prepare-install "
if
action
!=
'update'
else
''
# Update profile codebase
# Update profile codebase
if
env
.
site_profile
and
env
.
site_profile
!=
''
and
not
h
.
is_core_profile
(
env
.
site_profile
):
if
env
.
site_profile
and
env
.
site_profile
!=
''
:
drush_opts
+=
"--contrib-destination=profiles/{} "
.
format
(
env
.
site_profile
)
if
h
.
is_core_profile
(
env
.
site_profile
):
h
.
update_profile
()
drush_opts
+=
"--contrib-destination=sites/all "
else
:
drush_opts
+=
"--contrib-destination=profiles/{} "
.
format
(
env
.
site_profile
)
h
.
update_profile
()
if
not
env
.
get
(
'always_use_pty'
,
True
):
if
not
env
.
get
(
'always_use_pty'
,
True
):
drush_opts
+=
"--translations="
+
env
.
site_languages
+
" "
drush_opts
+=
"--translations="
+
env
.
site_languages
+
" "
...
@@ -119,13 +122,17 @@ def site_install():
...
@@ -119,13 +122,17 @@ def site_install():
site_admin_name
=
env
.
site_admin_user
site_admin_name
=
env
.
site_admin_user
site_admin_pass
=
env
.
site_admin_pass
site_admin_pass
=
env
.
site_admin_pass
site_subdir
=
env
.
site_subdir
site_subdir
=
env
.
site_subdir
base_url
=
env
.
site_hostname
# Create first the database if necessary
# Create first the database if necessary
h
.
init_db
(
'docker'
)
h
.
init_db
(
'docker'
)
with
h
.
fab_cd
(
role
,
site_root
):
with
h
.
fab_cd
(
role
,
site_root
):
locale
=
'--locale="fr"'
if
env
.
locale
else
''
locale
=
'--locale="fr"'
if
env
.
locale
else
''
# Drupal 8 only
h
.
fab_run
(
role
,
'cp sites/example.sites.php sites/sites.php'
)
h
.
fab_run
(
role
,
'composer install'
)
# end D8
h
.
fab_run
(
role
,
'sudo -u {} drush site-install {} {} --db-url=mysql://{}:{}@{}/{} --site-name="{}" '
h
.
fab_run
(
role
,
'sudo -u {} drush site-install {} {} --db-url=mysql://{}:{}@{}/{} --site-name="{}" '
'--account-name={} --account-pass={} --sites-subdir={} -y'
.
format
(
apache
,
profile
,
locale
,
'--account-name={} --account-pass={} --sites-subdir={} -y'
.
format
(
apache
,
profile
,
locale
,
db_user
,
db_pass
,
db_user
,
db_pass
,
...
@@ -133,7 +140,12 @@ def site_install():
...
@@ -133,7 +140,12 @@ def site_install():
site_admin_name
,
site_admin_name
,
site_admin_pass
,
site_admin_pass
,
site_subdir
))
site_subdir
))
# Drupal 8 only
h
.
fab_run
(
role
,
'cp core/phpunit.xml.dist core/phpunit.xml'
)
h
.
fab_run
(
role
,
"sed -i 's@<env name=
\"
SIMPLETEST_BASE_URL
\"
value=
\"\"
/>@<env name=
\"
SIMPLETEST_BASE_URL
\"
value=
\"
http://{}
\"
/>@g' core/phpunit.xml"
.
format
(
base_url
))
h
.
fab_run
(
role
,
"sed -i 's@<env name=
\"
SIMPLETEST_DB
\"
value=
\"\"
/>@<env name=
\"
SIMPLETEST_DB
\"
value=
\"
mysql://{}:{}\@{}/{}
\"
/>@g' core/phpunit.xml"
.
format
(
db_user
,
db_pass
,
db_host
,
db_name
))
h
.
fab_run
(
role
,
"sed -i 's@<env name=
\"
BROWSERTEST_OUTPUT_DIRECTORY
\"
value=
\"\"
/>@<env name=
\"
BROWSERTEST_OUTPUT_DIRECTORY
\"
value=
\"
/tmp
\"
/>@g' core/phpunit.xml"
)
# end D8
print
(
green
(
'Site installed successfully!'
))
print
(
green
(
'Site installed successfully!'
))
# Import db_dump if it exists.
# Import db_dump if it exists.
...
...
helpers.py
View file @
cb54e5fa
...
@@ -47,17 +47,14 @@ env.roledefs['local'] = ["{}@{}".format(user_name, host_name)]
...
@@ -47,17 +47,14 @@ env.roledefs['local'] = ["{}@{}".format(user_name, host_name)]
env
.
roledefs
[
'docker'
]
=
[
"root@{}"
.
format
(
env
.
container_ip
)]
env
.
roledefs
[
'docker'
]
=
[
"root@{}"
.
format
(
env
.
container_ip
)]
env
.
builddir
=
path
.
join
(
env
.
workspace
,
'build'
)
env
.
builddir
=
path
.
join
(
env
.
workspace
,
'build'
)
env
.
makefile
=
path
.
join
(
env
.
builddir
,
env
.
site_profile
,
env
.
site_profile_makefile
)
env
.
site_drush_aliases
=
path
.
join
(
env
.
site_root
,
'sites/all/drush'
)
def
is_core_profile
(
profile_name
):
def
is_core_profile
(
profile_name
):
return
profile_name
in
(
'minimal'
,
'standard'
,
'testing'
)
return
profile_name
in
(
'minimal'
,
'standard'
,
'testing'
)
if
is_core_profile
(
env
.
site_profile
):
env
.
makefile
=
path
.
join
(
env
.
builddir
,
env
.
site_profile_makefile
)
else
:
env
.
makefile
=
path
.
join
(
env
.
builddir
,
env
.
site_profile
,
env
.
site_profile_makefile
)
env
.
site_drush_aliases
=
path
.
join
(
env
.
site_root
,
'sites/all/drush'
)
def
fab_run
(
role
=
"local"
,
cmd
=
""
,
capture
=
False
):
def
fab_run
(
role
=
"local"
,
cmd
=
""
,
capture
=
False
):
"""
"""
Helper function to run the task locally or remotely
Helper function to run the task locally or remotely
...
...
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