rails_apps_composer 1.5.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/README.textile +185 -254
  2. data/lib/rails_wizard/command.rb +54 -13
  3. data/lib/rails_wizard/config.rb +1 -1
  4. data/lib/rails_wizard/diagnostics.rb +22 -0
  5. data/lib/rails_wizard/template.rb +36 -2
  6. data/lib/rails_wizard.rb +1 -0
  7. data/recipes/auth.rb +84 -0
  8. data/recipes/controllers.rb +58 -0
  9. data/recipes/{seed_database.rb → database.rb} +35 -22
  10. data/recipes/{action_mailer.rb → email.rb} +29 -50
  11. data/recipes/example.rb +70 -0
  12. data/recipes/extras.rb +91 -30
  13. data/recipes/frontend.rb +59 -0
  14. data/recipes/gems.rb +128 -0
  15. data/recipes/models.rb +61 -0
  16. data/recipes/prelaunch.rb +45 -0
  17. data/recipes/readme.rb +83 -0
  18. data/recipes/routes.rb +36 -0
  19. data/recipes/setup.rb +148 -0
  20. data/recipes/testing.rb +187 -0
  21. data/recipes/views.rb +39 -0
  22. data/spec/rails_wizard/template_spec.rb +4 -2
  23. data/templates/helpers.erb +53 -2
  24. data/templates/layout.erb +81 -20
  25. data/version.rb +1 -1
  26. metadata +19 -49
  27. data/recipes/active_admin.rb +0 -36
  28. data/recipes/activerecord.rb +0 -37
  29. data/recipes/add_user.rb +0 -140
  30. data/recipes/airbrake.rb +0 -34
  31. data/recipes/backbone.rb +0 -23
  32. data/recipes/capybara.rb +0 -34
  33. data/recipes/cleanup.rb +0 -40
  34. data/recipes/cloudfiles.rb +0 -36
  35. data/recipes/compass.rb +0 -46
  36. data/recipes/compass_960.rb +0 -48
  37. data/recipes/cucumber.rb +0 -75
  38. data/recipes/datamapper.rb +0 -111
  39. data/recipes/devise.rb +0 -114
  40. data/recipes/git.rb +0 -40
  41. data/recipes/guard.rb +0 -89
  42. data/recipes/haml.rb +0 -23
  43. data/recipes/heroku.rb +0 -61
  44. data/recipes/home_page.rb +0 -58
  45. data/recipes/home_page_users.rb +0 -47
  46. data/recipes/html5.rb +0 -152
  47. data/recipes/inherited_resources.rb +0 -23
  48. data/recipes/less.rb +0 -12
  49. data/recipes/mongohq.rb +0 -59
  50. data/recipes/mongoid.rb +0 -38
  51. data/recipes/mongolab.rb +0 -59
  52. data/recipes/omniauth.rb +0 -194
  53. data/recipes/omniauth_email.rb +0 -82
  54. data/recipes/paperclip.rb +0 -79
  55. data/recipes/prelaunch_signup.rb +0 -586
  56. data/recipes/rails_admin.rb +0 -29
  57. data/recipes/redis.rb +0 -23
  58. data/recipes/responders.rb +0 -10
  59. data/recipes/resque.rb +0 -25
  60. data/recipes/rspec.rb +0 -131
  61. data/recipes/sass.rb +0 -25
  62. data/recipes/settingslogic.rb +0 -43
  63. data/recipes/simple_form.rb +0 -54
  64. data/recipes/slim.rb +0 -46
  65. data/recipes/static_page.rb +0 -43
  66. data/recipes/subdomains.rb +0 -121
  67. data/recipes/turnip.rb +0 -18
  68. data/recipes/unicorn.rb +0 -29
  69. data/recipes/users_page.rb +0 -165
data/README.textile CHANGED
@@ -1,396 +1,327 @@
1
- h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer Gem
1
+ h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer 2.0
2
2
 
3
- What you can do with the rails_apps_composer gem:
4
-
5
- * Create and maintain a starter app.
6
- * Make an application template that generates a complex Rails app in seconds.
7
-
8
- We use the rails_apps_composer gem to create the "Rails Example Apps":http://railsapps.github.com/ for the "RailsApps project":https://github.com/RailsApps.
3
+ The Rails Apps Composer gem installs a command line tool to assemble a Rails application from a collection of "recipes."
9
4
 
10
- Any issues? Please create a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues.
5
+ What you can do with the rails_apps_composer gem:
11
6
 
12
- h4. Based on Michael Bleigh's RailsWizard Gem
7
+ * create a starter app from the command line
8
+ * make a reusable application template
13
9
 
