Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
provision
Commits
4595b415
Commit
4595b415
authored
Apr 18, 2010
by
drumm
Committed by
Neil Drumm
Apr 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write alias files for web servers
parent
8ac783e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
4 deletions
+36
-4
http/.http.drush.inc.swp
http/.http.drush.inc.swp
+0
-0
http/http.drush.inc
http/http.drush.inc
+18
-1
provision.config.inc
provision.config.inc
+16
-3
provision_drushrc_alias.tpl.php
provision_drushrc_alias.tpl.php
+2
-0
No files found.
http/.http.drush.inc.swp
0 → 100644
View file @
4595b415
File added
http/http.drush.inc
View file @
4595b415
...
...
@@ -25,6 +25,12 @@ function http_drush_init($url = null) {
}
}
function
http_drush_exit
()
{
if
(
PROVISION_CONTEXT_SERVER
)
{
provision_service
(
'http'
)
->
write_alias
();
}
}
class
provisionService_http
extends
provisionService
{
/**
* Set defaults
...
...
@@ -109,7 +115,6 @@ class provisionService_http extends provisionService {
*/
function
create_server_config
()
{
return
TRUE
;
}
/**
...
...
@@ -118,4 +123,16 @@ class provisionService_http extends provisionService {
function
delete_server_config
()
{
return
TRUE
;
}
/**
* Write out server's drushrc alias file.
*/
function
write_alias
()
{
$data
=
array
();
foreach
(
array
(
'web_id'
,
'web_host'
,
'web_ports'
,
'web_group'
,
'restart_cmd'
)
as
$key
)
{
$data
[
$key
]
=
drush_get_option
(
$key
);
}
$config
=
new
provisionConfig_drushrc_alias
(
drush_get_option
(
'web_host'
),
$data
);
$config
->
write
();
}
}
provision.config.inc
View file @
4595b415
...
...
@@ -61,6 +61,14 @@ class provisionConfig {
function
write
()
{
$filename
=
$this
->
filename
();
// Make directory structure if it does not exist.
if
(
!
provision_service
(
'file'
)
->
exists
(
dirname
(
$filename
))
->
status
())
{
provision_service
(
'file'
)
->
mkdir
(
dirname
(
$filename
))
->
succeed
(
'Created directory @path.'
)
->
fail
(
'Could not create directory @path.'
);
}
if
(
$filename
&&
is_writeable
(
dirname
(
$filename
)))
{
// manipulate data before passing to template.
$this
->
process
();
...
...
@@ -131,13 +139,18 @@ class provisionConfig_drushrc extends provisionConfig {
// class to read and write an alias record
class
provisionConfig_drushrc_alias
extends
provisionConfig_drushrc
{
public
$template
=
'provision_drushrc_alias.tpl.php'
;
function
__construct
(
$aliasname
,
$data
=
array
())
{
parent
::
construct
(
$data
)
;
$this
->
alias_name
=
$aliasname
;
$this
->
aliasname
=
$aliasname
;
parent
::
__construct
(
$data
)
;
}
function
load_data
()
{
// do something about alias_load_data
$this
->
data
=
array
(
'aliasname'
=>
$this
->
aliasname
,
'alias'
=>
$this
->
data
,
);
}
function
filename
()
{
...
...
provision_drushrc_alias.tpl.php
0 → 100644
View file @
4595b415
<?php
print
"<?php
\n
"
;
?>
$aliases['
<?php
print
$aliasname
;
?>
'] =
<?php
print
var_export
(
$alias
,
TRUE
);
?>
;
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