From 5814fd340504d9a60e82e0782de8d63f269ea166 Mon Sep 17 00:00:00 2001 From: Derek McDaniel Date: Tue, 24 Jan 2017 23:21:36 -0500 Subject: [PATCH] Updating gulp packages to include composer and vendor folder --- composer.json | 8 ++++++++ gulpfile.js | 38 +++++++++++++++++++++++++++++++++++--- package.json | 25 ++++++++++++------------- 3 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3421724 --- /dev/null +++ b/composer.json @@ -0,0 +1,8 @@ +{ + "require": { + "maknz/slack": "^1.7" + }, + "config": { + "bin-dir": "bin" + } +} diff --git a/gulpfile.js b/gulpfile.js index c9677d9..f6cd46d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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'), chmod = require('gulp-chmod'), zip = require('gulp-zip'), @@ -6,7 +9,34 @@ var eventStream = require('event-stream'), gzip = require('gulp-gzip'), 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; return eventStream.merge( @@ -34,7 +64,9 @@ var getSources = function() { return gulp.src([ 'Plugin.php', 'README.md', - 'LICENSE' + 'LICENSE', + 'db/.htaccess', + 'vendor/**/*.*' ], {base: './'} ) diff --git a/package.json b/package.json index ee0a6df..e7141d4 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,12 @@ -{ - "version": "1.1.0", - "devDependencies": { - "gulp": "~3.8.10", - "event-stream": "~3.1.7", - "gulp-zip": "~2.0.2", - "gulp-tar": "~1.3.1", - "gulp-gzip": "~0.0.8", - "gulp-chmod": "~1.2.0", - "gulp-rename": "~1.2.0", - "maknz/slack": "^1.7" - } -} +{ + "version": "1.0.0", + "devDependencies": { + "gulp": "~3.8.10", + "event-stream": "~3.1.7", + "gulp-zip": "~2.0.2", + "gulp-tar": "~1.3.1", + "gulp-gzip": "~0.0.8", + "gulp-chmod": "~1.2.0", + "gulp-rename": "~1.2.0" + } +}