14
- The rails_apps_composer gem is a fork of "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard (see credits below). The purpose of the fork is to provide recipes for ready-to-run Rails starter apps. Several recipes provided by the rails_apps_composer gem are different from those provided by the rails_wizard gem. Applications generated with the rails_apps_composer gem are more complete; for example, they may include a home page with sign-in, sign-out navigation links.
10
+ The "Rails Composer":http://railsapps.github.com/rails-composer/ tool is built with the rails_apps_composer gem. The Rails Composer tool creates the "example applications":http://railsapps.github.com/ for the "RailsApps":http://railsapps.github.com/ project.
15
11
 
16
- h4. Alternatives
12
+ The "Guide to the Rails Apps Composer Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html provides complete documentation:
17
13
 
18
- Notable alternatives are Dr. Nic Williams's "App Scrolls":http://appscrolls.org/ and Daniel Davey's "app_drone":http://drone.bz/.
14
+ * "Overview":http://railsapps.github.com/tutorial-rails-apps-composer.html#Overview
15
+ * "Recipes":http://railsapps.github.com/tutorial-rails-apps-composer.html#Recipes
16
+ * "Usage":http://railsapps.github.com/tutorial-rails-apps-composer.html#Usage
17
+ * "Diagnostics":http://railsapps.github.com/tutorial-rails-apps-composer.html#Diagnostics
18
+ * "Hacking the Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html#Hacking
19
+ * "Anatomy of a Recipe":http://railsapps.github.com/tutorial-rails-apps-composer.html#Anatomy
20
+ * "Architecture":http://railsapps.github.com/tutorial-rails-apps-composer.html#Architecture
21
+ * "Defaults File":http://railsapps.github.com/tutorial-rails-apps-composer.html#Defaults
19
22
 
20
- See a list of "Rails Application Template Projects":http://railsapps.github.com/rails-application-templates.html, particularly a list of "Application template-generating gems."
23
+ Any issues? Please create a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues.
21
24
 
22
25
  h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter
23
26
 
24
27
  Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. Tweet some praise if you like what you've found.
25
28
 
26
- h2. Purpose
29
+ h2. What's New in Version 2.0
27
30
 
28
- Any developer can quickly generate a Rails web application using the @rails new@ command. In practice, experienced Rails developers typically add an assortment of useful additional packages (gems) before beginning development of any web application. A developer often uses the same set of packages to get started and may create a "starter app" that can be copied and reused for any new project.
31
+ Rails_apps_composer 2.0 is significantly different from earlier versions:
29
32
 
30
- It can be a hassle to integrate some of the most commonly used gems, particularly when new versions are released and there are minor "gotchas" that interfere with gems working together. Despite the apparent convenience of creating a starter app, it can be time consuming to maintain and update a starter app as component packages evolve. This project aims to simplify the process of building and maintaining a starter app by providing mix-and-match recipes to assemble the most commonly used Rails packages.
33
+ * the "Guide":http://railsapps.github.com/tutorial-rails-apps-composer.html provides complete documentation
34
+ * diagnostics compare your selected recipes and preferences to known working combinations
35
+ * the generated application README.textile file provides a diagnostics report
36
+ * an improved "quiz" sets preferences
37
+ * a new preferences hash makes preferences available to all recipes
38
+ * recipes and preferences can be set in a defaults file
39
+ * gems can be added at a prompt or from a defaults file (no need to write a recipe for many gems)
40
+ * a new 'copy_from_repo' method adds powerful downloading of files to any recipe
41
+ * downloading of files from the example app repos reduces the complexity of recipes
42
+ * the 'copy_from_repo' method converts ERB files to Haml or Slim
43
+ * recipes have been reorganized for easier maintenance
44
+ * recipes are based on functionality (e.g., authentication, testing) instead of gems (Devise, RSpec)
45
+ * a prompt sets -T or -O args when generating an application
46
+ * the 'extras' recipe creates a project-specific gemset and .rvmrc file
31
47
 
32
- h2. Issues
48
+ Most important, many unsupported or outdated recipes have been removed. If your favorite recipe is missing, please update it and test it with version 2.0, then submit a pull request. I'm happy to add new recipes.
49
+
50
+ h2. Who This Is For
51
+
52
+ This gem is for experienced Rails developers who need a tool to create and maintain a Rails starter app or Rails application template. If you're regularly building Rails applications that use certain popular gems or rely on common functionality such as authentication, you can benefit from the rails_apps_composer gem.
33
53
 
34
- Hundreds of developers are using this gem to build starter apps. As you can see from the commit log, the gem is actively maintained and the collection of recipes is growing.
54
+ If you are new to Rails, try the "Rails Composer":http://railsapps.github.com/rails-composer/ tool instead. It provides an application template that is generated from the rails_apps_composer gem's core recipes. It is easier to use.
35
55
 
36
- There is problem with all this activity, however. No developer who uses the rails_apps_composer gem uses all the recipes. And it would be very difficult to test a recipe in every possible combination. Consequently, combining some recipes may not work. We've provided some examples from the "RailsApps project":https://github.com/RailsApps that are known to work together (see "Examples"). If you're combining recipes, you'll have to experiment. Add recipes one-by-one and realize that some recipes may not be compatible.
56
+ h2. Alternatives
37
57
 
