|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -const _ = require('lodash'); |
4 |
| -const fs = require('fs'); |
5 | 3 | const path = require('path');
|
6 | 4 | const landoPhpPath = path.join(__dirname, '../node_modules/@lando/php');
|
7 | 5 | const LandoPhp = require(`${landoPhpPath}/builders/php.js`);
|
8 | 6 |
|
9 |
| -const loadScripts = options => { |
10 |
| - const lando = _.get(options, '_app._lando'); |
11 |
| - // Move the script to the confDir and make executable. |
12 |
| - if (fs.existsSync(path.join(landoPhpPath, 'scripts'))) { |
13 |
| - const confDir = path.join(lando.config.userConfRoot, 'scripts'); |
14 |
| - const dest = lando.utils.moveConfig(path.join(landoPhpPath, 'scripts'), confDir); |
15 |
| - lando.utils.makeExecutable(fs.readdirSync(dest), dest); |
16 |
| - lando.log.debug('automoved scripts from %s to %s and set to mode 755', |
17 |
| - path.join(landoPhpPath, 'scripts'), confDir); |
18 |
| - } |
19 |
| -}; |
20 |
| - |
21 |
| -// Builder |
| 7 | +/** |
| 8 | + * Laravel PHP builder class that extends Lando PHP builder. |
| 9 | + * Uses the bundled version of @lando/php plugin instead of user's version. |
| 10 | + * |
| 11 | + * @module laravel-php |
| 12 | + */ |
22 | 13 | module.exports = {
|
23 | 14 | name: 'laravel-php',
|
24 | 15 | parent: '_appserver',
|
| 16 | + /** |
| 17 | + * Builder function that returns the LaravelPhp class |
| 18 | + * @param {Object} parent - Parent builder class |
| 19 | + * @return {Class} LaravelPhp class extending LandoPhp builder |
| 20 | + */ |
25 | 21 | builder: parent => class LaravelPhp extends LandoPhp.builder(parent, LandoPhp.config) {
|
| 22 | + /** |
| 23 | + * Create a new LaravelPhp instance |
| 24 | + * @param {string} id - Service id |
| 25 | + * @param {Object} options - Service options |
| 26 | + * @param {Object} factory - App factory instance |
| 27 | + */ |
26 | 28 | constructor(id, options = {}, factory) {
|
27 |
| - loadScripts(options); |
28 | 29 | options.nginxServiceType = 'laravel-nginx';
|
29 | 30 | super(id, options, factory);
|
30 | 31 | }
|
|
0 commit comments