我一直在努力使用新的 Sencha SDK Tools v3 Beta(是的,我知道,beta),以便我可以优化我的 sencha-touch 项目,但进展并不顺利。
我的目标是将我的项目优化合并到我们的持续集成构建中——在构建过程中运行下面的优化代码:
sencha app build -e testing
我已经在我的 Mac OS X 机器上运行它,并且正在让它在 Unix 构建服务器上运行(通过 Jenkins)。但是,由于我的应用程序版本 sencha-touch v2.0.1 和 Sencha Cmd v3.0.0.141 之间的版本不兼容,它失败了。
我的应用程序很小,我想,好吧,我会按照他们方便的说明使用 Sencha Cmd v3.0.0.141 升级我的 v2.0.1 应用程序。根据文档,我需要做的就是:
cd [my sencha-touch app dir]
sencha upgrade /path/to/the/latest/sencha-touch/sdk
升级过程确实做了一些事情,请参见下面的输出,但我的应用程序现在已损坏,因为它找不到依赖项:
GET http://localhost:8080/product-selector/event/publisher/Dom.js?_dc=1348770723554 404 (Not Found) sencha-touch.js:7986
GET http://localhost:8080/product-selector/event/Dispatcher.js?_dc=1348770723544 404 (Not Found) sencha-touch.js:7986
Uncaught Error: [Ext.Loader] Failed loading './event/publisher/Dom.js', please verify that the file exists sencha-touch.js:8328
Uncaught Error: [Ext.Loader] Failed loading './event/Dispatcher.js', please verify that the file exists sencha-touch.js:8328
有人知道那个答案吗?404 文件 Dom.js 和 Dispatcher.js 位于升级过程中创建的“touch”目录中。这里奇怪的是代码没有在里面查找,它只是在查看根目录。我检查了 app.json 文件以查看是否有任何需要更正以将其指向“触摸”目录的内容,但没有找到任何内容。这是升级命令的输出:
~/work/product-selector/web-app (feature/upgrade ✔) ᐅ sencha app upgrade ~/frameworks/sencha/sencha-touch
Sencha Cmd v3.0.0.141
[INFO ] init-properties:
[INFO ] init-antcontrib:
[INFO ] init-sencha-command:
[INFO ] init:
[INFO ] -before-app-upgrade:
[INFO ] app-upgrade-impl:
[INFO ] building application
[INFO ] [move] Moving 1342 files to /Volumes/Magnetic/Users/x/work/product-selector/web-app/./.sencha_backup/2.0.1.1/sdk
[INFO ] Renamed /Volumes/Magnetic/Users/x/work/product-selector/web-app/./sdk to /Volumes/Magnetic/Users/x/work/product-selector/web-app/./.sencha_backup/2.0.1.1 for backup
[INFO ] [copy] Copying 5 files to /Volumes/Magnetic/Users/x/work/product-selector/web-app/./.sencha_backup/2.0.1.1
[INFO ] Creating new application structure
[INFO ] init-properties:
[INFO ] init-antcontrib:
[INFO ] init-sencha-command:
[INFO ] init:
[INFO ] -before-generate-workspace:
[INFO ] generate-workspace-impl:
[INFO ] -before-copy-framework-to-workspace:
[INFO ] copy-framework-to-workspace-impl:
[INFO ] [copy] Copying 1150 files to /Volumes/Magnetic/Users/x/work/product-selector/web-app/touch
[INFO ] [copy] Copied 187 empty directories to 1 empty directory under /Volumes/Magnetic/Users/x/work/product-selector/web-app/touch
[INFO ] [copy] Copying 1 file to /Volumes/Magnetic/Users/x/work/product-selector/web-app/touch
[INFO ] [copy] Copying 1 file to /Volumes/Magnetic/Users/x/work/product-selector/web-app/touch
[INFO ] -after-copy-framework-to-workspace:
[INFO ] copy-framework-to-workspace:
[INFO ] -after-generate-workspace:
[INFO ] generate-workspace:
[INFO ] init-properties:
[INFO ] init-antcontrib:
[INFO ] init-sencha-command:
[INFO ] init:
[INFO ] -before-generate-app:
[INFO ] generate-app-impl:
[INFO ] Generating new packager.json file using native packager
[INFO ] copy-sdk:
[INFO ] -after-generate-app:
[INFO ] generate-app:
[INFO ] Updating references to framework files
[INFO ] -after-app-upgrade:
[INFO ] app-upgrade:
最后一点:升级过程不是我的主要目标,记住我只想在我的构建服务器上自动优化我的构建。我尝试在我的 Unix 构建服务器上安装旧版本的 SDK,但它甚至没有与我的 Apple 笔记本电脑上相同版本的相同命令。所以,我的第二个问题是:
无论如何我可以在我的 sencha touch 2 应用程序中自动进行资源优化吗?例如,这是通过 jenkins 实现的。