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

Time for action – Creating an employee application

To create a Rhodes Application, we can either use Rhogen or its alias; Rhodes commands. Virtually all Rhodes applications start the same way; with the Rhogen command. This handy program creates a skeleton of a Rhodes application in a directory of your choice. To get started, make a directory for your Rhodes projects and then run the command rhogen app <application_name> to make the initial sample application.

For our employee application, we'll run the following commands:

$ mkdir Rhodes_app
$ cd Rhodes_app
$ rhogen app employee_application

Generating with app generator:

     [ADDED]  employee_application/rhoconfig.txt
     [ADDED]  employee_application/build.yml
     [ADDED]  employee_application/app/application.rb
     [ADDED]  employee_application/app/index.erb
     [ADDED]  employee_application/app/index.bb.erb
     [ADDED]  employee_application/app/layout.erb
     [ADDED]  employee_application/app/loading.html
     [ADDED]  employee_application/Rakefile
     [ADDED]  employee_application/app/helpers
     [ADDED]  employee_application/icon
     [ADDED]  employee_application/app/Settings
     [ADDED]  employee_application/public
     [ADDED]  employee_application/app/loading.png

Notice the output, how many files and directories the Rhogen command creates. This automatic generation of standard directories and file structure is one of the many advantages of Rhodes. It immediately gets you from zero to a basic functional application. Moreover, since the structure is common to all the Rhodes apps, you can immediately get your bearings when looking at someone else's code. We'll learn about most of these files and the directories in the rest of this book.

What just happened?

We just created an employee application using the Rhogen command. This command automatically generates a basic skeleton for your application, which can be enhanced easily according to your needs.

Have a go hero – Exploring the Rhogen command

Now, we will explore the capabilities of the Rhogen command. To get a list of all the options available for this command, type the following in the command prompt:

$ rhogen

The following output should be generated: