-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove moveConfig from php builders.
- Loading branch information
1 parent
d65abe2
commit 3b2c57c
Showing
1 changed file
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
'use strict'; | ||
|
||
const _ = require('lodash'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const landoPhpPath = path.join(__dirname, '../node_modules/@lando/php'); | ||
const LandoPhp = require(`${landoPhpPath}/builders/php.js`); | ||
|
||
const loadScripts = options => { | ||
const lando = _.get(options, '_app._lando'); | ||
// Move the script to the confDir and make executable. | ||
if (fs.existsSync(path.join(landoPhpPath, 'scripts'))) { | ||
const confDir = path.join(lando.config.userConfRoot, 'scripts'); | ||
const dest = lando.utils.moveConfig(path.join(landoPhpPath, 'scripts'), confDir); | ||
lando.utils.makeExecutable(fs.readdirSync(dest), dest); | ||
lando.log.debug('automoved scripts from %s to %s and set to mode 755', | ||
path.join(landoPhpPath, 'scripts'), confDir); | ||
} | ||
}; | ||
|
||
// Builder | ||
/** | ||
* Joomla PHP builder class that extends Lando PHP builder. | ||
* Uses the bundled version of @lando/php plugin instead of user's version. | ||
* | ||
* @module joomla-php | ||
*/ | ||
module.exports = { | ||
name: 'joomla-php', | ||
parent: '_appserver', | ||
builder: (parent, config) => class JoomlaPhp extends LandoPhp.builder(parent, LandoPhp.config) { | ||
/** | ||
* Builder function that returns the JoomlaPhp class | ||
* @param {Object} parent - Parent builder class | ||
* @return {Class} JoomlaPhp class extending LandoPhp builder | ||
*/ | ||
builder: parent => class JoomlaPhp extends LandoPhp.builder(parent, LandoPhp.config) { | ||
/** | ||
* Create a new JoomlaPhp instance | ||
* @param {string} id - Service id | ||
* @param {Object} options - Service options | ||
* @param {Object} factory - App factory instance | ||
*/ | ||
constructor(id, options = {}, factory) { | ||
loadScripts(options); | ||
options.nginxServiceType = 'joomla-nginx'; | ||
super(id, _.merge({}, config, options), factory); | ||
super(id, options, factory); | ||
} | ||
}, | ||
}; |