38
- Have you found problems? Please create a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues.
58
+ The rails_apps_composer gem is derived from Michael Bleigh's "RailsWizard":https://github.com/intridea/rails_wizard gem. Early versions of the rails_apps_composer gem were a close fork of Michael Bleigh's gem; rails_apps_composer 2.0 differs substantially. Other notable alternatives are Dr. Nic Williams's "App Scrolls":http://appscrolls.org/ and Daniel Davey's "app_drone":http://drone.bz/. See a list of "Rails Application Template Projects":http://railsapps.github.com/rails-application-templates.html, particularly a list of "Application template-generating gems" for similar projects.
39
59
 
40
60
  h2. Dependencies
41
61
 
42
- Before generating a new Rails app, you will need:
62
+ Before using the rails_apps_composer gem, you will need:
43
63
 
44
64
  * The Ruby language (version 1.9.3)
45
65
  * Rails 3.1 or newer
46
66
 
47
- See "Installing Rails":http://railsapps.github.com/installing-rails.html for detailed instructions and advice.
67
+ See the article "Installing Rails":http://railsapps.github.com/installing-rails.html for advice about updating Rails and your development environment.
48
68
 
49
69
  h2. Installation
50
70
 
71
+ I recommend installing and using rvm, the "Ruby Version Manager":https://rvm.io/, to create a new gemset for rails_apps_composer. Using an rvm gemset will make it easier to identify and isolate incompatibilities among gems.
72
+
51
73
  Installation is simple:
52
74
 
53
75
  @$ gem install rails_apps_composer@
54
76
 
55
77
  h2. Usage
56
78
 
57
- h4. List Recipes
79
+ These commands are summarized here for your reference. See the "Guide to the Rails Apps Composer Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html for details.
58
80
 
59
- <pre>
60
- $ rails_apps_composer list
61
- </pre>
62
-
63
- You can learn more about the available recipes by browsing the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes.
81
+ h3. List Recipes
64
82
 
65
- h4. Generate an App
83
+ You can list recipes with short descriptions:
66
84
 
67
85
  <pre>
68
- $ rails_apps_composer new myapp -r haml home_page html5
69
- </pre>
70
-
71
- The command with the @-r@ flag followed by a list of recipes generates an app.
72
-
73
- h4. Generate an App from Defaults
86
+ $ rails_apps_composer list
74
87
 
75
- <pre>
76
- $ rails_apps_composer --defaults=~/.rac
88
+ auth # Add authentication and authorization.
89
+ controllers # Add controllers needed for starter apps.
90
+ database # Set up and initialize database.
91
+ email # Configure email accounts.
92
+ extras # Various extras.
93
+ frontend # Install a front-end framework for HTML5 and CSS.
94
+ gems # Add the gems your application needs.
95
+ models # Add models needed for starter apps.
96
+ prelaunch # Generates a Prelaunch Signup App
97
+ readme # Build a README file for your application.
98
+ routes # Add routes needed for starter apps.
99
+ setup # Make choices for your application.
100
+ testing # Add testing framework.
101
+ views # Add views needed for starter apps.
77
102
  </pre>
78
103
 
79
- Use the @~/.rac@ file to specify a list of recipes and recipe preferences. See details below concerning the format of the defaults file.
80
-
81
- h4. Generate a Template
82
-
83
- You may want a template to customize or share with others. See various "application templates":https://github.com/RailsApps/rails3-application-templates from the "RailsApps project":https://github.com/RailsApps.
104
+ The above list is current for rails_apps_composer 2.0; later releases will contain more recipes.
84
105
 
85
- <pre>
86
- $ rails_apps_composer template ~/Desktop/template.txt -r haml home_page html5
87
- </pre>
106
+ You can learn more about the available recipes by examing the source code in the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes.
88
107
 
89
- The command with the @template@ argument followed by a filename and a list of recipes generates an application template.
108
+ h3. Recipe Order and Interdependency
90
109
 
91
- Generate an app from the template at any time:
110
+ The order in which you input a list or recipes determines the order of execution unless a recipe contains a @requires@ or @run_after@ directive.
92
111
 
93
- <pre>
94
- $ rails new myapp -m ~/Desktop/template.txt
95
- </pre>
112
+ A recipe may contain a @requires@ directive which specifies other recipes which must be present before a recipe can run. The @requires@ constraint will force the rails_apps_composer program to load any required recipes, even if you don't add them explicitly.
96
113
 
97
- Here is more information about usage of the gem.
114
+ Recipes may also contain a @run_after@ directive. The rails_apps_composer program will organize the order of execution so that any recipes in the @run_after@ list will execute earlier. That is, the recipe will run after everything else in the list.
98
115
 
