incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Mueller (Commented) (JIRA)" <>
Subject [jira] [Commented] (CB-280) Improve layout of cordova-js scripts
Date Thu, 22 Mar 2012 18:44:22 GMT


Patrick Mueller commented on CB-280:

Figured I'd post the script I'm using to refactor the file locations, since this will end
up not appearing in the final commit.  This assumes that you've previously done a

mv lib lib0

The script recreates the {{lib}} directory, based on the contents of the old {{lib}} directory,
which you've just renamed (via the command above) to {{lib0}}.


# the only purpose of this script is to convert
# a lib/ -based cordova-js tree to the new
# lib-*/ -based one.  should not be in the
# final commit, just transient till the
# new framework is committed.

rm -rf lib

mkdir lib
mkdir lib/common

cp -R lib0/* lib/common
mv lib/common/cordova.js lib/cordova.js

echo "throw new Error('should have been replaced at build time with platform implementation')"
> lib/common/exec.js
echo "throw new Error('should have been replaced at build time with platform implementation')"
> lib/common/platform.js

mkdir -p lib/android/plugin/android
mkdir -p lib/blackberry/plugin/blackberry
mkdir -p lib/errgen/plugin/errgen
mkdir -p lib/ios/plugin/ios
mkdir -p lib/playbook/plugin/playbook
mkdir -p lib/test/plugin/test
mkdir -p lib/webworks/plugin/webworks
mkdir -p lib/wp7/plugin/wp7

mv lib/common/exec/android.js    lib/android/exec.js
mv lib/common/exec/blackberry.js lib/blackberry/exec.js
mv lib/common/exec/errgen.js     lib/errgen/exec.js
mv lib/common/exec/ios.js        lib/ios/exec.js
mv lib/common/exec/playbook.js   lib/playbook/exec.js
mv lib/common/exec/test.js       lib/test/exec.js
mv lib/common/exec/wp7.js        lib/wp7/exec.js

rmdir lib/common/exec

mv lib/common/platform/android.js    lib/android/platform.js
mv lib/common/platform/blackberry.js lib/blackberry/platform.js
mv lib/common/platform/errgen.js     lib/errgen/platform.js
mv lib/common/platform/ios.js        lib/ios/platform.js
mv lib/common/platform/playbook.js   lib/playbook/platform.js
mv lib/common/platform/wp7.js        lib/wp7/platform.js
mv lib/common/platform/common.js     lib/common/common.js

rmdir lib/common/platform

mv lib/common/plugin/android/*.js       lib/android/plugin/android
mv lib/common/plugin/blackberry/*.js    lib/blackberry/plugin/blackberry
mv lib/common/plugin/errgen/*.js        lib/errgen/plugin/errgen
mv lib/common/plugin/ios/*.js           lib/ios/plugin/ios
mv lib/common/plugin/playbook/*.js      lib/playbook/plugin/playbook
mv lib/common/plugin/webworks/*.js      lib/webworks/plugin/webworks
mv lib/common/plugin/wp7/*.js           lib/wp7/plugin/wp7

rmdir lib/common/plugin/android
rmdir lib/common/plugin/blackberry
rmdir lib/common/plugin/errgen
rmdir lib/common/plugin/ios
rmdir lib/common/plugin/playbook
rmdir lib/common/plugin/webworks
rmdir lib/common/plugin/wp7

mkdir lib/scripts
mv lib/common/bootstrap.js lib/scripts
mv lib/common/require.js   lib/scripts

mv lib/common/bootstrap/errgen.js   lib/scripts/bootstrap-errgen.js
mv lib/common/bootstrap/playbook.js lib/scripts/bootstrap-playbook.js

rm -rf lib/common/bootstrap
> Improve layout of cordova-js scripts
> ------------------------------------
>                 Key: CB-280
>                 URL:
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.5.0
>            Reporter: Filip Maj
>            Assignee: Filip Maj
>            Priority: Minor
>             Fix For: 1.6.0
> Originally proposed by Pat on the mailing list. Reorganize the directory names and conventions
used in the builder to make the association between javascript files and modules (and their
ids) clearer.
> From Pat's e-mail:
> - rename `~/lib` to `~/cordova`; there is no more `~/lib`.
> - mkdir ~/platform
> - mkdir ~/platform/android
> - mkdir ~/platform/...
> - move platform-specific stuff in ~/cordova (was ~/lib), in such a way as
> each module exists in a path associated with it's eventual module id,
> prefixed by `~/platform/[whicheverPlatform]`
> - move non-modules into a 'new' `~/lib` directory; it's more than just
> require.js - bootstrap, etc
> Now, to do a build for a platform:
> - collect as modules all files from ~/cordova
> - collect as modules all files from ~/platform/[whicheverPlatform]/cordova
> - collect as scripts all files from ~/lib
> bonusi:
> - the files are laid out exactly as the modules will be named, modulo
> platform-specific prefix directories for platform-specific files; no more
> in-head conversion when I'm looking at directory listings of modules.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message