Rhomobile Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – Build it for different smart phones

It's time to make the first build for our application and see the magic that the Rhogen command has done. We will build our employee application for iPhone, Android, and Blackberry.

Let's go to the application directory and build it for iPhone, Blackberry, Android, and Windows phone:

$ cd employee_application

We will now learn about the rake command, which will help us when building our application. To get all the options available with the rake command, go to your application directory and type:

rake -T

You will get a list of all the options available with rake command:

rake clean:android              # Clean Android
rake clean:bb                   # Clean bb
rake clean:iphone               # Clean iphone
rake clean:win32                # Clean win32
rake clean:wm                   # Clean wm
rake clobber_rdoc               # Remove rdoc products
rake config:checkbb             # Check local blackberry configuration
rake device:android:debug       # Build debug self signed for device
rake device:android:production  # Build production signed for device
rake device:bb:debug            # Build debug for device
rake device:bb:production       # Build production for device
rake device:iphone:production   # Builds and signs iphone for production
rake device:wm:production       # Build production for device or emulator
rake package:bb:production_sim  # Package all production (all parts in one ...
rake run:android                # build and launch emulator
rake run:android:device         # build and install on device
rake run:bb                     # Builds everything, loads and starts bb si...
rake run:bb:startsim            # Start Blackberry simulator
rake run:bbapp                  # Builds everything and loads application o...
rake run:bbdev                  # Same as run:bb, but only supports 
one app...
rake run:iphone                 # Builds everything, launches iphone simulator
rake run:win32                  # Run win32
rake run:wm                     # Build and run on WM6 emulator
rake run:wm:cab                 # Build, install .cab and run on WM6 emulator
rake run:wm:device              # Build and run on the Windows Phone
rake run:wm:device:cab          # Build, install .cab  and run on the Windo...
rake uninstall:android          # uninstall from emulator
rake uninstall:android:device   # uninstall from device

Now, we will use the following commands for building the application for different phones:

  1. For building it for iPhone, we will use the following command and then our employee application will start in an iPhone simulator:
    $ rake run:iphone
    
  2. For building it for Blackberry, we will use the following command and then our employee application will start in the Blackberry simulator:
    $rake run:bb
    
  3. For building it for Android we will use the following command and then our employee application will start in the Android simulator:
    $rake run:android
    
  4. To build it for other phones we can use the following commands:
    • Windows Mobile
      rake run:wm
    • Windows 7
      rake run:wp

What just happened?

We have just run our cross-platform employee application on various smart phones and tested it on device simulators. We have also seen how they will appear on the iPhone, Blackberry, and Android.