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 3210ce3 commit f9b7ed7
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions builders/symfony-php.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
'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
/**
* Symfony PHP builder class that extends Lando PHP builder.
* Uses the bundled version of @lando/php plugin instead of user's version.
*
* @module symfony-php
*/
module.exports = {
name: 'symfony-php',
parent: '_appserver',
/**
* Builder function that returns the SymfonyPhp class
* @param {Object} parent - Parent builder class
* @return {Class} SymfonyPhp class extending LandoPhp builder
*/
builder: parent => class SymfonyPhp extends LandoPhp.builder(parent, LandoPhp.config) {
/**
* Create a new SymfonyPhp 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 = 'symfony-nginx';
super(id, options, factory);
}
Expand Down

0 comments on commit f9b7ed7

Please sign in to comment.