Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Docker for Drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
plugin
Docker for Drupal
Commits
c0b91188
Commit
c0b91188
authored
6 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Improve projectname determination
Provide access to option values of this plugin to other plugins
parent
e6fb9544
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Handler.php
+97
-81
97 additions, 81 deletions
src/Handler.php
with
97 additions
and
81 deletions
src/Handler.php
+
97
−
81
View file @
c0b91188
...
...
@@ -16,6 +16,11 @@ use Symfony\Component\Yaml\Yaml;
*/
class
Handler
extends
BaseHandler
{
/**
* @var array
*/
protected
$options
;
/**
* Configure Drupal Project for Docker.
*
...
...
@@ -189,93 +194,104 @@ class Handler extends BaseHandler {
/**
* Retrieve options from composer.json "extra" configuration.
*
* @param null $key
* Optional name of an option to be received instead of the full set of options.
*
* @return array
* The options.
*/
protected
function
getOptions
()
{
$projectname
=
str_replace
([
' '
,
'-'
,
'_'
,
'.'
],
''
,
basename
(
getcwd
()));
$env
=
new
Dotenv
(
'docker4drupal'
,
$this
->
io
);
$env
->
put
(
'COMPOSE_PROJECT_NAME'
,
$projectname
);
$extra
=
$this
->
composer
->
getPackage
()
->
getExtra
()
+
[
'docker4drupal'
=>
[]];
$options
=
NestedArray
::
mergeDeep
([
'projectname'
=>
$projectname
,
'docker0'
=>
[
'ip'
=>
$this
->
getLocalIpv4
(
'docker0'
),
],
'live'
=>
[
'root'
=>
''
,
'uri'
=>
''
,
'host'
=>
''
,
'user'
=>
$env
->
receive
(
'live_host_username'
,
'Remote username for host of the live site'
,
getenv
(
'USER'
)),
],
'drush'
=>
[
'sql'
=>
[
'tables'
=>
[
'structure'
=>
[
'cache'
,
'cache_*'
,
'history'
,
'search_*'
,
'sessions'
,
'watchdog'
,
],
'skip'
=>
[
'migration_*'
,
public
function
getOptions
(
$key
=
NULL
)
{
if
(
$this
->
options
===
NULL
)
{
$env
=
new
Dotenv
(
'docker4drupal'
,
$this
->
io
);
$projectname
=
getenv
(
'COMPOSE_PROJECT_NAME'
);
if
(
empty
(
$projectname
))
{
$projectname
=
str_replace
([
' '
,
'-'
,
'_'
,
'.'
],
''
,
basename
(
getcwd
()));
$env
->
put
(
'COMPOSE_PROJECT_NAME'
,
$projectname
);
}
$extra
=
$this
->
composer
->
getPackage
()
->
getExtra
()
+
[
'docker4drupal'
=>
[]];
$options
=
NestedArray
::
mergeDeep
([
'projectname'
=>
$projectname
,
'docker0'
=>
[
'ip'
=>
$this
->
getLocalIpv4
(
'docker0'
),
],
'live'
=>
[
'root'
=>
''
,
'uri'
=>
''
,
'host'
=>
''
,
'user'
=>
$env
->
receive
(
'live_host_username'
,
'Remote username for host of the live site'
,
getenv
(
'USER'
)),
],
'drush'
=>
[
'sql'
=>
[
'tables'
=>
[
'structure'
=>
[
'cache'
,
'cache_*'
,
'history'
,
'search_*'
,
'sessions'
,
'watchdog'
,
],
'skip'
=>
[
'migration_*'
,
],
],
],
],
],
'drupal'
=>
[
'version'
=>
'8'
,
],
'php'
=>
[
'version'
=>
'7.0'
,
'xdebug'
=>
1
,
],
'webserver'
=>
[
'type'
=>
'apache'
,
],
'varnish'
=>
[
'enable'
=>
0
,
],
'redis'
=>
[
'version'
=>
'4.0'
,
],
'dbbrowser'
=>
[
'type'
=>
'pma'
,
],
'solr'
=>
[
'enable'
=>
0
,
'version'
=>
'6.6'
,
],
'node'
=>
[
'enable'
=>
0
,
'key'
=>
''
,
'path'
=>
''
,
],
'memcached'
=>
[
'enable'
=>
0
,
],
'rsyslog'
=>
[
'enable'
=>
0
,
],
'athenapdf'
=>
[
'enable'
=>
0
,
'key'
=>
''
,
],
'blackfire'
=>
[
'enable'
=>
0
,
'id'
=>
''
,
'token'
=>
''
,
],
'webgrind'
=>
[
'enable'
=>
0
,
],
'wkhtmltox'
=>
[
'enable'
=>
0
,
],
],
$extra
[
'docker4drupal'
]);
return
$env
->
replaceEnvironmentVariables
(
$options
);
'drupal'
=>
[
'version'
=>
'8'
,
],
'php'
=>
[
'version'
=>
'7.0'
,
'xdebug'
=>
1
,
],
'webserver'
=>
[
'type'
=>
'apache'
,
],
'varnish'
=>
[
'enable'
=>
0
,
],
'redis'
=>
[
'version'
=>
'4.0'
,
],
'dbbrowser'
=>
[
'type'
=>
'pma'
,
],
'solr'
=>
[
'enable'
=>
0
,
'version'
=>
'6.6'
,
],
'node'
=>
[
'enable'
=>
0
,
'key'
=>
''
,
'path'
=>
''
,
],
'memcached'
=>
[
'enable'
=>
0
,
],
'rsyslog'
=>
[
'enable'
=>
0
,
],
'athenapdf'
=>
[
'enable'
=>
0
,
'key'
=>
''
,
],
'blackfire'
=>
[
'enable'
=>
0
,
'id'
=>
''
,
'token'
=>
''
,
],
'webgrind'
=>
[
'enable'
=>
0
,
],
'wkhtmltox'
=>
[
'enable'
=>
0
,
],
],
$extra
[
'docker4drupal'
]);
$this
->
options
=
$env
->
replaceEnvironmentVariables
(
$options
);
}
if
(
$key
!==
NULL
)
{
return
$this
->
options
[
$key
];
}
return
$this
->
options
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment