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.
Important Update
Beet now comes with recipes for Rails 3, and defaults to generating 3.0 applications as well. This is not backwards compatible, but given the less than 1.0 versioning and the fact that I don't believe many people are currently using it, I've made the choice to push forward and progress with the latest state of technology. If you have problems with this, please let me know and I'll do my best to help you out.
If you want to use the older rails 2 recipes, you can still do so by specifying the project type of rails:
beet generate new_app -p rails --recipes="rails/jquery, rails/authlogic, rails/git"Usage
beet generate new_app --recipes="rails3/js/jquery, rails3/auth/devise, rails3/git"This will create a new rails3 app for you, download jquery, setup Devise, and put the project into git.
beet -g new_app -r="rails3/js/jquery, rails3/auth/devise, rails3/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 [text]You can see a list of current recipes by passing in '--list' or '-l'. Pass in a text to search for to limit the output, for instance:
beet --list rails3
To only see the recently completed rails3 recipes.
beet just_recipe [app_name] -r=rails3/db/mysqlYou 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 "rails3/js/jquery, rails3/db/mysql, rails3/git" --save jquery_mysql_gitTired 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_gitOnce you've saved a configuration, you can reuse it with the -u/--use option and its name.
beet -d -r rails3/js/jqueryYou can use -d/--display to display the content of a recipe or template.
beet -j -r standalone/hadesRight now the -g command is focused on building rails 3 apps. To skip that you can just use -j to run 'just' the recipe. This particular recipe hades lets you create skinny daemons as described in this post: http://labs.headlondon.com/2010/07/skinny-daemons/
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.6
- thor ~> 0.14.0
Recipes
Here's a list of recipes for those interested:- passenger/vhost
- rack/middleware
- rails3
- admin_interface
- active_scaffold
- auth
- devise
- clean_files
- db
- mysql
- css
- reset
- file_uploads
- paperclip
- js
- jquery
- git
- rails
- auth
- authlogic
- clearance
- devise
- clean_files
- cms
- bcms_blog
- bcms_event
- css
- blueprint
- reset
- compass
- db
- mongo
- mysql
- postgres
- git
- jquery
- swfupload
- testing
- rspec
- shoulda
- standalone
- hades
Installing
If you're using gem cutter, you should be able to run:gem install beetgem install jackdempsey-beet -s http://gems.github.comYou can download in other formats if need be:
Bugs/Feature Requests
Now with 1.9.1 & 1.9.2 support - Thanks to jastix and invalidrecord Beet now works with Ruby 1.9.1 and 1.9.2. I've used it with RVM and 1.9.2 while developing the Rails 3 features, and as far as I can tell, it's all good. Please let me know if it seems otherwise to you.
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 jackdempsey.me
If you like or use this library you can recommend me on workingwithrails.com, or hire me for your next project.


