Announcing Appsta Jul 13 2009

I’ve just released a new gem called Appsta. Put simply, Appsta makes bootstrapping Rails applications much easier. But really it just builds upon an awesome new feature in Rails 2.3, templates. Templates are like build scripts for new applications - after the skeleton of the application is created, you can use a template to customize it to how you like it, removing unnecessary files, adding in libraries and gems you use regularly etc.

Appsta has two components - the helper library, and the command line tool. The helper library has a few simple commands that can help you when writing a template, by giving you functionality to setup your application on Heroku, creating your project repository on GitHub, and bundling up the creation of a local Git repository into a single command. This means that you can automatically provision source control and web hosting for your application as soon as the application is created, instantly giving you a stable and reliable platform for development.

The command line tool is basically a default Rails template that uses the commands in the helper library to setup your project on GitHub, and host your application on Heroku with two environments (production and staging). It also sets your application up with some default gems, and switches to using jQuery as the JavaScript library.

To install it, simply install the gem:

sudo gem install appsta

The idea is that some of you may like the Appsta defaults, and after installing the gem, will be able to simply run:

appsta <app_name>

to get up and running with your new application. However everyone seems to have their own preferences about frameworks and gems to use when building out a new application, and so more useful will probably be the helper library itself, allowing you to build out your own Rails template, but still make use of simple commands to setup your app on Heroku and GitHub. To do this, load Appsta in your Rails template:

require "appsta"
Appsta.load

and then make use of some of the commands

# sets up the local Git repository - initializing,
# adding all files, and making an initial commit
git_setup

# setup your application on Heroku as a
# production environment (http://app.heroku.com)
heroku
# setup your application on Heroku as a
# staging environment (http://app-staging.heroku.com)
heroku(:staging)

# setup your application on GitHub
github

The Heroku and GitHub commands ask the user for their credentials while running, and the commands themselves return useful information about the remote service so that if you want that can be captured and used later in your template (which is what Appsta does to produce the README file that is generated with a new application).

For more information on the usage of these commands, check out the default template bundled with Appsta. And if you have any questions or comments, please let me know! Likewise if you have improvements, please feel free to fork the project on GitHub, and let me know if you have a contribution you’d like me to look at rolling back into the main tree. This is just version 1.0, so there is plenty of additional functionality that could be built into this helper library.

Lastly, quick shout out to my boy Mike for writing a ton of code on the original version of Appsta before I rewrote the whole thing to take advantage more of Rails templates, and also for chatting over some of the ideas that you see in Appsta today.