批处理脚本学习

@echo off

set "RMS_SourcePath=%~dp0"
set "RMS_CodeBuilder=%RMS_SourcePath%Bin\Tool\CodeBuilder\CHM.Tool.CodeBuilder.exe"
set "RMS_uglifyjs=%RMS_SourcePath%Bin\Tool\uglifyjs.cmd"

set "RMS_EnumCs=%RMS_SourcePath%PDW.AFE.Common\Enums\AutoEnum.cs"
set "RMS_ModelCs=%RMS_SourcePath%PDW.AFE.Models\DataModel"

set "RMS_GridJs=%RMS_SourcePath%PDW.SCM.Web\Resource\Scripts\Page\common\grid.js"
set "RMS_FormJs=%RMS_SourcePath%PDW.SCM.Web\Resource\Scripts\Page\common\form.js"
set "RMS_EnumJs=%RMS_SourcePath%PDW.AFE.Web\Resource\src\data\enum-externd.js"
set "RMS_TableJs=%RMS_SourcePath%PDW.SCM.Web\Resource\Scripts\Page\common\Tables.js"

echo 生成 AutoEnum.cs 文件开始
"%RMS_CodeBuilder%" EnumCs "%RMS_EnumCs%" PDW.AFE.Common.Enums
echo 生成 AutoEnum.cs 文件完成

echo 生成 DataModel 文件开始
"%RMS_CodeBuilder%" ModelCs "%RMS_ModelCs%" PDW.AFE.Models.DataModel
echo 生成 DataModel 文件完成


REM echo 生成 js 脚本开始
REM "%RMS_CodeBuilder%" GridJs %RMS_GridJs%
REM "%RMS_CodeBuilder%" FormJs %RMS_FormJs%
"%RMS_CodeBuilder%" EnumVueJs %RMS_EnumJs%
REM "%RMS_CodeBuilder%" TableJs %RMS_TableJs%
REM echo 生成 js 脚本完成

REM echo 开始压缩业务模块js脚本
REM cd /d "%RMS_SourcePath%PDW.SCM.Web\Resource\Scripts\Page"
REM copy ..\Core\ExtJs\ext-lang-zh_CN.js+ ..\Core\ExtJs\ux\data\PagingMemoryProxy.js+..\Core\ExtJs\ux\TabCloseMenu.js+..\Core\ExtJs\ux\form\MultiSelect.js+..\Core\ExtJs\ux\util\HashMap.js+..\Core\JQuery\jquery.min.js+..\Core\artTemplate\template.js+..\Core\HighCharts\highcharts.js+resourcemanager.js+validatorCustom.js+Common\Md5.js+Common\TabCloseMenu.js+main.js+ModuleTemplate\PanelBase.js+ModuleTemplate\PanelGrid.js+ModuleTemplate\WindowBase.js+ModuleTemplate\WindowBaseNew.js+ModuleTemplate\WindowForm.js+ModuleTemplate\CaseBase.js+ModuleTemplate\BusinessCaseBase.js+ModuleTemplate\MeberRptBase.js+ModuleTemplate\MemberCaseBase.js+ModuleTemplate\MemberCasePanel.js+ModuleTemplate\RadioColumn.js+ModuleTemplate\RadioGroupColumn.js+ModuleTemplate\CheckBoxGroupColumn.js+Common\ItemSelecter.js+Common\AutoComplete.js+Common\ButtonExtend.js+Common\ComboGrid.js+Common\ComboGridRemote.js+Common\FormCommon.js+Common\InputCommon.js+Common\PdwWidget.js+Common\RecycleControl.js+Common\EnumExternd.js+Common\FilterControl.js+Common\FilterGridSelect.js+Common\form.js+Common\grid.js+Common\Tables.js+Common\FilterConfig.js+MultiMerchant\+StoreManagement\ PFE.Util.js/b
REM call "%RMS_uglifyjs%" PFE.Util.js -m -o PFE.Util.min.js
REM echo 结束压缩压缩业务模块js脚本
REM echo 开始压缩登录模块js脚本
REM copy common\EnumExternd.js+login.js+resourcemanager.js+common\formcommon.js PFE.Login.js /b
REM call "%RMS_uglifyjs%" PFE.Login.js -m -o PFE.Login.min.js
REM echo 结束压缩登录模块js脚本

:end

----------------------------------------

@echo off

echo *
echo *
echo * 1. Check ENV
echo * 2. npm update
echo * 3. AFE Build
echo * 4. AFE Dev
echo * 5. GMS Build
echo * 6. GMS Dev
echo *
echo *

choice /c:123456 /m "请输入数字选择功能"

if %errorlevel% == 1 goto check
if %errorlevel% == 2 goto npmupdate
if %errorlevel% == 3 goto afebuild
if %errorlevel% == 4 goto afedev
if %errorlevel% == 5 goto gmsbuild
if %errorlevel% == 6 goto gmsdev

 

:check