99
- h2. Generate an App
116
+ In general, it's best to add (or list) recipes in the order they should execute as some recipes may not contain a necessary @requires@ or @run_after@ directive.
100
117
 
101
- Mix and match recipes to create your own customized starter app. See an annotated list of available "recipes for the rails_apps_composer gem":http://railsapps.github.com/rails-apps-recipes.html. For an up-to-date list, browse the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes to see what is available. Then provide your list of recipes to the rails_apps_composer gem using the @-r@ option and generate an app as needed. Here's an example that creates a simple app using haml:
118
+ See the "Anatomy of a Recipe":http://railsapps.github.com/tutorial-rails-apps-composer.html#Anatomy section in the Guide to learn about the format of a recipe.
102
119
 
103
- <pre>
104
- $ rails_apps_composer new myapp -r haml home_page html5
105
- </pre>
120
+ h3. Skipping Test::Unit or Active Record
106
121
 
107
- Replace @myapp@ with the name you want for your application.
122
+ If you plan to use RSpec instead of Test::Unit, or use an ORM such as Mongoid instead of Active Record, you can pass the @-T@ or @-O@ flags to the @rails new@ command so it will skip Test::Unit or Active Record.
108
123
 
109
- h2. Generate an App from Defaults
124
+ When you generate an application interactively using the rails_apps_composer gem, the program will ask if you want to skip Test::Unit or Active Record.
110
125
 
111
- If you frequently generate an app and always use the same recipes and preferences, create a defaults file and produce the same app every time. A big thank you to Bryan Stearns for contributing this feature!
126
+ When you generate an application template, you will not be asked if you want to skip Test::Unit or Active Record. An application template runs after the @rails new@ command so it cannot set the @-T@ or @-O@ arguments.
112
127
 
113
- <pre>
114
- $ rails_apps_composer --defaults=~/.rac
115
- </pre>
128
+ Any recipe can set the @-T@ or @-O@ arguments using the @args@ directive. However, this has no affect on application templates and is only useful when an application is generated interactively.
116
129
 
117
- If you create a shell alias such as @builditnow@ for the command, you'll have even less to remember.
130
+ h3. Generate an Application Interactively
118
131
 
119
- Here's the format of a typical defaults file:
132
+ You'll be prompted for recipes and gems:
120
133
 
121
134
  <pre>
122
- recipes:
123
- - activerecord
124
- - home_page
125
- - html5
126
- - sass
127
- - rspec
128
- - capybara
129
- - guard
130
- - extras
131
- - git
132
-
133
- activerecord:
134
- database: sqlite3
135
- auto_create: true
136
-
137
- devise:
138
- devise: standard
139
- authorization: false
140
-
141
- extras:
142
- footnotes: false
143
- ban_spiders: true
144
- paginate: false
145
- jsruntime: false
146
-
147
- guard:
148
- guard: standard
149
-
150
- html5:
151
- css_option: bootstrap_sass
152
-
153
- rspec:
154
- rspec: true
155
- fixtures: factory_girl
156
-
157
- sass:
158
- sass: true
135
+ $ rails_apps_composer new myapp
136
+
137
+ Would you like to skip Test::Unit? (yes for RSpec) (y/n)
138
+ Would you like to skip Active Record? (yes for NoSQL) (y/n)
139
+
140
+ Available Recipes:
141
+ apps: prelaunch
142
+ auth: auth
143
+ configuration: email, gems, readme, setup
144
+ example: example
145
+ frontend: frontend
146
+ initialize: database
147
+ mvc: controllers, models, routes, views
148
+ other: extras
149
+ testing: testing
150
+
151
+ Which recipe would you like to add? (blank to finish)
152
+ What gem would you like to add? (blank to finish)
153
+
154
+ Generating basic application, using:
155
+ "rails new myapp -m <temp_file>"
159
156
  </pre>
160
157
 
161
- You'll have to look in the recipe files to determine the attribute (such as @css_option@) used to specify preferences.
162
-
163
- The list of recipes at the top will be included whenever you generate an app. The remaining hashes will be used to respond to prompts (questions) that recipes display. If there is no preference specified in the defaults file, rails_apps_composer will ask you to respond with a preference. That way, you can give yourself flexibility if you don't always have the same preference.
164
-
165
- When you run the command with the @--defaults@ option and no recipes specified on the command line, you'll see the prompt, "Which recipe would you like to add? (blank to finish)". If you want to use only your default recipes, just hit return. If you want to add a recipe for the app you are generating, just type the recipe name at the prompt. If you've provided your preferences for the recipe in your defaults file, you won't be prompted for preferences. If you haven't provided default preferences for the additional recipe, you'll be prompted normally.
158
+ You will only be able to choose recipes that are contained in the rails_apps_composer gem.
166
159
 
167
- h2. Generate a Template
160
+ You can specify any gem. Any string you enter will be added as a gem in the starter app Gemfile.
168
161
 
