Build process experiments with PhoneGap

I’ve made some quick updates on the train this morning, and ended up creating a Bourne shell script in the iPhone directory of PhoneGap for renaming a brand-new PhoneGap fork to whatever your project is called. This also works with the previous changes I made to my buildprocess branch, meaning that when you’re done, you shouldn’t have any references to PhoneGap in your code at all. It also makes developing quite a lot easier, since renaming my XCode project file by hand is cumbersome, and needs to be done every time I start a new project.

Here’s the excerpt from its usage information, which is printed when you run the command without any arguments:

Usage: ./iphone/rename-phonegap.sh [-r] [-v] [-g] -n 
  -n  Specify the name of the new project
  -r  Rename all instances of PhoneGap; use with care, as
      this will make it very difficult to merge in future updates
  -v  Enable verbose mode
  -g  Use git to rename files

Quite simply, it uses some shell scripting magic to rename the appropriate files, and update your Info.plist file with the necessary settings that can control behaviour within the Objective-C code. And if you pass it the -g flag, it will make those updates in Git, so you can (hopefully) more easily merge changes down from Github.

With luck, if Apple doesn’t have any problems with PhoneGap and their developers just see the phrase in our source code, assuming it’s some nefarious framewor that the app developers are pulling in, this should be enough to get the apps passing on their own merit.  I really didn’t want to have to do this, and I’d prefer to revert this in the future if I can get through to Apple on my open letter I’d sent, but until that happens, this will have to do.

Also, I thought I’d mention that I haven’t heard back from Apple, despite sending in repeated emails. I recently called their support team, but was told by a woman with a beautiful Irish accent that she couldn’t do anything for me.  As far as she knew, the iTunes Connect department doesn’t have any sort of phone number to reach them, and the iTunes Connect database isn’t viewable by any other departments.  I’m sending another email out today, but for every passing day I get less and less optimistic.

5 thoughts on “Build process experiments with PhoneGap

  1. Yes, I manage my different features in different branches. The idea is that the “master” branch is the stable set of features. When I work on experimental features, I make those changes in a different branch until they’re mature enough to be merged into master.

    However, that being said, I just merged the buildprocess changes into master, so you should be all good.

    Like

  2. Great. Thanks for clarifying. Two new questions though:

    1) did you make some changes to where the main javascript is located? from previous nachos packages I had a master.js file located in www which is where I configured the tab bar etc. Now I cant see this, and it references a app.js in the index.html file which I can locate. Sorry if Im missing something..

    2) do you have an example of how to run the renamer properly from terminal in mac?

    Thanks! Im a big fan

    Like

  3. Heh fun, I’ve never had fans before. Maybe I should start a “Nacho’s Fanclub” and people could all wear goofy hats and sing songs on TV. No? Okay, sounds fine to me.

    To answer your questions:

    1) I’d covered that in a previous blog post, but basically the “configure” script creates a Makefile that generates your JavaScript file for you. This then merges all your changes together into one single app JS file. Then, there’s a script that XCode runs at build-time called iphone/build-phonegap.sh that rebuilds this javascript file and places it in the build directory for you. This is important because you don’t want to check generated code in to Git, or any version control system. It just causes problems in the long-run.

    What I find works well is if I want to do debugging in Safari, I include two script tags. One to load “app.js”, and another that loads “../build/Build-iphoneos/…/app.js”. In Safari, the first one fails and the second one loads, and in the phone the reverse happens.

    2) ./iphone/rename-phonegap.sh -g -r -n ‘My App’

    Like

  4. Thanks. Have you gotten the cam functions to work properly? I know you have it in your demo, but I cant get it work, neither taking a pic, nor save externally from the library.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s