Fork me on GitHub

Beet

What

Beet is a gem that provides easily remixable project generation.

Why

Rails Templates are useful, but rigid. If you want to customize them, you have to create an entirely separate file. With Beet, you can easily create a rails project and pick a variety of small recipes to run, letting you create different types of projects with each new command.

Currently most of the Beet's features support building Rails apps, but the eventual plan is to have other types of projects and recipes.

Usage

beet generate new_app --recipes="rails/jquery, rails/authlogic, rails/git"

This will create a new rails app for you, download jquery, setup everything AuthLogic needs, and put the project into git.

beet -g new_app -r="rails/jquery, rails/authlogic, rails/git"

This will do the same. Beet is built on Thor, and makes use of its excellent option parsing abilities.

beet -g new_app -r="http://path/to/recipe.rb"

You can also pass a url to the template.

beet --list

You can see a list of current recipes by passing in '--list' or '-l'.

beet just_recipe [app_name] -r=rails/db/mysql

You can also call just_recipe (aliased to -j as well) to just run a recipe without generating a new app. Pass in the directory to the app, or assume the current directory.

beet -g complex -r "rails/jquery, rails/db/mysql, rails/git" --save jquery_mysql_git

Tired of typing out these commands each time? Beet provides a -s/--save feature to make the common configurations you use that much easier to reuse. Pass in a name to --save or Beet will prompt you later.

beet -g complex_part_deux --use jquery_mysql_git

Once you've saved a configuration, you can reuse it with the -u/--use option and its name.

beet -d -r rails/jquery
beet -d -t browsercms_demo

You can use -d/--display to display the content of a recipe or template.

There's More

So far we've just been generating Rails apps, which is useful, but only one side of Beet. There's no reason you can't use Beet to generate other things, like Sinatra apps, iPhone projects, Passenger vHost files, and so on.

There's a recipes repository living at http://github.com/jackdempsey/beet-recipes for easy forking and contributing of future recipes.

You can also set an environment variable, BEET_RECIPES_DIR, if you'd like beet to look in other directories on your system for recipes.

Now with features!

The 0.3.1 release brings with it a new features directory. You'll find some basic features set in place, and there's more to come in that arena. Much thanks to Dr. Nic's Tweet Tail project, from which I lifted a lot of the common file system steps. At some point soon, I'd like to rip them out again and make a gem of common steps that one could use to easily test their gems that generate files, etc.

Dependencies

  • rubygems = 1.3.5
  • thor ~> 0.11.6

Recipes

Here's a list of recipes for those interested:
  • passenger/vhost.rb
  • rack/middleware.rb
  • Rails
    • Auth
      • authlogic.rb
      • clearance.rb
      • devise.rb
    • clean_files.rb
    • CMS
      • bcms_blog.rb
      • bcms_event.rb
    • CSS
      • blueprint.rb
      • reset.rb
    • DB
      • mysql.rb
      • postgres.rb
    • git.rb
    • jquery.rb
    • Testing
      • rspec.rb
      • shoulda.rb

Installing

If you're using gem cutter, you should be able to run:
gem install beet
Otherwise you can install an older version from github with:
gem install jackdempsey-beet -s http://gems.github.com

You can download in other formats if need be:

Bugs/Feature Requests

Now with 1.9.1 support - Thanks to jastix and invalidrecord Beet now works with Ruby 1.9.1. This is brand new though, so please let me know if you have any problems or issues.

The full and most up to date source is at github:

http://github.com/jackdempsey/beet/

Feel free to fork and build your own recipes. A repo exists for community contributions at http://github.com/jackdempsey/beet-recipes/tree/master. If you find bugs, open a ticket at GitHub Issues

License

This code is free to use under the terms of the MIT license.

Contact

Feel free to email me at jack dot dempsey at gmail dot com.

When I have time I blog at jackndempsey.blogspot.com

If you like or use this library you can recommend me on workingwithrails.com, or hire me for your next project.