169
- The rails_apps_composer gem creates an application template as an intermediate step before generating an application. You can generate and save the application template. You may want a template to customize or share with others.
162
+ h3. Generate an Application from a List of Recipes
170
163
 
171
- Here's an example of generating an application template and saving the template to a file:
164
+ Provide a list of recipes:
172
165
 
173
166
  <pre>
174
- $ rails_apps_composer template ~/Desktop/template.txt -r haml home_page html5
175
- </pre>
176
-
177
- The command with the @template@ argument followed by a filename and a list of recipes generates an application template.
178
-
179
- The rails_apps_composer gem creates an application template that can be used by the @rails new@ command with the @-m@ option. You can specify a local file as a template. For example:
180
-
181
- <pre>
182
- $ rails new myapp -m ~/Desktop/template.txt
183
- </pre>
184
-
185
- The @raisl new@ command allows you to specify the @-T -O@ flags as needed to skip Test::Unit files and Active Record files.
167
+ $ rails_apps_composer new myapp -r setup readme gems testing auth email models controllers views routes frontend database extras
186
168
 
187
- The @-m@ option also allows you to specify a file that can be downloaded via HTTP. This makes it possible to host a template on GitHub (for example) and allow anyone to generate an application from the hosted template. For example:
169
+ Would you like to skip Test::Unit? (yes for RSpec) (y/n)
170
+ Would you like to skip Active Record? (yes for NoSQL) (y/n)
171
+ What gem would you like to add? (blank to finish)
188
172
 
189
- <pre>
190
- $ rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb
173
+ Generating basic application, using:
174
+ "rails new myapp -m <temp_file>"
191
175
  </pre>
192
176
 
193
- That's all it takes. You'll have a ready-to-use Rails web application in seconds.
194
-
195
- h2. Recipe Compatibility
177
+ The program will prompt you for your preferences before generating an application.
196
178
 
197
- Our goal is to offer a collection of recipes that are known to work well together. The most commonly used recipes will likely work together because many developers have used the recipes and resolved any integration issues.
179
+ h3. Generate an Application from Defaults
198
180
 
199
- Some of the recipes in the repository are contributed by developers who use only a few of the recipes. For example, the repository has recipes for Mongoid and OmniAuth that are known to work together. However, we don't know (for example) if the Mongoid and RailsAdmin recipes work together.
200
-
201
- The maintainers and contributors to the project can't test every combination of recipes. We rely on contributors to alert us to issues and contribute patches as needed. If you find recipes that don't combine properly, please alert us with a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues and contribute a fix if you can.
202
-
203
- h2. Examples
204
-
205
- We use the rails_apps_composer gem to create the "Rails Example Apps":http://railsapps.github.com/ for the "RailsApps project":https://github.com/RailsApps. These example apps have been used by thousands of Rails developers. The recipes used for the RailsApps examples are well-integrated and known to work in the specific combinations listed below.
206
-
207
- h4. Template for Rails 3 + Haml + HTML5
208
-
209
- This application template will offer you a choice of Haml or ERB, give you options for a CSS front-end framework such as Twitter Bootstrap, and create a default application layout using HTML5:
181
+ Use a defaults file for recipes, preferences, and extra gems so you don't have to provide them interactively. Then generate an application with:
210
182
 
211
183
  <pre>
212
- $ rails_apps_composer template ~/Desktop/template.txt -r haml home_page html5 cleanup extras git
184
+ $ rails_apps_composer new myapp --defaults=my_defaults.yaml
213
185
  </pre>
214
186
 
215
- Then generate the application:
187
+ Use the @my_defaults.yaml@ file to specify a list of recipes, preferences, and extra gems. You can use any name (and file extension) for the file. See the "Defaults File":http://railsapps.github.com/tutorial-rails-apps-composer.html#Defaults section in the Guide to learn about the format of the defaults file.
216
188
 
217
- <pre>
218
- $ rails new myapp -m ~/Desktop/template.txt
219
- </pre>
189
+ h3. Generate an Application Template Interactively
220
190
 
221
- h4. Template for Prelaunch Signup App
191
+ You may want an application template to share with others. For an example of an application template, see the "Rails Composer":http://railsapps.github.com/rails-composer/ tool or various "application templates":https://github.com/RailsApps/rails3-application-templates from the RailsApps project.
222
192
 
223
- To build an application template for the "rails-prelaunch-signup":http://github.com/RailsApps/rails-prelaunch-signup/ example application, run the command:
193
+ Specify a filename for the template:
224
194
 
225
195
  <pre>
