Commit c2c5fbd9 authored by mercury233's avatar mercury233

update pre util to generate ypk

parent 9e6956ef
...@@ -189,6 +189,7 @@ ...@@ -189,6 +189,7 @@
"html_filename": "pre.html", "html_filename": "pre.html",
"git_db_path": "../ygopro-pre-data/", "git_db_path": "../ygopro-pre-data/",
"db_path": "../ygopro-pre-data/unofficial/", "db_path": "../ygopro-pre-data/unofficial/",
"ypk_name": "pre-release.ypk",
"html_img_rel_path": "pre/pics/", "html_img_rel_path": "pre/pics/",
"html_img_thumbnail": "thumbnail/", "html_img_thumbnail": "thumbnail/",
"html_img_thumbnail_suffix": "!thumb", "html_img_thumbnail_suffix": "!thumb",
......
...@@ -396,8 +396,8 @@ var copyToYGOPRO = function(callback) { ...@@ -396,8 +396,8 @@ var copyToYGOPRO = function(callback) {
}); });
} }
function run7z(params, callback) { function run7z(params, cwd, callback) {
let proc = spawn(settings.modules.tournament_mode.replay_archive_tool, params, { cwd: config.db_path, env: process.env }); let proc = spawn(settings.modules.tournament_mode.replay_archive_tool, params, { cwd: cwd, env: process.env });
proc.stdout.setEncoding('utf8'); proc.stdout.setEncoding('utf8');
proc.stdout.on('data', function(data) { proc.stdout.on('data', function(data) {
//sendResponse("7z: "+data); //sendResponse("7z: "+data);
...@@ -421,28 +421,43 @@ var packDatas = function (callback) { ...@@ -421,28 +421,43 @@ var packDatas = function (callback) {
_async.auto({ _async.auto({
preCommands: (done) => { preCommands: (done) => {
execCommands([ execCommands([
'rm -rf "' + config.db_path +'expansions/' + config.ypk_name + '"',
'rm -rf "' + config.db_path +'expansions/script"',
'rm -rf "' + config.db_path +'expansions/pics"',
'rm -rf "' + config.db_path +'cdb"',
'rm -rf "' + config.db_path +'picture"',
'mkdir "' + config.db_path +'picture"',
'cp -r "' + config.db_path + 'expansions" "' + config.db_path + 'cdb"', 'cp -r "' + config.db_path + 'expansions" "' + config.db_path + 'cdb"',
'cp -r "' + config.db_path + 'script" "' + config.db_path + 'expansions/script"',
'cp -r "' + config.db_path + 'field" "' + config.db_path + 'pics/field"',
'cp -r "' + config.db_path + 'pics" "' + config.db_path + 'expansions/pics"', 'cp -r "' + config.db_path + 'pics" "' + config.db_path + 'expansions/pics"',
'cp -r "' + config.db_path + 'picn" "' + config.db_path + 'picture/card"', 'cp -r "' + config.db_path + 'field" "' + config.db_path + 'expansions/pics/field"',
'cp -r "' + config.db_path + 'script" "' + config.db_path + 'expansions/script"',
'cp -r "' + config.db_path + 'pics" "' + config.db_path + 'picture/card"',
'cp -r "' + config.db_path + 'field" "' + config.db_path + 'picture/field"' 'cp -r "' + config.db_path + 'field" "' + config.db_path + 'picture/field"'
], done); ], done);
}, },
run7zPC: ["preCommands", (results, done) => { run7zYPK: ["preCommands", (results, done) => {
run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md", "-x!mobile.cdb", "-x!cdb", "-x!picn", "-x!field", "-x!script", "-x!pics", "-x!expansions/pics/thumbnail", "-x!picture", "ygosrv233-pre.zip", "*"], done); run7z(["a", "-tzip", "-x!*.ypk", config.ypk_name, "*"], config.db_path + "expansions/", done);
}],
run7zPC: ["run7zYPK", (results, done) => {
run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md",
"-x!cdb", "-x!picture", "-x!field", "-x!script", "-x!pics",
"-x!expansions/pics", "-x!expansions/script", "-x!expansions/*.cdb", "-x!expansions/*.conf",
"ygosrv233-pre.zip", "*"], config.db_path, done);
}], }],
run7zMobile: ["preCommands", (results, done) => { run7zMobile: ["run7zYPK", (results, done) => {
run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md", "-x!expansions/pics", "-x!expansions/script", "-x!cdb", "-x!picn", "-x!field", "-x!pics/thumbnail", "-x!picture", "ygosrv233-pre-mobile.zip", "*"], done); run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md",
"-x!cdb", "-x!picture", "-x!field", "-x!script", "-x!pics",
"-x!expansions/pics", "-x!expansions/script", "-x!expansions/*.cdb", "-x!expansions/*.conf",
"ygosrv233-pre-mobile.zip", "*"], config.db_path, done);
}], }],
run7zPro2: ["preCommands", (results, done) => { run7zPro2: ["preCommands", (results, done) => {
run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md", "-x!expansions", "-x!pics", "-x!picn", "-x!field", "ygosrv233-pre-2.zip", "*"], done); run7z(["a", "-x!*.zip", "-x!.git", "-x!LICENSE", "-x!README.md",
"-x!expansions", "-x!pics", "-x!field",
"ygosrv233-pre-2.zip", "*"], config.db_path, done);
}], }],
commandsAfterPC: ["run7zPC", (results, done) => { commandsAfterPC: ["run7zPC", (results, done) => {
execCommands([ execCommands([
'mv -f "' + config.db_path + 'ygosrv233-pre.zip" "' + file_path + '"', 'mv -f "' + config.db_path + 'ygosrv233-pre.zip" "' + file_path + '"'
'rm -rf "' + config.db_path +'expansions/script"',
'rm -rf "' + config.db_path +'expansions/pics"'
], (err) => { ], (err) => {
if (!err) { if (!err) {
sendResponse("电脑更新包打包完成。"); sendResponse("电脑更新包打包完成。");
...@@ -450,10 +465,12 @@ var packDatas = function (callback) { ...@@ -450,10 +465,12 @@ var packDatas = function (callback) {
done(err); done(err);
}); });
}], }],
commandsAfterMobile: ["run7zMobile", (results, done) => { commandsAfterMobile: ["run7zPC", "run7zMobile", (results, done) => {
execCommands([ execCommands([
'mv -f "' + config.db_path +'ygosrv233-pre-mobile.zip" "'+ file_path +'"', 'mv -f "' + config.db_path +'ygosrv233-pre-mobile.zip" "'+ file_path +'"',
'rm -rf "' + config.db_path +'pics/field"' 'rm -rf "' + config.db_path +'expansions/' + config.ypk_name + '"',
'rm -rf "' + config.db_path +'expansions/script"',
'rm -rf "' + config.db_path +'expansions/pics"'
], (err) => { ], (err) => {
if (!err) { if (!err) {
sendResponse("手机更新包打包完成。"); sendResponse("手机更新包打包完成。");
...@@ -465,8 +482,7 @@ var packDatas = function (callback) { ...@@ -465,8 +482,7 @@ var packDatas = function (callback) {
execCommands([ execCommands([
'mv -f "' + config.db_path + 'ygosrv233-pre-2.zip" "' + file_path + '"', 'mv -f "' + config.db_path + 'ygosrv233-pre-2.zip" "' + file_path + '"',
'rm -rf "' + config.db_path +'cdb"', 'rm -rf "' + config.db_path +'cdb"',
'rm -rf "' + config.db_path +'picture/card"', 'rm -rf "' + config.db_path +'picture"'
'rm -rf "' + config.db_path +'picture/field"'
], (err) => { ], (err) => {
if (!err) { if (!err) {
sendResponse("Pro2更新包打包完成。"); sendResponse("Pro2更新包打包完成。");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment