Skip to content

Commit

Permalink
Remove moveConfig from php builders.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Jan 16, 2025
1 parent d65abe2 commit 3b2c57c
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions builders/joomla-php.js
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);
}
},
};

0 comments on commit 3b2c57c

Please sign in to comment.