This blog is about tips
on using Sencha Touch.
Steffen Hiller is owner & lead developer of 360releases Ltd.,
a Sencha Touch, Ext JS & Ruby on Rails consultancy shop.
You can follow him on Twitter @steffenhiller.
#8 Organizing files within PhoneGap projects
Here's a quick tip I want to share on how to organize your code repository when working with Sencha Touch and PhoneGap.
It's a good idea to not check in your Sencha Touch app together with your PhoneGap files into the same repository.
First, you can't easily build your PhoneGap app for different platforms, since each platform (iOS, Android, Blackberry, etc.) has its own PhoneGap files.
Secondly, you don't need the PhoneGap files for your web version.
So, there are basically two approaches I've tried.
Symlink
James Pearce from Sencha presented in his PhoneGap webinar the idea of symlinking your Sencha Touch app (www folder) into your PhoneGap project.
Though, for one, there seems to be a bug where you have to "Build & Run" twice after changes in order to make PhoneGap picking up the changes (at least with Xcode 3.2.5 and PhoneGap 0.9.4).
James experienced this in his webinar and I can confirm that it is happening reproducible for me as well.
Secondly, there's a better way. :) (That's way I haven't investigated further such as trying with Xcode 4.)
Submodule (or External)
For the reasons above, it's better to check in your PhoneGap projects and your Sencha Touch app into different repositories.
So you could have the following repositories:
my-project my-project-ios my-project-android
In your PhoneGap project, you simple add your Sencha Touch app (my-project) as a submodule in Git (or as svn:externals in Subversion). The submodule folder would be the www folder in your iOS project or assets/www in your Android project.
Here's how you would add my-project to your my-project-ios project as submodule in Git:
git submodule add /path/to/my-project.git www
Next time you or your co-worker checks out a fresh copy of your iOS or Android project, he or she needs to run:
git submodule update --init
For updating your submodule (after you have initialized it with --init) you just run:
git submodule update
If you want to test uncommitted changes in your PhoneGap project, just edit your files right in your www submodule folder and commit and push them for there.
That's all.