rem 检查是否管理员权限,可能不准,如果一直提示,请注释下面的代码
:: if "%cd%"=="%SystemRoot%\system32" (echo 检查管理员权限完成) else (goto error)

cd /d %~dp0

echo.
echo 检查检查PDW.GMS.Web里的package.json
if not exist package.json (mklink package.json Public\package.json) else (@echo 正常)

echo.
echo 检查node环境
if not exist node_modules npm install

echo.
echo 检查PDW.AFE.Web里的node_modules
if not exist PDW.AFE.Web\Resource\node_modules (mklink /d PDW.AFE.Web\Resource\node_modules ..\..\node_modules) else (@echo 正常)

echo.
echo 检查PDW.AFE.Web里的components
if not exist PDW.AFE.Web\Resource\src\components (mklink /d PDW.AFE.Web\Resource\src\components ..\..\..\WebComponents) else (@echo 正常)

echo.
echo 检查PDW.AFE.Web里的afe framework
if not exist PDW.AFE.Web\Resource\src\afe (mklink /d PDW.AFE.Web\Resource\src\afe ..\..\..\Public\afe) else (@echo 正常)

echo.
echo. 检查PDW.GMS.Web里的node_modules
if not exist PDW.GMS.Web\Resource\node_modules (mklink /d PDW.GMS.Web\Resource\node_modules ..\..\node_modules) else (@echo 正常)

echo.
echo 检查PDW.GMS.Web里的components
if not exist PDW.GMS.Web\Resource\src\components (mklink /d PDW.GMS.Web\Resource\src\components ..\..\..\WebComponents) else (@echo 正常)

echo.
echo 检查PDW.GMS.Web里的afe framework
if not exist PDW.GMS.Web\Resource\src\afe (mklink /d PDW.GMS.Web\Resource\src\afe ..\..\..\Public\afe) else (@echo 正常)

echo.
echo 检查检查PDW.AFE.Web里的.babelrc
if not exist PDW.AFE.Web\Resource\.babelrc (mklink PDW.AFE.Web\Resource\.babelrc ..\..\Public\.babelrc) else (@echo 正常)

echo.
echo 检查检查PDW.GMS.Web里的.babelrc
if not exist PDW.GMS.Web\Resource\.babelrc (mklink PDW.GMS.Web\Resource\.babelrc ..\..\Public\.babelrc) else (@echo 正常)

echo.
echo 检查检查检查检查WebComponents里的b里的.babelrc
if not exist WebComponents\.babelrc (mklink WebComponents\.babelrc ..\Public\.babelrc) else (@echo 正常)

echo.
echo 检查检查PDW.AFE.Web里的.editorconfig
if not exist PDW.AFE.Web\Resource\.editorconfig (mklink PDW.AFE.Web\Resource\.editorconfig ..\..\Public\.editorconfig) else (@echo 正常)

echo.
echo 检查检查PDW.GMS.Web里的.editorconfig
if not exist PDW.GMS.Web\Resource\.editorconfig (mklink PDW.GMS.Web\Resource\.editorconfig ..\..\Public\.editorconfig) else (@echo 正常)

echo.
echo 检查检查WebComponents里的.editorconfig
if not exist WebComponents\.editorconfig (mklink WebComponents\.editorconfig ..\Public\.editorconfig) else (@echo 正常)

echo.
echo 检查检查PDW.AFE.Web里的.eslintrc.js
if not exist PDW.AFE.Web\Resource\.eslintrc.js (mklink PDW.AFE.Web\Resource\.eslintrc.js ..\..\Public\.eslintrc.js) else (@echo 正常)

echo.
echo 检查检查PDW.GMS.Web里的.eslintrc.js
if not exist PDW.GMS.Web\Resource\.eslintrc.js (mklink PDW.GMS.Web\Resource\.eslintrc.js ..\..\Public\.eslintrc.js) else (@echo 正常)

echo.
echo 检查检查PDW.AFE.Web里的package.json
if not exist PDW.AFE.Web\Resource\package.json (mklink PDW.AFE.Web\Resource\package.json ..\..\Public\package.json) else (@echo 正常)

echo.
echo 检查检查PDW.GMS.Web里的package.json
if not exist PDW.GMS.Web\Resource\package.json (mklink PDW.GMS.Web\Resource\package.json ..\..\Public\package.json) else (@echo 正常)

goto end

:npmupdate
cd /d %~dp0
npm update
goto end

:afebuild
cd %~dp0\PDW.AFE.Web\Resource
npm run build & pause
goto end

:afedev
cd %~dp0\PDW.AFE.Web\Resource
npm run dev
goto end

:gmsbuild
cd /d %~dp0
cd %~dp0\PDW.GMS.Web\Resource
npm run build & pause
goto end

:gmsdev
cd %~dp0\PDW.GMS.Web\Resource
npm run dev
goto end

:error
echo.
echo.
echo 请以管理员权限执行该脚本
echo.
echo.

:end
@pause

 

posted on 2016-04-28 18:36  ringwang  阅读(421)  评论(0编辑  收藏  举报