226
- $ rails_apps_composer template ~/Desktop/template.txt -r prelaunch_signup
196
+ $ rails_apps_composer template ~/Desktop/template.rb
197
+
198
+ Available Recipes:
199
+ apps: prelaunch
200
+ auth: auth
201
+ configuration: email, gems, readme, setup
202
+ example: example
203
+ frontend: frontend
204
+ initialize: database
205
+ mvc: controllers, models, routes, views
206
+ other: extras
207
+ testing: testing
208
+
209
+ Which recipe would you like to add? (blank to finish)
210
+ What gem would you like to add? (blank to finish)
211
+ Generating and saving application template...
212
+ Done.
227
213
  </pre>
228
214
 
229
- Then generate the application using the @-T@ flag.
215
+ The command with the @template@ argument followed by a filename generates an application template. You can add additional recipes or gems when prompted.
230
216
 
231
- <pre>
232
- $ rails new rails-prelaunch-signup -m ~/Desktop/template.txt -T
233
- </pre>
217
+ h3. Generate an Application Template from a List of Recipes
234
218
 
235
- h4. Template for Rails 3 + Devise + RSpec + Cucumber
236
-
237
- To build an application template for the "rails3-devise-rspec-cucumber":http://github.com/RailsApps/rails3-devise-rspec-cucumber/ example application, run the command:
219
+ Specify a filename for the template and provide a list of recipes:
238
220
 
239
221
  <pre>
240
- $ rails_apps_composer template ~/Desktop/template.txt -r haml rspec cucumber guard action_mailer devise add_user home_page home_page_users seed_database users_page html5 simple_form cleanup extras git
241
- </pre>
222
+ $ rails_apps_composer template ~/Desktop/template.rb -r setup readme gems testing auth email models controllers views routes frontend database extras
242
223
 
243
- Then generate the application using the @-T@ flag.
244
-
245
- <pre>
246
- $ rails new rails3-devise-rspec-cucumber -m ~/Desktop/template.txt -T
224
+ What gem would you like to add? (blank to finish)
225
+ Generating and saving application template...
226
+ Done.
247
227
  </pre>
248
228
 
249
- h4. Template for Rails 3 + Mongoid + Devise
250
-
251
- To build an application template for the "rails3-mongoid-devise":http://github.com/RailsApps/rails3-mongoid-devise/ example application, run the command:
229
+ The command with the @template@ argument followed by a filename and a list of recipes generates an application template.
252
230
 
253
- <pre>
254
- $ rails_apps_composer template ~/Desktop/template.txt -r haml rspec cucumber guard mongoid action_mailer devise add_user home_page home_page_users seed_database users_page html5 simple_form cleanup extras git
255
- </pre>
231
+ h3. Generate an Application Template from Defaults
256
232
 
257
- Then generate the application using the @-T -O@ flags.
233
+ Generate an application template using a defaults file:
258
234
 
259
235
  <pre>
260
- $ rails new rails3-mongoid-devise -m ~/Desktop/template.txt -T -O
236
+ $ rails_apps_composer template ~/Desktop/template.rb --defaults=my_defaults.yaml
261
237
  </pre>
262
238
 
263
- h4. Template for Rails 3 + Mongoid + OmniAuth
239
+ Use the @my_defaults.yaml@ file to specify a list of recipes, preferences, and extra gems. You can use any name (and file extension) for the file. See the "Defaults File":http://railsapps.github.com/tutorial-rails-apps-composer.html#Defaults section in the Guide to learn about the format of the defaults file.
264
240
 
265
- To build an application template for the "rails3-mongoid-omniauth":http://github.com/RailsApps/rails3-mongoid-omniauth/ example application, run the command:
241
+ h3. Generate an Application from a Template
266
242
 
267
- <pre>
268
- $ rails_apps_composer template ~/Desktop/template.txt -r haml rspec cucumber guard mongoid seed_database omniauth home_page home_page_users html5 simple_form users_page omniauth_email cleanup extras git
269
- </pre>
270
-
271
- Then generate the application using the @-T -O@ flags.
243
+ After you've created a template file, you can generate an application from a template at any time using the @rails new@ command with the @-m@ option:
272
244
 
273
245
  <pre>
274
- $ rails new rails3-mongoid-omniauth -m ~/Desktop/template.txt -T -O
246
+ $ rails new myapp -m ~/Desktop/template.rb
275
247
  </pre>
276
248
 
277
- h4. Template for Rails 3 + Subdomains
249
+ The application template will prompt you for any configuration preferences requested by the recipes.
278
250
 
279
- To build an application template for the "rails3-subdomains":https://github.com/RailsApps/rails3-subdomains example application, run the command:
251
+ The @rails new@ command allows you to specify the @-T -O@ flags to skip Test::Unit files and Active Record files when you use an application template.
280
252
 
281
253
  <pre>
282
- $ rails_apps_composer template ~/Desktop/template.txt -r haml rspec cucumber guard mongoid action_mailer devise add_user home_page home_page_users seed_database users_page subdomains html5 simple_form cleanup extras git
254
+ $ rails new myapp -m ~/Desktop/template.rb -T -O
283
255
  </pre>
284
256
 
