add gulp support, fix #6

This commit is contained in:
everyx 2017-03-20 23:24:24 +08:00
parent 66ee83b0b0
commit 3025f9e3cc
5 changed files with 63 additions and 39 deletions

7
.gitignore vendored
View File

@ -1,2 +1,5 @@
*.zip
*.gz
# Do not index node.js modules that are used for building
node_modules
# Do not index releases
release

View File

@ -1,22 +0,0 @@
#!/bin/bash
author='Mibew'
tmp_dir='/tmp'
working_dir=`echo $PWD`
target_dir="$tmp_dir/$author/Mibew/Plugin/OperatorStatus"
mkdir -p $target_dir
shopt -s extglob
cp -R !(*.sh) $target_dir
shopt -u extglob
version=`cat Plugin.php|grep -Po "(?<=return ')(\d.){2}\d{1}"`
cd $tmp_dir
tar -czvf $working_dir/mibew-operator-status-plugin.$version.tar.gz $author
zip -r $working_dir/mibew-operator-status-plugin.$version.zip $author
rm -rf $plugin_root_dir

View File

@ -1,15 +0,0 @@
{
"name": "Mibew/mibew-operator-status-plugin",
"description": "An operator status plugin for Mibew 2.0.",
"license": "MIT",
"authors": [
{
"name": "everyx",
"email": "lunt.luo@gmail.com"
}
],
"autoload": {
"psr-0": {"Mibew\\Mibew\\Plugin\\OperatorStatus\\": ""}
},
"target-dir": "Mibew/Mibew/Plugin/OperatorStatus"
}

46
gulpfile.js Normal file
View File

@ -0,0 +1,46 @@
var eventStream = require('event-stream'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip'),
rename = require('gulp-rename');
gulp.task('prepare-release', function() {
var version = require('./package.json').version;
return eventStream.merge(
getSources()
.pipe(zip('mibew-operator-status-plugin-' + version + '.zip')),
getSources()
.pipe(tar('mibew-operator-status-plugin-' + version + '.tar'))
.pipe(gzip())
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
});
// Builds and packs plugins sources
gulp.task('default', ['prepare-release'], function() {
// The "default" task is just an alias for "prepare-release" task.
});
/**
* Returns files stream with the plugin sources.
*
* @returns {Object} Stream with VinylFS files.
*/
var getSources = function() {
return gulp.src([
'Controller/*',
'LICENSE',
'Plugin.php',
'README.md',
'routing.yml'
],
{base: './'}
)
.pipe(rename(function(path) {
path.dirname = 'Mibew/Mibew/Plugin/OperatorStatus/' + path.dirname;
}));
}

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"version": "0.3.0",
"devDependencies": {
"event-stream": "~3.3.1",
"gulp": "^3.9.1",
"gulp-chmod": "~1.2.0",
"gulp-gzip": "~1.1.0",
"gulp-rename": "~1.2.2",
"gulp-tar": "~1.4.0",
"gulp-zip": "~3.0.2"
}
}