[gulp] add publish task
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"SdkDir": "C:\\sdk",
|
"SdkDir": "C:\\sdk",
|
||||||
"SSH": {
|
"PublishDir": "",
|
||||||
"PrivateKey": null,
|
"SSH": {
|
||||||
"Passphrase": null
|
"PrivateKey": null,
|
||||||
}
|
"Passphrase": null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"SdkDir": "/home/holop/sdk",
|
"SdkDir": "/home/holop/sdk",
|
||||||
"SSH": {
|
"PublishDir": "/opt/repo/tankz",
|
||||||
"PrivateKey": null,
|
"PublishUrl": "https://shmyga.ru/repo/tankz",
|
||||||
"Passphrase": null
|
"SSH": {
|
||||||
}
|
"PrivateKey": null,
|
||||||
|
"Passphrase": null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
34
gulpfile.js
34
gulpfile.js
@@ -5,6 +5,9 @@ const gulpClean = require('gulp-clean');
|
|||||||
const Config = require('./config.json');
|
const Config = require('./config.json');
|
||||||
const packageInfo = require('./package.json');
|
const packageInfo = require('./package.json');
|
||||||
const {Sdk, Haxe, Project, FlashPlayer} = require('gulp-haxetool');
|
const {Sdk, Haxe, Project, FlashPlayer} = require('gulp-haxetool');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const through = require('through2');
|
||||||
const dateformat = require('dateformat');
|
const dateformat = require('dateformat');
|
||||||
const argv = require('yargs').argv;
|
const argv = require('yargs').argv;
|
||||||
|
|
||||||
@@ -27,7 +30,7 @@ exports.generate = function generate() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.levels = function () {
|
exports.levels = function levels() {
|
||||||
return gulp.src("./src/common/level/*").pipe(foreach(function (stream, file) {
|
return gulp.src("./src/common/level/*").pipe(foreach(function (stream, file) {
|
||||||
const type = file.path.substr(file.path.lastIndexOf("/") + 1);
|
const type = file.path.substr(file.path.lastIndexOf("/") + 1);
|
||||||
gulp.src("./src/common/level/" + type + "/*").pipe(foreach(function (stream, file) {
|
gulp.src("./src/common/level/" + type + "/*").pipe(foreach(function (stream, file) {
|
||||||
@@ -155,6 +158,33 @@ const server = new Project(
|
|||||||
module.exports.generate
|
module.exports.generate
|
||||||
).bind(module, gulp);
|
).bind(module, gulp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* publish
|
||||||
|
*/
|
||||||
|
exports.publish = function publish() {
|
||||||
|
const packages = [];
|
||||||
|
return gulp.src('target/client/@(android|archive|debian)/*')
|
||||||
|
.pipe(through.obj(function (file, enc, cb) {
|
||||||
|
const path = file.path.replace(file.base + '/', '');
|
||||||
|
packages.push({
|
||||||
|
type: path.split('/').shift(),
|
||||||
|
path: path,
|
||||||
|
filename: path.split('/').pop(),
|
||||||
|
url: `${Config.PublishUrl}/${path}`,
|
||||||
|
});
|
||||||
|
this.push(file);
|
||||||
|
cb(null);
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest(Config.PublishDir))
|
||||||
|
.on('end', function () {
|
||||||
|
fs.writeFileSync(path.join(Config.PublishDir, 'packages.json'), JSON.stringify({
|
||||||
|
'name': packageInfo.name,
|
||||||
|
'version': packageInfo.version,
|
||||||
|
'packages': packages,
|
||||||
|
}, null, 4));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default
|
* default
|
||||||
*/
|
*/
|
||||||
@@ -166,6 +196,7 @@ module.exports.default = gulp.series(
|
|||||||
module.exports['client:html5:build'],
|
module.exports['client:html5:build'],
|
||||||
module.exports['client:linux:build'],
|
module.exports['client:linux:build'],
|
||||||
module.exports['client:linux:deb'],
|
module.exports['client:linux:deb'],
|
||||||
|
module.exports['client:linux:archive'],
|
||||||
module.exports['client:android:build'],
|
module.exports['client:android:build'],
|
||||||
|
|
||||||
module.exports['editor:flash:build'],
|
module.exports['editor:flash:build'],
|
||||||
@@ -173,4 +204,5 @@ module.exports.default = gulp.series(
|
|||||||
module.exports['editor:html5:build'],
|
module.exports['editor:html5:build'],
|
||||||
|
|
||||||
module.exports['server:neko:build'],
|
module.exports['server:neko:build'],
|
||||||
|
exports.publish,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"gulp-add": "0.0.2",
|
"gulp-add": "0.0.2",
|
||||||
"gulp-clean": "^0.4.0",
|
"gulp-clean": "^0.4.0",
|
||||||
"gulp-foreach": "^0.1.0",
|
"gulp-foreach": "^0.1.0",
|
||||||
"gulp-haxetool": "0.0.21",
|
"gulp-haxetool": "0.0.22",
|
||||||
"gulp-zip": "^5.0.0",
|
"gulp-zip": "^5.0.0",
|
||||||
"yargs": "^13.2.4"
|
"yargs": "^13.2.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ class Device {
|
|||||||
];
|
];
|
||||||
|
|
||||||
public static function isMobile():Bool {
|
public static function isMobile():Bool {
|
||||||
#if js
|
#if android
|
||||||
|
return true;
|
||||||
|
#elseif js
|
||||||
var userAgent = js.Browser.navigator.userAgent;
|
var userAgent = js.Browser.navigator.userAgent;
|
||||||
for (mobile in MOBILES) {
|
for (mobile in MOBILES) {
|
||||||
if (userAgent.indexOf(mobile) > -1) {
|
if (userAgent.indexOf(mobile) > -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user