285
- Then generate the application using the @-T -O@ flags.
257
+ The @rails new@ command with the @-m@ option also allows you to specify an application template that can be downloaded via HTTP. This makes it possible to host a template on GitHub (for example) and allow anyone to generate an application from the hosted template. For example:
286
258
 
287
259
  <pre>
288
- $ rails new rails3-subdomains -m ~/Desktop/template.txt -T -O
260
+ $ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
289
261
  </pre>
290
262
 
291
- h2. Changing the Gem
292
-
293
- Your patches and improvements are welcome. Fork the repository and clone the project locally.
263
+ h2. Diagnostics
294
264
 
295
- You'll need to install the gems that are dependencies for development:
265
+ The rails_apps_composer program runs diagnostics to reveal whether you've picked recipes and preferences that are known to work together.
296
266
 
297
- <pre>
298
- $ gem install activesupport i18n thor mg
299
- </pre>
300
-
301
- Add or modify recipes as needed.
267
+ Hundreds of developers are using this gem to build starter apps. As you can see from the commit log, the gem is actively maintained and the collection of recipes is growing. There is a drawback to all this activity, however. No developer who uses the rails_apps_composer gem uses all the recipes. And it would be very difficult to test a recipe in every possible combination. Consequently, combining some recipes or preferences may not work.
302
268
 
303
- To build and install the modified gem locally:
269
+ The rails_apps_composer gem contains an internal database of combinations of recipes and preferences that are known to work together. If you've picked recipes and preferences that are known to work together, you'll get a confirmation:
304
270
 
305
271
  <pre>
306
- $ gem uninstall rails_apps_composer
307
- $ rake gem
308
- $ rake gem:install
272
+ WOOT! The recipes you've selected are known to work together.
273
+ If they don't, open an issue for rails_apps_composer on GitHub.
274
+ WOOT! The preferences you've selected are known to work together.
275
+ If they don't, open an issue for rails_apps_composer on GitHub.
309
276
  </pre>
310
277
 
311
- When you are happy with your changes, "submit a pull request":https://help.github.com/articles/using-pull-requests and I will review your contribution and publish an updated version of the gem for everyone to use.
312
-
313
- h2. Writing New Recipes
314
-
315
- You can find the rails_apps_composer recipe collection in the GitHub repository's "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes. If you find errors or improve a recipe you can contribute to the project by submitting a pull request or creating a "Github issue":http://github.com/RailsApps/rails_apps_composer/issues.
316
-
317
- h4. Warning: Gnarly Code Ahead!
318
-
319
- The best (and only) way to create a new recipe (or customize an existing one) is to examine several recipes to learn how they work. The "extras":https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb recipe is a good place to start. Some recipes, such as the "add_user":https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/add_user.rb recipe, are very complex with multiple preferences and dependencies on other recipes.
320
-
321
- Frankly, the recipe code (and the resulting application template) can be ugly. The code is not much more than a long procedural script with conditional statements to resolve dependencies or enable preferences, interspersed with snippets of template code that is injected into files. The inline template code (for example, code that sets up a Rails "view" file) is particularly ugly because it has to be indented to conform to its destination file, often making the recipe difficult to read. Nevertheless, the project has value and many developers have contributed recipes and added features.
322
-
323
- h4. Rails Wizard Basics
324
-
325
- For more information on all available options for authoring recipes that can be read by the rails_wizard or rails_apps_composer gems, please see the "wiki for Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard/wiki.
326
-
327
- Recipes are made of up *template code* and *YAML back-matter* stored in a ruby file. The @__END__@ parsing convention is used so that each recipe is actually a valid, parseable Ruby file. The structure of a recipe looks something like this:
278
+ You'll get a warning if you've picked a combination we don't know about:
328
279
 
329
280
  <pre>
330
- gem 'supergem'
331
-
332
- after_bundler do
333
- generate &quot;supergem:install&quot;
334
- end
335
-
336
- __END__
337
-
338
- category: templating
339
- name: SuperGem
340
- description: Installs SuperGem which is useful for things
341
- author: mbleigh
281
+ WARNING! The recipes you've selected might not work together.
282
+ Help us out by reporting whether this combination works or fails.
283
+ WARNING! The preferences you've selected might not work together.
284
+ Help us out by reporting whether this combination works or fails.
342
285
  </pre>
343
286
 
344
- h4. Rails_apps_composer Differences
287
+ Go to the GitHub repository to create an "issue":http://github.com/RailsApps/rails_apps_composer/issues and let us know if you've found a combination of recipes or preferences that work together. If you've found a combination that works together, we'll update the gem's internal database for the next public release.
345
288
 
