-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 985f692
Showing
1,150 changed files
with
296,389 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
importPackage(java.lang); | ||
importPackage(java.io); | ||
importPackage(javax.script); | ||
importPackage(com.sencha.util); | ||
importPackage(com.sencha.util.filters); | ||
importPackage(com.sencha.logging); | ||
importPackage(com.sencha.exceptions); | ||
|
||
var _logger = SenchaLogManager.getLogger("app-build"); | ||
|
||
function resolvePath() { | ||
return new File(joinPath.apply(this, arguments)).getAbsolutePath(); | ||
} | ||
|
||
function joinPath() { | ||
var len = arguments.length, i, paths = []; | ||
for (i = 0; i < len; i++) { | ||
if (_logger.isTraceEnabled()) { | ||
_logger.trace("adding path arg : {}", arguments[i]); | ||
} | ||
paths.push(arguments[i]); | ||
} | ||
return paths.join(File.separator); | ||
} | ||
|
||
function copyFiles(proj, dir, todir, includes, excludes) { | ||
var task = proj.createTask("copy"), | ||
fileset = proj.createDataType('fileset'); | ||
|
||
fileset.setDir(new File(dir)); | ||
if(includes) { | ||
fileset.setIncludes(includes); | ||
} | ||
|
||
if(excludes) { | ||
fileset.setExcludes(excludes); | ||
} | ||
|
||
task.setTodir(new File(todir)); | ||
task.addFileset(fileset); | ||
task.execute(); | ||
} | ||
|
||
function moveFiles(proj, from, to, includes, excludes) { | ||
var task = proj.createTask("move"), | ||
fileset = proj.createDataType('fileset'); | ||
|
||
fileset.setDir(new File(from)); | ||
if(includes) { | ||
fileset.setIncludes(includes); | ||
} | ||
|
||
if(excludes) { | ||
fileset.setExcludes(excludes); | ||
} | ||
|
||
task.setTodir(new File(to)); | ||
task.addFileset(fileset); | ||
task.execute(); | ||
} | ||
|
||
function moveFile(proj, from, to) { | ||
var task = proj.createTask("move"); | ||
task.setTofile(new File(to)); | ||
task.setFile(new File(from)); | ||
task.execute(); | ||
} | ||
|
||
function runAppUpgrade(proj) { | ||
var basedir = proj.getProperty("basedir"), | ||
appPath = proj.getProperty("args.path"), | ||
sdkPath = resolvePath(basedir, '..'), | ||
appSdkFile = resolvePath(appPath, '.senchasdk'), | ||
appSdkPtr = FileUtil.readFile(resolvePath(appSdkFile)).trim(), | ||
appSdkPath = resolvePath(appPath, appSdkPtr), | ||
newSdkVersion = FileUtil.readFile(resolvePath(sdkPath, 'version.txt')).trim(), | ||
oldSdkVersion = FileUtil.readFile(resolvePath(appSdkPath, "version.txt")).trim(), | ||
backupPath = resolvePath(appSdkPath + StringUtil.formatString('-%s-backup', oldSdkVersion)); | ||
|
||
_logger.debug("sdk: {} app: {}", sdkPath, appSdkPath); | ||
|
||
if(newSdkVersion == oldSdkVersion) { | ||
_logger.info( | ||
"This SDK (version {}) is identical to the application's SDK, nothing to upgrade.", | ||
newSdkVersion); | ||
return; | ||
} | ||
|
||
_logger.info( | ||
"Upgrading your application from SDK version '{}' to version '{}'", | ||
oldSdkVersion, | ||
newSdkVersion); | ||
|
||
_logger.debug("Backing up application sdk from {} to {}", | ||
appSdkPath, | ||
backupPath); | ||
|
||
moveFiles(proj, appSdkPath, backupPath); | ||
|
||
_logger.info("Renamed {} to {} for backup", appSdkPath, backupPath); | ||
|
||
copyFiles(proj, sdkPath, appSdkPath, [ | ||
"src/**/*", | ||
'resources/**/*', | ||
'command/**/*', | ||
'microloader/**/*', | ||
'version.txt', | ||
'.sencha*', | ||
'implicitClassDependencies', | ||
'sencha-touch-debug.js', | ||
'sencha-touch-all-debug.js' | ||
].join(',')); | ||
|
||
moveFile(proj, | ||
resolvePath(appSdkPath, 'sencha-touch-all-debug.js'), | ||
resolvePath(appSdkPath, 'sencha-touch-all.js')); | ||
|
||
moveFile(proj, | ||
resolvePath(appSdkPath, 'sencha-touch-debug.js'), | ||
resolvePath(appSdkPath, 'sencha-touch.js')); | ||
|
||
_logger.info( | ||
"Your application has successfully been upgraded. To revert this operation, simply remove '{}' and rename '{}' back to '{}'", | ||
[ | ||
appSdkPath, | ||
backupPath, | ||
appSdkPath | ||
]); | ||
|
||
} | ||
|
||
(function (proj) { | ||
try { | ||
_logger.info("building application"); | ||
runAppUpgrade(proj); | ||
} catch (err) { | ||
_logger.error("Exception running app build : " + err); | ||
throw err; | ||
} | ||
})(project); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
function success(message) { | ||
console.log(message); | ||
phantom.exit(0); | ||
} | ||
|
||
function error(message) { | ||
console.log(message); | ||
phantom.exit(1); | ||
} | ||
|
||
var args = phantom.args, | ||
uri = args[0], | ||
elapse = 0, | ||
dependencies, timer; | ||
|
||
var page = new WebPage(); | ||
|
||
page.settings.localToRemoteUrlAccessEnabled = true; | ||
page.settings.ignoreSslErrors = true; | ||
page.settings.webSecurityEnabled = false; | ||
|
||
page.onError = function(message, trace) { | ||
console.log(message); | ||
console.log("Stack trace:"); | ||
trace.forEach(function(item) { | ||
console.log(' ', item.file, ':', item.line, ':', item['function'] || 'Anonymous'); | ||
}); | ||
phantom.exit(1); | ||
}; | ||
|
||
page.open(uri, function(status) { | ||
if (status !== 'success') { | ||
error("Failed openning: '" + uri + "', please verify that the URI is valid"); | ||
} | ||
|
||
page.evaluate(function() { | ||
if (typeof Ext == 'undefined') { | ||
throw new Error('Ext is not defined, please verify that the application URL is correct'); | ||
return; | ||
} | ||
|
||
Ext.onReady(function() { | ||
var documentLocation = document.location, | ||
currentLocation = documentLocation.origin + documentLocation.pathname + documentLocation.search, | ||
dependencies = [], | ||
path; | ||
|
||
function getRelativePath(from, to) { | ||
var fromParts = from.split('/'), | ||
toParts = to.split('/'), | ||
index = null, | ||
i, ln; | ||
|
||
for (i = 0, ln = toParts.length; i < ln; i++) { | ||
if (toParts[i] !== fromParts[i]) { | ||
index = i; | ||
break; | ||
} | ||
} | ||
|
||
if (index === null || index === 0) { | ||
return from; | ||
} | ||
|
||
fromParts = fromParts.slice(index); | ||
|
||
for (i = 0; i < ln - index - 1; i++) { | ||
fromParts.unshift('..'); | ||
} | ||
|
||
for (i = 0, ln = fromParts.length; i < ln; i++) { | ||
if (fromParts[i] !== '..' && fromParts[i+1] === '..') { | ||
fromParts.splice(i, 2); | ||
i -= 2; | ||
ln -= 2; | ||
} | ||
} | ||
|
||
fromParts = fromParts.map(function(part){ | ||
return decodeURIComponent(part); | ||
}); | ||
|
||
return fromParts.join('/'); | ||
} | ||
|
||
Ext.Loader.history.forEach(function(item) { | ||
path = Ext.Loader.getPath(item); | ||
path = getRelativePath(path, currentLocation); | ||
|
||
dependencies.push({ | ||
path: path, | ||
className: item | ||
}); | ||
}); | ||
|
||
Ext.__dependencies = dependencies; | ||
}); | ||
}); | ||
|
||
timer = setInterval(function() { | ||
dependencies = page.evaluate(function() { | ||
return Ext.__dependencies; | ||
}); | ||
|
||
if (dependencies) { | ||
clearInterval(timer); | ||
success(JSON.stringify(dependencies, null, 4)); | ||
} | ||
|
||
elapse += 100; | ||
|
||
if (elapse > 5000) { | ||
clearInterval(timer); | ||
error("Timeout waiting for the application to finish loading"); | ||
} | ||
}, 100); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
[ | ||
{ | ||
"baseClassName" : "Ext.Component", | ||
"propertyName" : "componentLayout", | ||
"aliasPrefix" : "layout.", | ||
"defaultPropertyName" : "defaultComponentLayoutType" | ||
}, | ||
{ | ||
"baseClassName" : "Ext.container.AbstractContainer", | ||
"propertyName" : "layout", | ||
"aliasPrefix" : "layout.", | ||
"defaultPropertyName" : "defaultLayoutType" | ||
}, | ||
{ | ||
"baseClassName" : "Ext.data.Model", | ||
"propertyName" : "proxy", | ||
"aliasPrefix" : "proxy.", | ||
"defaultPropertyName" : "defaultProxyType" | ||
}, | ||
{ | ||
"baseClassName" : "Ext.data.proxy.Proxy", | ||
"propertyName" : "reader", | ||
"aliasPrefix" : "reader.", | ||
"defaultPropertyName" : "defaultReaderType" | ||
}, | ||
{ | ||
"baseClassName" : "Ext.data.proxy.Proxy", | ||
"propertyName" : "writer", | ||
"aliasPrefix" : "writer.", | ||
"defaultPropertyName" : "defaultWriterType" | ||
}, | ||
{ | ||
"baseClassName" : "Ext.data.Store", | ||
"propertyName" : "proxy", | ||
"aliasPrefix" : "proxy." | ||
}, | ||
{ | ||
"baseClassName" : "Ext.data.Store", | ||
"propertyName" : "model", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Profile", | ||
"propertyName" : "models", | ||
"aliasPrefix" : "model.", | ||
"isProfileDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Profile", | ||
"propertyName" : "stores", | ||
"aliasPrefix" : "store.", | ||
"isProfileDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Profile", | ||
"propertyName" : "views", | ||
"aliasPrefix" : "view.", | ||
"isProfileDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Profile", | ||
"propertyName" : "controllers", | ||
"aliasPrefix" : "controller.", | ||
"isProfileDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Controller", | ||
"propertyName" : "models", | ||
"aliasPrefix" : "model.", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Controller", | ||
"propertyName" : "stores", | ||
"aliasPrefix" : "store.", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Controller", | ||
"propertyName" : "views", | ||
"aliasPrefix" : "view.", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Application", | ||
"propertyName" : "controllers", | ||
"aliasPrefix" : "controller.", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Application", | ||
"propertyName" : "profiles", | ||
"aliasPrefix" : "profile.", | ||
"isMvcDep" : true | ||
}, | ||
{ | ||
"baseClassName" : "Ext.app.Application", | ||
"propertyName" : "forms", | ||
"aliasPrefix" : "form.", | ||
"isMvcDep" : true | ||
} | ||
|
||
] |
Oops, something went wrong.