6

What's the best practise for managing a phonegap project in git?

Currently I have the www folder as a git repository, but the iPhone version of phonegap adds a phonegap.js into that folder and I don't want to commit that because it is iPhone specific (I want to share the repo between the different platforms). I'm also worried that I am probably putting the .git folder onto the phone (which is a complete waste of space).

Also, should I be minifying all my code before bundling it into the app (e.g. with uglify.js). How can I keep the unminified code in git, and have XCode's build and run command (for the iPhone version) minifiy it before copying it to the phone?

What about Eclipse/Android?

Edit This question is highly outdated now, based on older versions of phonegap. Cordova cli and corodva 3 have changed the landscape completely (for the better). See this question.

Community
  • 1
  • 1
rjmunro
  • 27,203
  • 20
  • 110
  • 132

2 Answers2

1

You can disable the automatic generation of phonega.js.

  • On the left panel of XCode go to Targets -> Your App
  • Double on "Copy Phonegap Javascript" and modify it according to your needs.

Then you can also modify all the other shell scripts or add your own scripts to fit your needs.

Felipe Brahm
  • 3,162
  • 1
  • 28
  • 42
0

In term of release management, Git shouldn't be in the picture (unless, as you mention in your question, you want to end up with a .git on the phone).

The build step should output the minifyied code outside of the Git repo, and then build and deploy.

As for the phonegap.js, if it is platform specific, it could be added to a .gitignore file (don't forget to contribute back to the gitignore project), while keeping a:

  • phonegap.js.template file
  • phonegap.js.value1 for the phone-specific values
  • phonegap.js.value2 for the another platform-specific values
  • a script able to generate the right (private) phonegap.js file depending on the current platform.
    See this question for instance: that script can be the smudge step of a custom filter driver)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I probably should have emphasized XCode more in the question. How do I configure XCode to work efficently with phonegap and git? Phonegap.js is generated for me by Phonegap, it doesn't need to be templated in any repository. – rjmunro Mar 02 '11 at 15:38
  • @rjmunro: ok, I didn't fully grasp the right scope of your question ;) But the first part is still relevant. – VonC Mar 02 '11 at 16:48