346
- The rails_apps_composer gem is very similar to the rails_wizard gem, with one significant difference. The rails_wizard gem is supposed to allow specification of execution order for recipes with @run_before@ and @run_after@ configuration flags (though the "rails_wizard implentation has been reported as buggy":https://github.com/intridea/rails_wizard/issues/30). The rails_apps_composer gem supports only the @run_after@ flag; additionally, the order in which you provide the recipes sets the execution order. This makes it easier to chain a series of recipes in the order you prefer. For example,
289
+ When you generate an application, the application's *README.textile* file will contain a diagnostics report. Here's an example of the diagnostics report:
347
290
 
348
291
  <pre>
349
- $ rails_apps_composer new myapp -r git haml
350
- </pre>
351
-
352
- installs git before haml.
292
+ Recipes:
293
+ ["gems", "readme", "setup"]
353
294
 
354
- h4. Rails Wizard RSpec Tests
355
-
356
- The gem has RSpec tests that automatically validate each recipe in the repository, so you should run @rake spec@ as a basic syntax check. Note that these don't verify that your recipe code itself works, just that the gem could properly parse and understand your recipe file.
357
-
358
- h4. How It Works
359
-
360
- Rails generators can use any methods provided by the "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions module. The flexibility of mixing "recipes" for application templates comes from use of the @apply@ method from the Thor::Actions module. Given a web address or a local filepath, the "apply method":http://rdoc.info/github/wycats/thor/master/Thor/Actions#apply-instance_method loads and executes a file within the context of the generator script.
295
+ Preferences:
296
+ {:database=>"sqlite", :templates=>"erb", :email=>"none"}
297
+ </pre>
361
298
 
362
- h2. Documentation and Support
299
+ Please include the diagnostics report when you create an issue on GitHub.
363
300
 
364
- This is the only documentation.
301
+ h2. Hacking the Gem
365
302
 
366
- h4. Writing Recipes
303
+ See the "Guide to the Rails Apps Composer Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html to learn how to customize the gem either for your own use or to share with others.
367
304
 
368
- To understand the code in these templates, take a look at "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions. Your recipes can use any methods provided by "Thor::Actions":http://rdoc.info/github/wycats/thor/master/Thor/Actions or "Rails::Generators::Actions":http://railsapi.com/doc/rails-v3.0.3/classes/Rails/Generators/Actions.html.
305
+ h2. Issues
369
306
 
370
- h4. About Rails Application Templates
307
+ Any issues? Please create an "issue":http://github.com/RailsApps/rails_apps_composer/issues on GitHub. Reporting issues (and patching!) helps everyone.
371
308
 
372
- "Cooking Up A Custom Rails 3 Template (11 Oct 2010) by Andrea Singh":http://blog.madebydna.com/all/code/2010/10/11/cooking-up-a-custom-rails3-template.html
373
- "Rails Application Templates (16 Sept 2010) by Collin Schaafsma":http://quickleft.com/blog/rails-application-templates
374
- "Application templates in Rails 3 (18 Sept 2009) by Ben Scofield":http://benscofield.com/2009/09/application-templates-in-rails-3/
375
- "Railscasts: App Templates in Rails 2.3 (9 Feb 2009) by Ryan Bates":http://railscasts.com/episodes/148-app-templates-in-rails-2-3
376
- "Rails templates (4 Dec 2008) by Pratik Naik":http://m.onkey.org/rails-templates
309
+ When you generate an application, the application's *README.textile* file will contain a diagnostics report. Please include the diagnostics report when you create an issue on GitHub.
377
310
 
378
311
  h2. Credits
379
312
 
380
313
  Daniel Kehoe maintains this gem as part of the "RailsApps Project":http://railsapps.github.com/.
381
314
 
382
- This gem is based on "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard. The original idea for a RailsWizard and the innovative implementation is the work of Michael Bleigh.
315
+ This gem is derived from "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard. The original idea and the innovative implementation is the work of Michael Bleigh.
383
316
 
384
317
  Please see the "CHANGELOG":https://github.com/RailsApps/rails_apps_composer/blob/master/CHANGELOG.textile for a list of contributors.
385
318
 
386
- h2. What You Can Do
319
+ Is the gem useful to you? Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. I'd love to know you were helped out by the gem.
387
320
 
388
- Is the gem useful to you? Follow the project on Twitter:
389
- "@rails_apps":http://twitter.com/rails_apps
390
- and tweet some praise. I'd love to know you were helped out by the gem.
321
+ h2. MIT License (with restriction)
391
322
 
392
- h2. License
323
+ The rails_apps_composer program is licensed under the terms of the "MIT License":http://www.opensource.org/licenses/mit-license, except portions of the program authored by Daniel Kehoe may not be used to build a website that generates an application template that can be downloaded or used to generate a web application online (for such use, ask for permission).
393
324
 
394
- h4. MIT License
325
+ Copyright © 2012 Daniel Kehoe
395
326
 
396
- The rails_apps_composer gem and its recipes are distributed under the MIT License.
327
+ !https://cruel-carlota.pagodabox.com/1f4f51c551cd90489a558e5fe4d91fff(githalytics.com alpha)!