Agnostic Application Generators (tennpipes-init)

Overview

Tennpipes comes preloaded with flexible code generators powered in part by the excellent Thor gem (incidentally also used in the Rails 3 generators). These generators are intended to allow for easy code generation both in creating new applications and building on existing ones. The generators have been built to be as library agnostic as possible, supporting a myriad of test frameworks, js libraries, mocking libraries, etc.

See the guide for Tennpipes Generators for a more in-depth look at the system.

Project Generator

Tennpipes provides generator support for quickly creating new Tennpipes applications. This provides many benefits such as constructing the recommended Tennpipes application structure, auto-generating a Gemfile listing all starting dependencies and guidelines provided within the generated files to help orient a new user to using Tennpipes.

One important feature of the generators is that they were built from the ground up to support a wide variety of tools, libraries and gems for use within your tennpipes application.

The simplest possible command to generate a base application would be:

$ tennpipes-init project demo_project

This would construct a Tennpipes application DemoApp (which extends from Tennpipes::Application) inside the folder ‘demo_project’ at our current path. Inside the application there would be configuration and setup performed for the default components.

You can define specific components to be used:

$ tennpipes-init project demo_project -t rspec -r haml -m rr -s jquery -d datamapper

You can also instruct the generator to skip a certain component to avoid using one at all (or to use your own):

$ tennpipes-init project demo_project --test none --renderer none

The available components and their default options are listed below:

test

none (default), bacon, shoulda, cucumber, riot, rspec, minitest, steak

renderer

slim (default), erb, erubis, liquid, haml

stylesheet

none (default), less, compass, sass, scss

mock

none (default), mocha, rr

script

none (default), jquery, prototype, mootools, rightjs, extcore, dojo

orm

none (default), datamapper, mongomapper, mongoid, activerecord, minirecord, sequel, couchrest, ohm, mongomatic, ripple, dynamoid

In addition, you can generate projects based on existing templates:

$ tennpipes-init project demo_project --template sampleblog

To learn more about the project generator, check out the guide to Tennpipes Generators.

Plugin System

Tennpipes provides support for plugins to be executed within your application. For example:

$ tennpipes-init plugin hoptoad

would install the hoptoad middleware into your application automatically.

To learn more about the plugin system, check out the guide to Tennpipes Generators.

Sub App Generator

Unlike other ruby frameworks Tennpipes is principally designed for mounting multiple apps at the same time.

First you need to create a project

$ tennpipes-init project demo_project
$ cd demo_project

Now you are in demo_project and you can create your apps:

$ tennpipes-init app one
$ tennpipes-init app two

By default these apps are mounted under:

* /one
* /two

but you can edit config/apps.rb and change it.

To learn more about the subapp generator, check out the guide to Tennpipes Generators.

Model Generator

Tennpipes provides generator support for quickly creating new models within your Tennpipes application. Note that the models (and migrations) generated are specifically tailored towards the ORM component and testing framework chosen during application generation.

Very important to note that model generators are intended primarily to work within applications created through the Tennpipes application generator and that follow Tennpipes conventions. Using model generators within an existing application not generated by Tennpipes will likely not work as expected.

Using the model generator is as simple as:

$ tennpipes-init model User

You can also specify desired fields to be contained within your User model:

$ tennpipes-init model User name:string age:integer email:string

To learn more about the model generator, check out the guide to Tennpipes Generators.

Migration Generator

Tennpipes provides generator for quickly generating new migrations to change or manipulate the database schema. These migrations generated will be tailored towards the ORM chosen when generating the application.

Very important to note that migration generators are intended primarily to work within applications created through the Tennpipes application generator and that follow Tennpipes conventions. Using migration generators within an existing application not generated by Tennpipes will likely not work as expected.

Using the migration generator is as simple as:

$ tennpipes-init migration AddFieldsToUsers
$ tennpipes-init migration RemoveFieldsFromUsers

To learn more about the migration generator, check out the guide to Tennpipes Generators.

Controller Generator

Tennpipes provides generator support for quickly creating new controllers within your Tennpipes application. Note that the controller tests are generated specifically tailored towards the testing framework chosen during application generation.

Very important to note that controller generators are intended primarily to work within applications created through the Tennpipes application generator and that follow Tennpipes conventions.

Using the controller generator is as simple as:

$ tennpipes-init controller Admin

You can also specify desired actions to be added to your controller:

$ tennpipes-init controller Admin get:index get:new post:create

To learn more about the controller generator, check out the guide to Tennpipes Generators.

Mailer Generator

Tennpipes provides generator support for quickly creating new mailers within your Tennpipes application. Very important to note that mailer generators are intended primarily to work within applications created through the Tennpipes application generator and that follow Tennpipes conventions.

Using the mailer generator is as simple as:

$ tennpipes-init mailer UserNotifier

To learn more about the mailer generator, check out the guide to Tennpipes Generators.

Copyright © 2011-2013 Tennpipes. See LICENSE for details.