WebOS development in vim

After getting frustrated with Aptana + Eclipse I decided to start using vim for my WebOS development needs. One of the more interesting features of the WebOS Eclipse plugin is the ability to generate a new scene without having to manually call palm-generate.

So I made a vim command (put this in your ~/.vimrc):

let basedir = "/DATA/projects"

function GenerateScene(basedir, project, name)
    exe '!palm-generate -t new_scene -p "name=' . a:name . '" ' . basedir . '/' . a:project
endfunction

command -nargs=+ Newscene call GenerateScene(basedir, <f-args>)

Now whenever I call :Newscene <project> <scene-name> a new scene called scene-name will be created in /DATA/projects/project

Switching projects?

:let basedir="/path/to/new/project"

Of course, after doing some development I want to do a testrun as well. You'll need to make sure both novacomd and the emulator are running.

The command for packaging, installing and launching the app on the emulator:

:Testrun <project>

And for cleaning up (uninstall and remove the ipk file):

:Cleanup <project>

Here's the code for your ~/.vimrc file:

let domain = "be.venefyxatu.palm."
let appversion = "1.0.0"

function GenerateScene(basedir, project, name)
    exe '!palm-generate -t new_scene -p "name=' . a:name . '" ' . a:basedir . '/' . a:project
endfunction

command -nargs=+ Newscene call GenerateScene(basedir, <f-args>)

function Testrun(basedir, domain, appversion, project)
    call PackageApp(a:basedir, a:project)
    call InstallApp(a:domain, a:project, a:appversion)
    call LaunchApp(a:domain, a:project)
endfunction

function PackageApp(basedir, project)
    silent exe '!palm-package ' . a:basedir . '/' . a:project
endfunction

function InstallApp(domain, project, appversion)
    silent exe '!palm-install ' . a:domain . a:project . '_' . a:appversion . '_all.ipk'
endfunction

function LaunchApp(domain, project)
    silent exe '!palm-launch ' . a:domain . a:project
endfunction

function RemoveApp(basedir, domain, appversion, project)
    silent exe '!palm-install -r ' . a:domain . a:project
    silent exe '!rm -f ' . a:basedir . '/' . a:project . '/' . a:domain . a:project . '_' . a:appversion . '_all.ipk'
endfunction

command -nargs=1 Testrun call Testrun(basedir, domain, appversion, <f-args>)
command -nargs=1 Cleanup call RemoveApp(basedir, domain, appversion, <f-args>)

Yes, there is probably a way to get the domain and version from the appinfo.json file, but I can't really be bothered :-)

This might be interesting as a vim extension as well ... but once again I can't really be bothered :-)

Comments (0)  Permalink

Mojo SDK getting up and running

Palm finally released their WebOS SDK to the public (to be found on http://developer.palm.com ).  Here's what I did to get things up and running on my Gentoo laptop:

  • Download the .deb file
  • Convert the .deb file to a tarball ( deb2targz )
  • Extract the thing to /
  • Try `palm-emulator` and swear some because "Palm Emulator requires that VirtualBox 2.2.0 or greater is installed."  2.2.4 > 2.2.0, right?
  • Some decompiling of the jar files reveals that on Linux, the virtualbox classes simply search for /usr/bin/VBoxManage.  If it's installed somewhere else, tough luck, you don't have virtualbox.  A symlink fixes this.
    Note: on Windows, `reg query HKLM\SOFTWARE\Sun\xVM VirtualBox /v InstallDir` is used to determine the installation directory.  On my Vista x64 box I can execute this query in a DOS prompt and get the correct result, even though the emulator complains.
  • Ignore the novacom warning for now and presto, one booting WebOS VBox machine.

The novacom warning : 

In order to install or debug applications in the Palm Emulator, the novacom 
service must be running on your desktop.

Please verify that you have the latest Palm SDK installed correctly.
`sudo /opt/Palm/novacom/novacomd` fixes this.  There's a /etc/event.d/palm-novacomd script which makes the novacom service start on rulevels 2, 3, 4 and 5.  This is probably a very debian-ish way to do things, but won't quite work for me ;-)
Anyway, I have a running virtual machine and I should be able to install and debug applications from Eclipse.  I'm happy.  For now :-)
Comments (0)  Permalink
1-2/2