Building a Rhodes Application

For your first application you are going to create an application that will let you enter product inventory on your phone. This is a basic application with one model that will allow you to create, edit, and delete inventory records on the device.

To create the initial skeleton of the application, you issue the "rhogen app" command. This will generate a starting directory with support files; Rhodes applications are organized in a fixed directory structure. The rhogen command is not required. You could create the files you need manually or simply copy and modify a previous application.

On the command line, type "rhogen app inventory" to generate the initial skeleton for the application (Listing 6-3).

Listing 6-3. Rhodes app generation

$ rhogen app inventory Generating with app generator:

[ADDED] inventory/rhoconfig.txt [ADDED] inventory/build.yml [ADDED] inventory/app/application.rb [ADDED] inventory/app/index.erb


[ADDED] inventory/app/

[ADDED] inventory/app/layout.erb

[ADDED] inventory/app/loading.html

[ADDED] inventory/Rakefile

[ADDED] inventory/app/helpers

[ADDED] inventory/icon

[ADDED] inventory/app/Settings

[ADDED] inventory/public

This creates the boilerplate files for the application including a "Settings" screen that is very useful in development, but will usually be replaced with one or more custom screens before the application is complete. Table 6-1 lists all of the top-level files and folders that are generated. Most of the development that you do will be to modify and create new files in the /app directory. These files and subdirectories are listed in Table 6-2.

Table 6-1. Top-level files and folders generated by the "rhogen app" command



Rakefile Used for building Rhodes applications from the command line.

rhoconfig.txt Contains application specific options and configurations such as the start path definition, logging options, and the optional URL for your sync server. To change the default-landing page of your application, simply change start_path to point to a different page within the directory structure.

build.yml Contains application-specific build information such as the name of the application, and the version of the SDK to use when building for specific platforms.

app/ This directory contains the models, device settings, default-landing page, and application layout page.

public/ This directory contains static files that are accessible by your application, such as

CSS, images, and JavaScript libraries.


This directory contains the icons for your application.

Table 6-2. Files and folders in the /app directory generated by the "rhogen app" command

Application File/Folders



Responsible for login and device specific settings.


Contains functions designed to help in the development process.


Application specific setup and configuration.


The default-landing page for the application. This page will typically have

links to the controllers for at least some of the data models.


Contains the header file for the entire application.


The initial loading page on startup

The file types that have been generated for you in the application include Ruby files (*.rb) that contain application business logic and configuration, and HTML with embedded Ruby files (*.erb) ( for your user interface. These are the two main file types that you will be working with when writing Rhodes applications.

HTML, CSS, and Ruby are what Rhodes developers use to create the layout of the user interface; rather than writing code to build native UI controls with libraries such as UIKit on the iPhone.

Was this article helpful?

0 0
iPhone and iPad App Cash

iPhone and iPad App Cash

Discover how a single application could generate $1000's of dollars, instantly. The simple, low cost system for outsourcing app development to freelancers. How to quickly evaluate applications so you can create a high profit one of your very own. The fastest way to leverage the popularity of iPhone and iPad apps to skyrocket your income. Top methods for promoting your application for maximum exposure.

Get My Free Ebook

Post a comment