RMS 5.1: Taking Live Update for a Test Drive
Among the most useful and requested new features in RhoMobile Suite 5.1 is Live Update, which automatically bundles, deploys and displays changes to most types of program code on the target devices without the need to recompile.
Live Update can be a real time-saver for fine-tuning apps, particularly if they're on different platforms. It works with HTML, JavaScript, CSS, Ruby, images and other resource files in the /app and /public folders only. It uses Wi-Fi to connect the development host to multiple target devices running any combination of Android, iOS (and Apple's iOS simulator) or Windows Mobile/CE. But setting it up can be a bit tricky, so we've documented some of the common pitfalls here.
NOTE: This post relates to Live Update on Mac OS X, which is currently the only released and supported version. As of this writing, Live Update on RMS 5.1 for Windows was still in beta.
To create a new project for Live Update (or modify an existing one), its build.yml file must include "development" in its "extensions" line, and "debug" in the "build" line (as below). The extensions line accepts a comma-separated list, but the formatting can vary from one RMS version to another. For compatibility with all versions, use the syntax below for your extensions line (boxed in red). Also see the syntax for the build line (also boxed in red).
Configure Networking
After you build, deploy and launch your modified app, you'll need to discover your device(s). Target device(s) must be on the same Wi-Fi subnet as your development host. If they're not, change the IP address of the development host so that the first three figures of the IP address match those of the devices, and the fourth does not. This might require a call to your IT department. The screenshot below shows the Network Preferences panel of Mac OS X after clicking Wi-Fi and the Advanced… button and selecting the TCP/IP tab. In the case, the machine's subnet is "10.186.6" and it's using DHCP. Clicking on the drop-down indicated by the arrow will permit "Using DHCP with manual address," which allows a user-assigned IP subnet to match that of the device(s).
Discover Devices
- In RhoStudio Project Explorer, right-click on the "Live update setting" document for your app
- From the menu, select "Open With…Live update setting"
- In the top portion of the window that appears at right, double-click the subnet that contains your device(s)
- A list of devices that are running your Live Update-enabled app will appear in the lower portion
- Select the device(s) to be updated and click the "Enable live update" button above the top portion of the window
- R-click your project name and select "Refresh." A new file called "dev-config.yml" will appear in the project.
- Right-click dev-config.yml and select Open With Text editor. Then move on to the next section.
Edit "dev-config.yml" File
Each discovered device will have a section in the dev-config.yml like the one shown below. If you don't see this file, right-click your project and select Refresh. Modify the dev-config.yml file for Live Update:
- Add an indented line stating "enabled: true" for each device to be updated
- After all devices have been enabled, add a non-indented line stating "refresh: 1" to enable the Live Update feature for this app
- Save all changes and build, deploy and run your app on the device(s)
Once your build deploys and runs, you should be able to instantly see any changes you make to settings within your app's /app and /public folders, including modifications to HTML, JavaScript, CSS, Ruby and other files on they're saved. Files can be edited directly using the RhoStudio text editor or any other tool you choose.
For more information about additional Live Update features and options, please refer to the Live Update Guide http://docs.rhomobile.com/en/5.1.1/guide/live-update>. Live Update was introduced in RhoMobile Suite 5.1, and does not work in prior versions. To upgrade your system, download the latest version http://rhomobile.com/download/> and follow the upgrade instructions http://docs.rhomobile.com/en/5.1.1/guide/rhomobile-install>.
Edward Correia