Chapter 6. Deploying

So now you’re a budding Enyo developer looking to deploy your app to all the platforms supported by Enyo. The only question you have is: how? In this chapter we’ll explore the tools and techniques you’ll need to structure your apps and deploy them to various targets. We’ll now have to set up a “real” development environment since we’re not likely to deploy our apps by directing users to a jsFiddle page.

For this chapter I’ll assume you’ve followed the Bootplate environment setup guide in Appendix A. You will be able to apply some of these tools to other setups.

Web Targets

One of the simplest ways to deploy Enyo is to host it on a server and serve the apps embedded into a web page. Although all our examples have shown rendering Enyo objects into the document body, it is possible to render them into any element on the page. For web deployment, simply copy the Enyo library and app source code up to a directory on your server and include them into your HTML source.

Bootplate makes this process easy by including a deploy script that packages all the files and minimizes the source. This process speeds up loading and combines everything into a single directory. Once packaged, deploying is as simple as transferring the files to your host. Keep in mind that deployed code is much tougher to debug than debug code.

Desktop Targets

If you want to create an installable Windows app, then Intel’s AppUp encapsulator makes it easy. Visit their site, fill out the fields in the “Make your app” tab, and then upload a .zip file of the contents of your deployment directory. In moments you will have an installable file that can be included in Intel’s AppUp app center.

On the “Advanced (APIs etc)” tab you will find information on APIs that AppUp makes available to your app. Using these, you can extend your app to take advantage of native features and in-app purchases through the AppUp center.

Mobile Targets

By far the most interesting place for apps these days is on smartphones and tablets. Enyo is perfectly suited to this environment. Enyo doesn’t provide any kinds that give direct access to the hardware components of these devices and not all device features have an HTML standard method for access. PhoneGap, which is based on Apache’s open source Cordova project, handles direct access to these features and provides a method for creating natively installable apps.

Enyo has a PhoneGap support package available in the extra repository at GitHub. For more information on Cordova support with Enyo, please see PhoneGap Native Functions on the Enyo wiki.

PhoneGap Build

One of the simplest ways to get started with deploying mobile apps is to use Adobe PhoneGap Build. PhoneGap Build is a web-based tool for packaging cross-platform JavaScript apps. Among other things, it allows you to create installable apps for multiple targets quickly and easily.

After registering, you can pull projects directly from GitHub or, for private (as opposed to public, open source) projects, upload a .zip file. It is very easy to zip the contents of the deploy/bootplate directory and upload it to PhoneGap Build. For some platforms you will need to supply developer credentials before you have an installable app. Additionally, you’ll want to set up app icons and other metadata needed by the various mobile stores.

Local PhoneGap Builds

PhoneGap Build is easy to use but it doesn’t give you a lot of flexibility. Installing PhoneGap locally gives you much finer-grained control and access to using the build tools available on your platform of choice. In general, you will want to start with a shell app appropriate for the platform you wish to deploy on and then copy the deploy files to the www directory. Be careful to ensure that you load cordova.js or your app may not work correctly.

For more information on getting started with PhoneGap, visit the Getting Started Guides page.

Summary

You should now be familiar with some of the ways to package and deploy Enyo apps. Using this knowledge you can deploy your apps on the various mobile and desktop platforms and know that your apps will work.