Updating gulp packages to include composer and vendor folder

This commit is contained in:
Derek McDaniel 2017-01-24 23:21:36 -05:00
parent d086f5fe5f
commit 5814fd3405
3 changed files with 55 additions and 16 deletions

8
composer.json Normal file
View File

@ -0,0 +1,8 @@
{
"require": {
"maknz/slack": "^1.7"
},
"config": {
"bin-dir": "bin"
}
}

View File

@ -1,4 +1,7 @@
var eventStream = require('event-stream'), var fs = require('fs'),
https = require('https'),
exec = require('child_process').exec,
eventStream = require('event-stream'),
gulp = require('gulp'), gulp = require('gulp'),
chmod = require('gulp-chmod'), chmod = require('gulp-chmod'),
zip = require('gulp-zip'), zip = require('gulp-zip'),
@ -6,7 +9,34 @@ var eventStream = require('event-stream'),
gzip = require('gulp-gzip'), gzip = require('gulp-gzip'),
rename = require('gulp-rename'); rename = require('gulp-rename');
gulp.task('prepare-release', function() { // Get and install PHP Composer
gulp.task('get-composer', function(callback) {
// Check if Composer already in place
if (fs.existsSync('./composer.phar')) {
callback(null);
return;
}
// Get installer from the internet
https.get('https://getcomposer.org/installer', function(response) {
// Run PHP to install Composer
var php = exec('php', function(error, stdout, stderr) {
callback(error ? stderr : null);
});
// Pass installer code to PHP via STDIN
response.pipe(php.stdin);
});
});
// Install Composer dependencies
gulp.task('composer-install', ['get-composer'], function(callback) {
exec('php -d "suhosin.executor.include.whitelist = phar" composer.phar install --no-dev', function(error, stdout, stderr) {
callback(error ? stderr : null);
});
});
gulp.task('prepare-release', ['composer-install'], function() {
var version = require('./package.json').version; var version = require('./package.json').version;
return eventStream.merge( return eventStream.merge(
@ -34,7 +64,9 @@ var getSources = function() {
return gulp.src([ return gulp.src([
'Plugin.php', 'Plugin.php',
'README.md', 'README.md',
'LICENSE' 'LICENSE',
'db/.htaccess',
'vendor/**/*.*'
], ],
{base: './'} {base: './'}
) )

View File

@ -1,5 +1,5 @@
{ {
"version": "1.1.0", "version": "1.0.0",
"devDependencies": { "devDependencies": {
"gulp": "~3.8.10", "gulp": "~3.8.10",
"event-stream": "~3.1.7", "event-stream": "~3.1.7",
@ -7,7 +7,6 @@
"gulp-tar": "~1.3.1", "gulp-tar": "~1.3.1",
"gulp-gzip": "~0.0.8", "gulp-gzip": "~0.0.8",
"gulp-chmod": "~1.2.0", "gulp-chmod": "~1.2.0",
"gulp-rename": "~1.2.0", "gulp-rename": "~1.2.0"
"maknz/slack": "^1.7"
} }
} }