<?xml version="1.0" encoding="UTF-8"?>
<post>
  <body>&lt;p&gt;Let's say you want to create a new Rails app. Every time you run &quot;rails my_app&quot; you usually also do some other steps such as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
# You need to remove the index.html for your app to work:
rm public/index.html

# Maybe you also create some basic Models everytime:
./script/generate scaffold person name:string

# Adding a route to the homepage
# route &quot;map.root :controller =&gt; :person&quot;

# Migrating the database
rake db:migrate

# The first commit in Git
git init
git add .
git commit -a -m 'Initial commit'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This problem's gone. Edge Rails now supports a solution  using &quot;Templates&quot;. Running a command like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
rails blog -m ~/template.rb
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You're passing parameters to the 'rails' command, telling everything it needs to be done after the creation of the app directory. Things like installing plugins, removing files, putting some default css and image files in /public, the works! So, inside the template.rb file you'd put something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
# template.rb
run &quot;rm public/index.html&quot;
generate(:scaffold, &quot;person name:string&quot;)
route &quot;map.root :controller =&gt; :person&quot;
rake(&quot;db:migrate&quot;)

git :init
git :add =&gt; &quot;.&quot;
git :commit =&gt; &quot;-a -m 'Initial commit'&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Cool, isn't? :)&lt;/p&gt;

&lt;p&gt;Better yet, you can use an URL to the rails command, so from any machine you're using you'll always have the initialization commands at your disposal. How great is that? :)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
rails blog -m http://gist.github.com/31208.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For more information on Rails Templates check &lt;a href=&quot;http://m.onkey.org/2008/12/4/rails-templates&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://omgbloglol.com/rejoice-rg-is-now-part-of-rail&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</body>
  <comments-count type="integer">236</comments-count>
  <created-at type="datetime">2008-12-04T12:52:45Z</created-at>
  <id type="integer">10</id>
  <permalink nil="true"></permalink>
  <slug>rails-templates</slug>
  <title>Rails Templates</title>
  <updated-at type="datetime">2008-12-04T13:00:41Z</updated-at>
  <user-id type="integer" nil="true"></user-id>
</post>
