Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
provision
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
provision
Commits
6921adf3
Commit
6921adf3
authored
May 06, 2010
by
drumm
Committed by
Neil Drumm
May 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to write multiple name contexts to one file
parent
4f93d89a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
23 deletions
+44
-23
db/db.drush.inc
db/db.drush.inc
+5
-4
http/http.drush.inc
http/http.drush.inc
+8
-1
provision.config.inc
provision.config.inc
+22
-16
provision.inc
provision.inc
+6
-1
provision_drushrc_alias.tpl.php
provision_drushrc_alias.tpl.php
+3
-1
No files found.
db/db.drush.inc
View file @
6921adf3
...
...
@@ -309,14 +309,15 @@ class provisionService_db extends provisionService {
* Write out server's drushrc alias file.
*/
function
write_alias
()
{
$config
=
new
provisionConfig_drushrc_alias
(
drush_get_option
(
'hosting_name'
)
.
'-'
.
drush_get_option
(
'init_db'
),
array
(
'master_db'
));
$config
=
new
provisionConfig_drushrc_alias
(
array
(
drush_get_option
(
'hosting_name'
)
.
'-'
.
drush_get_option
(
'init_db'
)
=>
array
(
'master_db'
,
),
));
$config
->
write
();
}
}
/**
* Indicates the place holders that should be replaced in _db_query_callback().
*/
...
...
http/http.drush.inc
View file @
6921adf3
...
...
@@ -128,7 +128,14 @@ class provisionService_http extends provisionService {
* Write out server's drushrc alias file.
*/
function
write_alias
()
{
$config
=
new
provisionConfig_drushrc_alias
(
drush_get_option
(
'hosting_name'
)
.
'-'
.
drush_get_option
(
'init_http'
),
array
(
'web_host'
,
'web_ports'
,
'web_group'
,
'restart_cmd'
));
$config
=
new
provisionConfig_drushrc_alias
(
array
(
drush_get_option
(
'hosting_name'
)
.
'-'
.
drush_get_option
(
'init_http'
)
=>
array
(
'web_host'
,
'web_ports'
,
'web_group'
,
'restart_cmd'
,
),
));
$config
->
write
();
}
}
provision.config.inc
View file @
6921adf3
...
...
@@ -123,8 +123,8 @@ class provisionConfig_drushrc extends provisionConfig {
function
__construct
(
$data
=
array
())
{
parent
::
__construct
(
$data
);
$this
->
load_data
();
}
function
load_data
()
{
// we fetch the context to pass into the template based on the context name
$this
->
data
=
array_merge
(
drush_get_context
(
$this
->
context_name
),
$this
->
data
);
...
...
@@ -137,34 +137,40 @@ class provisionConfig_drushrc extends provisionConfig {
}
}
// class to read and write an alias record
/**
* Class to write an alias records.
*/
class
provisionConfig_drushrc_alias
extends
provisionConfig_drushrc
{
public
$template
=
'provision_drushrc_alias.tpl.php'
;
function
__construct
(
$aliasname
,
$options
=
array
())
{
$this
->
aliasname
=
$aliasname
;
$data
=
array
();
foreach
(
$options
as
$key
)
{
$data
[
$key
]
=
drush_get_option
(
$key
);
/**
* An array of contexts to write. The first key will determine the title.
*
* @param $contexts
* An associative array of named contexts, like
* @code '\@name' => array('option1', 'option2'), @endcode
* will save the current values of option1 and option2 to @name.
*/
function
__construct
(
$contexts
)
{
$contexts_expanded
=
array
();
foreach
(
$contexts
as
$name
=>
$options
)
{
$contexts_expanded
[
$name
]
=
array
();
foreach
(
$options
as
$key
)
{
$contexts_expanded
[
$name
][
$key
]
=
drush_get_option
(
$key
);
}
}
parent
::
__construct
(
$data
);
}
function
load_data
()
{
$this
->
data
=
array
(
'aliasname'
=>
$this
->
aliasname
,
'
alias'
=>
$this
->
data
,
'aliasname'
=>
reset
(
array_keys
(
$contexts
))
,
'
contexts'
=>
$contexts_expanded
,
);
}
function
filename
()
{
return
drush_get_option
(
'alias-path'
,
drush_server_home
()
.
'/.drush/aliases/'
)
.
trim
(
$this
->
aliasname
,
'@'
);
return
drush_get_option
(
'alias-path'
,
drush_server_home
()
.
'/.drush/aliases/'
)
.
trim
(
$this
->
data
[
'aliasname'
]
,
'@'
);
}
}
/**
* Server level config for drushrc.php files.
*/
...
...
provision.inc
View file @
6921adf3
...
...
@@ -46,7 +46,12 @@ function provision_save_platform_data() {
$config
->
write
();
// Save platform alias
$config
=
new
provisionConfig_drushrc_alias
(
drush_get_option
(
'hosting_name'
),
array
(
'parent'
,
'publish_path'
));
$config
=
new
provisionConfig_drushrc_alias
(
array
(
drush_get_option
(
'hosting_name'
)
=>
array
(
'parent'
,
'publish_path'
,
),
));
$config
->
write
();
}
}
...
...
provision_drushrc_alias.tpl.php
View file @
6921adf3
<?php
print
"<?php
\n
"
;
?>
$aliases['
<?php
print
$aliasname
;
?>
'] =
<?php
print
var_export
(
$alias
,
TRUE
);
?>
;
<?php
foreach
(
$contexts
as
$name
=>
$data
)
{
?>
$aliases['
<?php
print
$name
;
?>
'] =
<?php
print
var_export
(
$data
,
TRUE
);
?>
;
<?php
}
?>
Write
Preview
Markdown
is supported
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