rails_apps_composer 2.2.40 → 2.2.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99542c5fa00fea4f88a2237284128b7796d3e7b9
4
- data.tar.gz: a6d74b1037f8b1fc74c96a28874dab870bc578f6
3
+ metadata.gz: b76a835e1fa4e2e6a3b65e4e8a1bb08f1261c6c5
4
+ data.tar.gz: 1dc030475434423454e0b6d3999832a7bb7bb28f
5
5
  SHA512:
6
- metadata.gz: 40f072a60337619f8c71ed1726bd49f87140ff997dd12bf1b23fc5ee3afc7332d90fcad586189f37c157871409f7ea87c7b11d038fe7ee8851efe7a542dab2e5
7
- data.tar.gz: 607e460b81b10c7b9cbd7bda80b4505576c1e90bdbee294856a14ec60b87f68748ab4deaf9a5dded28674e35d3b5c4bfd1c03d91feafe94590f00ece5424fd41
6
+ metadata.gz: 25cc86e6eccc747d51ff7dc856eb7e5ec841811b92714eaed67a12d51c0581fff6e9599d8031e1217d05953695217c11ea1e6b4464f1be02da7d7d39eaebe189
7
+ data.tar.gz: c707809052738cb68475d14842c99a4082abc47861d15ed17d20b92c047a7af54fddfdbdcaaf2232ecb5e10af231adcfce4b578b083057f9b3e6067d1055d36b
data/README.textile CHANGED
@@ -1,4 +1,4 @@
1
- h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer
1
+ h1. !http://railsapps.github.io/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer
2
2
  !https://badge.fury.io/rb/rails_apps_composer.png!:http://badge.fury.io/rb/rails_apps_composer !https://travis-ci.org/RailsApps/rails_apps_composer.png!:https://travis-ci.org/RailsApps/rails_apps_composer
3
3
 
4
4
  The Rails Apps Composer gem installs a command line tool to assemble a Rails application from a collection of "recipes."
@@ -10,24 +10,24 @@ What you can do with the rails_apps_composer gem:
10
10
 
11
11
  You can use local recipes as well as recipes supplied with the gem.
12
12
 
13
- 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.
13
+ The "Rails Composer":http://railsapps.github.io/rails-composer/ tool is built with the rails_apps_composer gem. The Rails Composer tool creates the "example applications":http://railsapps.github.io/ for the "RailsApps":http://railsapps.github.io/ project.
14
14
 
15
- The "Guide to the Rails Apps Composer Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html provides complete documentation:
15
+ The "Guide to the Rails Apps Composer Gem":http://railsapps.github.io/tutorial-rails-apps-composer.html provides complete documentation:
16
16
 
17
- * "Overview":http://railsapps.github.com/tutorial-rails-apps-composer.html#Overview
18
- * "Recipes":http://railsapps.github.com/tutorial-rails-apps-composer.html#Recipes
19
- * "Usage":http://railsapps.github.com/tutorial-rails-apps-composer.html#Usage
20
- * "Diagnostics":http://railsapps.github.com/tutorial-rails-apps-composer.html#Diagnostics
21
- * "Hacking the Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html#Hacking
22
- * "Anatomy of a Recipe":http://railsapps.github.com/tutorial-rails-apps-composer.html#Anatomy
23
- * "Architecture":http://railsapps.github.com/tutorial-rails-apps-composer.html#Architecture
24
- * "Defaults File":http://railsapps.github.com/tutorial-rails-apps-composer.html#Defaults
17
+ * "Overview":http://railsapps.github.io/tutorial-rails-apps-composer.html#Overview
18
+ * "Recipes":http://railsapps.github.io/tutorial-rails-apps-composer.html#Recipes
19
+ * "Usage":http://railsapps.github.io/tutorial-rails-apps-composer.html#Usage
20
+ * "Diagnostics":http://railsapps.github.io/tutorial-rails-apps-composer.html#Diagnostics
21
+ * "Hacking the Gem":http://railsapps.github.io/tutorial-rails-apps-composer.html#Hacking
22
+ * "Anatomy of a Recipe":http://railsapps.github.io/tutorial-rails-apps-composer.html#Anatomy
23
+ * "Architecture":http://railsapps.github.io/tutorial-rails-apps-composer.html#Architecture
24
+ * "Defaults File":http://railsapps.github.io/tutorial-rails-apps-composer.html#Defaults
25
25
 
26
26
  Any issues? Please create a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues.
27
27
 
28
28
  h3. From the RailsApps Project
29
29
 
30
- The "RailsApps project":http://railsapps.github.com/ provides example applications that developers use as starter apps. Hundreds of developers use the apps, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal "reference implementation" so you can stay up to date. Each is accompanied by a tutorial so there is no mystery code. Maintenance and development of the RailsApps applications is supported by subscriptions to the "RailsApps tutorials":https://tutorials.railsapps.org.
30
+ The "RailsApps project":http://railsapps.github.io/ provides example applications that developers use as starter apps. Hundreds of developers use the apps, report problems as they arise, and propose solutions. Rails changes frequently; each application is known to work and serves as your personal "reference implementation" so you can stay up to date. Each is accompanied by a tutorial so there is no mystery code. Maintenance and development of the RailsApps applications is supported by subscriptions to the "RailsApps tutorials":https://tutorials.railsapps.org.
31
31
 
32
32
  h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter
33
33
 
@@ -43,11 +43,11 @@ h2. Who This Is For
43
43
 
44
44
  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.
45
45
 
46
- 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. The Rails Composer tool is easier to use. Use the rails_apps_composer gem if you want a custom application template, a custom combination of recipes, or the convenience of setting a defaults file.
46
+ If you are new to Rails, try the "Rails Composer":http://railsapps.github.io/rails-composer/ tool instead. It provides an application template that is generated from the rails_apps_composer gem's core recipes. The Rails Composer tool is easier to use. Use the rails_apps_composer gem if you want a custom application template, a custom combination of recipes, or the convenience of setting a defaults file.
47
47
 
48
48
  h2. Alternatives
49
49
 
50
- 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.
50
+ 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.io/rails-application-templates.html, particularly a list of "Application template-generating gems" for similar projects.
51
51
 
52
52
  h2. Dependencies
53
53
 
@@ -58,7 +58,7 @@ Before using the rails_apps_composer gem, you will need:
58
58
 
59
59
  The rails_apps_composer program uses the version of Rails that is currently installed when you launch the program. If you want to use the newest Rails version, upgrade before running rails_apps_composer.
60
60
 
61
- See the article "Installing Rails":http://railsapps.github.com/installing-rails.html for advice about updating Rails and your development environment. You'll avoid many potential headaches if you review the article step by step before beginning development.
61
+ See the article "Installing Rails":http://railsapps.github.io/installing-rails.html for advice about updating Rails and your development environment. You'll avoid many potential headaches if you review the article step by step before beginning development.
62
62
 
63
63
  h4. Database
64
64
 
@@ -87,7 +87,7 @@ You may have trouble if you install the rails_apps_composer gem by including it
87
87
 
88
88
  h2. Usage Options
89
89
 
90
- 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.
90
+ These commands are summarized here for your reference. See the "Guide to the Rails Apps Composer Gem":http://railsapps.github.io/tutorial-rails-apps-composer.html for details.
91
91
 
92
92
  h3. List Recipes
93
93
 
@@ -116,7 +116,7 @@ views # Add views needed for starter apps.
116
116
 
117
117
  The above list is current for rails_apps_composer 2.1; later releases will contain more recipes.
118
118
 
119
- See the Guide for more "detailed descriptions of recipes":http://railsapps.github.com/tutorial-rails-apps-composer.html#Recipes. You can find all available recipes in the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes. Examining the recipe source code is the very best way to learn what a recipe will do.
119
+ See the Guide for more "detailed descriptions of recipes":http://railsapps.github.io/tutorial-rails-apps-composer.html#Recipes. You can find all available recipes in the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes. Examining the recipe source code is the very best way to learn what a recipe will do.
120
120
 
121
121
  h3. Recommended Recipes
122
122
 
@@ -132,7 +132,7 @@ Recipes may also contain a @run_after@ directive. The rails_apps_composer progra
132
132
 
133
133
  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.
134
134
 
135
- 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.
135
+ See the "Anatomy of a Recipe":http://railsapps.github.io/tutorial-rails-apps-composer.html#Anatomy section in the Guide to learn about the format of a recipe.
136
136
 
137
137
  h3. Skipping Test::Unit or Active Record
138
138
 
@@ -222,7 +222,7 @@ Use a defaults file for recipes, preferences, and extra gems so you don't have t
222
222
  $ rails_apps_composer new myapp -d my_defaults.yaml
223
223
  </pre>
224
224
 
225
- 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 concerning the format of the defaults file.
225
+ 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.io/tutorial-rails-apps-composer.html#Defaults section in the Guide concerning the format of the defaults file.
226
226
 
227
227
  Use the "quiet flag" @-q@ if you want to skip all prompts:
228
228
 
@@ -232,7 +232,7 @@ $ rails_apps_composer new myapp -q -d my_defaults.yaml
232
232
 
233
233
  h3. Generate an Application Template Interactively
234
234
 
235
- You may want an application template to share with others. For an example, see the "Rails Composer":http://railsapps.github.com/rails-composer/ project which is an application template generated from the rails_apps_composer core recipes.
235
+ You may want an application template to share with others. For an example, see the "Rails Composer":http://railsapps.github.io/rails-composer/ project which is an application template generated from the rails_apps_composer core recipes.
236
236
 
237
237
  Specify a filename for the template:
238
238
 
@@ -279,7 +279,7 @@ Generate an application template using a defaults file and the @-d@ flag:
279
279
  $ rails_apps_composer template ~/Desktop/template.rb -d my_defaults.yaml
280
280
  </pre>
281
281
 
282
- 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 concerning the format of the defaults file. Use the "quiet flag" @-q@ if you want to skip all prompts.
282
+ 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.io/tutorial-rails-apps-composer.html#Defaults section in the Guide concerning the format of the defaults file. Use the "quiet flag" @-q@ if you want to skip all prompts.
283
283
 
284
284
  h3. Generate an Application Template With Your Own Layout
285
285
 
@@ -351,7 +351,7 @@ Please include the diagnostics report when you create an issue on GitHub.
351
351
 
352
352
  h2. Troubleshooting
353
353
 
354
- Problems? You should review the article "Installing Rails":http://railsapps.github.com/installing-rails.html to make sure you've updated all the components that are required to run Rails successfully.
354
+ Problems? You should review the article "Installing Rails":http://railsapps.github.io/installing-rails.html to make sure you've updated all the components that are required to run Rails successfully.
355
355
 
356
356
  h4. Problems with "Could not be loaded... You have already activated..."
357
357
 
@@ -365,11 +365,11 @@ Error: You have already activated ..., but your Gemfile requires ....
365
365
  Using bundle exec may solve this.
366
366
  </pre>
367
367
 
368
- It's due to conflicting gem versions. See the article "Rails Error: “You have already activated (…)”":http://railsapps.github.com/rails-error-you-have-already-activated.html.
368
+ It's due to conflicting gem versions. See the article "Rails Error: “You have already activated (…)”":http://railsapps.github.io/rails-error-you-have-already-activated.html.
369
369
 
370
370
  h4. Problems with "Certificate Verify Failed"
371
371
 
372
- Are you getting an error "OpenSSL certificate verify failed" when you try to generate a new Rails app from an application template? See suggestions to resolve the error "Certificate Verify Failed":http://railsapps.github.com/openssl-certificate-verify-failed.html.
372
+ Are you getting an error "OpenSSL certificate verify failed" when you try to generate a new Rails app from an application template? See suggestions to resolve the error "Certificate Verify Failed":http://railsapps.github.io/openssl-certificate-verify-failed.html.
373
373
 
374
374
  h4. Problems with "Segmentation Fault"
375
375
 
@@ -386,7 +386,7 @@ The @rails new@ command creates a new Rails application. If you want to use an a
386
386
 
387
387
  h2. Hacking the Gem
388
388
 
389
- 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.
389
+ See the "Guide to the Rails Apps Composer Gem":http://railsapps.github.io/tutorial-rails-apps-composer.html to learn how to customize the gem either for your own use or to share with others.
390
390
 
391
391
  h2. Issues
392
392
 
@@ -396,7 +396,7 @@ If you include the _readme_ recipe when you generate an application, the generat
396
396
 
397
397
  h2. Credits
398
398
 
399
- Daniel Kehoe maintains this gem as part of the "RailsApps project":http://railsapps.github.com/.
399
+ Daniel Kehoe maintains this gem as part of the "RailsApps project":http://railsapps.github.io/.
400
400
 
401
401
  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.
402
402
 
@@ -413,16 +413,16 @@ Copyright © 2012-2013 Daniel Kehoe
413
413
  h2. Useful Links
414
414
 
415
415
  |_. Getting Started |_. Articles |_. Tutorials |
416
- | "Rails Tutorial":https://tutorials.railsapps.org/rails-tutorial | "Heroku and Rails":http://railsapps.github.com/rails-heroku-tutorial.html | "Devise with CanCan and Twitter Bootstrap":https://tutorials.railsapps.org/rails3-bootstrap-devise-cancan |
417
- | "Ruby and Rails":http://railsapps.github.com/ruby-and-rails.html | "Twitter Bootstrap and Rails":http://railsapps.github.com/twitter-bootstrap-rails.html | "Rails Membership Site with Stripe":https://tutorials.railsapps.org/rails-stripe-membership-saas |
418
- | "Installing Rails":http://railsapps.github.com/installing-rails.html | "JavaScript and Rails":http://railsapps.github.com/rails-javascript-include-external.html | "Rails Subscription Site with Recurly":https://tutorials.railsapps.org/rails-recurly-subscription-saas |
419
- | "Updating Rails":http://railsapps.github.com/updating-rails.html | "Rails Environment Variables":http://railsapps.github.com/rails-environment-variables.html | "Startup Prelaunch Signup Application":http://railsapps.github.com/tutorial-rails-prelaunch-signup.html |
420
- | "Rails Composer":http://railsapps.github.com/rails-composer/ | "Git and GitHub with Rails":http://railsapps.github.com/rails-git.html | "Devise with RSpec and Cucumber":http://railsapps.github.com/tutorial-rails-devise-rspec-cucumber.html |
421
- | "Rails Examples":http://railsapps.github.com/ | "Send Email with Rails":http://railsapps.github.com/rails-send-email.html | "Devise with Mongoid":http://railsapps.github.com/tutorial-rails-mongoid-devise.html |
422
- | "Rails Starter Apps":http://railsapps.github.com/rails-examples-tutorials.html | "Haml and Rails":http://railsapps.github.com/rails-haml.html | "OmniAuth with Mongoid":http://railsapps.github.com/tutorial-rails-mongoid-omniauth.html |
423
- | | "Rails Application Layout":http://railsapps.github.com/rails-default-application-layout.html | "Subdomains with Devise":http://railsapps.github.com/tutorial-rails-subdomains.html |
424
- | | "HTML5 Boilerplate for Rails":http://railsapps.github.com/rails-html5-boilerplate.html | |
425
- | | "Example Gemfiles for Rails":http://railsapps.github.com/rails-3-2-example-gemfile.html | |
426
- | | "Rails Application Templates":http://railsapps.github.com/rails-application-templates.html | |
416
+ | "Rails Tutorial":https://tutorials.railsapps.org/rails-tutorial | "Heroku and Rails":http://railsapps.github.io/rails-heroku-tutorial.html | "Devise with CanCan and Twitter Bootstrap":https://tutorials.railsapps.org/rails3-bootstrap-devise-cancan |
417
+ | "Ruby and Rails":http://railsapps.github.io/ruby-and-rails.html | "Twitter Bootstrap and Rails":http://railsapps.github.io/twitter-bootstrap-rails.html | "Rails Membership Site with Stripe":https://tutorials.railsapps.org/rails-stripe-membership-saas |
418
+ | "Installing Rails":http://railsapps.github.io/installing-rails.html | "JavaScript and Rails":http://railsapps.github.io/rails-javascript-include-external.html | "Rails Subscription Site with Recurly":https://tutorials.railsapps.org/rails-recurly-subscription-saas |
419
+ | "Updating Rails":http://railsapps.github.io/updating-rails.html | "Rails Environment Variables":http://railsapps.github.io/rails-environment-variables.html | "Startup Prelaunch Signup Application":http://railsapps.github.io/tutorial-rails-prelaunch-signup.html |
420
+ | "Rails Composer":http://railsapps.github.io/rails-composer/ | "Git and GitHub with Rails":http://railsapps.github.io/rails-git.html | "Devise with RSpec and Cucumber":http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html |
421
+ | "Rails Examples":http://railsapps.github.io/ | "Send Email with Rails":http://railsapps.github.io/rails-send-email.html | "Devise with Mongoid":http://railsapps.github.io/tutorial-rails-mongoid-devise.html |
422
+ | "Rails Starter Apps":http://railsapps.github.io/rails-examples-tutorials.html | "Haml and Rails":http://railsapps.github.io/rails-haml.html | "OmniAuth with Mongoid":http://railsapps.github.io/tutorial-rails-mongoid-omniauth.html |
423
+ | | "Rails Application Layout":http://railsapps.github.io/rails-default-application-layout.html | "Subdomains with Devise":http://railsapps.github.io/tutorial-rails-subdomains.html |
424
+ | | "HTML5 Boilerplate for Rails":http://railsapps.github.io/rails-html5-boilerplate.html | |
425
+ | | "Example Gemfiles for Rails":http://railsapps.github.io/rails-3-2-example-gemfile.html | |
426
+ | | "Rails Application Templates":http://railsapps.github.io/rails-application-templates.html | |
427
427
 
428
428
  !https://cruel-carlota.pagodabox.com/1f4f51c551cd90489a558e5fe4d91fff(githalytics.com alpha)!
@@ -37,134 +37,140 @@ module RailsWizard
37
37
 
38
38
  desc "list [CATEGORY]", "list available recipes (optionally by category)"
39
39
  def list(category = nil)
40
- if category
41
- recipes = RailsWizard::Recipes.for(category).map{|r| RailsWizard::Recipe.from_mongo(r) }
40
+ recipes = if category
41
+ RailsWizard::Recipes.for(category).map{|e| RailsWizard::Recipe.from_mongo e}
42
42
  else
43
- recipes = RailsWizard::Recipes.list_classes
44
- end
45
- puts "#{bold}#{cyan}To learn more about recipes, see#{clear}:"
46
- puts "#{bold}#{cyan}http://railsapps.github.com/tutorial-rails-apps-composer.html#Recipes#{clear}\n"
47
- recipes.each do |recipe|
48
- puts recipe.key.ljust(15) + "# #{recipe.description}"
43
+ RailsWizard::Recipes.list_classes
49
44
  end
45
+ address = 'http://railsapps.github.io/tutorial-rails-apps-composer.html#Recipes'
46
+ say("To learn more about recipes, see:\n#{address}", [:bold, :cyan])
47
+ # https://github.com/wycats/thor/blob/master/lib/thor/shell/basic.rb
48
+ recipes.each{|e| say("#{e.key.ljust 15}# #{e.description}")}
50
49
  end
51
50
 
52
51
  no_tasks do
53
- def cyan; "\033[36m" end
54
- def clear; "\033[0m" end
55
- def bold; "\033[1m" end
56
- def red; "\033[31m" end
57
- def green; "\033[32m" end
58
- def yellow; "\033[33m" end
59
52
 
60
53
  def add_recipes
61
54
  Recipes.clear if options[:no_default_recipes]
62
55
  if dirs = options[:recipe_dirs]
63
- dirs.each { |d| Recipes.add_from_directory(d) }
56
+ dirs.each {|d| Recipes.add_from_directory d}
64
57
  end
65
58
  end
66
59
 
67
60
  def load_defaults
68
61
  # Load defaults from a file; if a file specifies recipes, they'll be run *before*
69
62
  # any on the command line (or prompted for)..
70
- defaults = if options[:defaults]
71
- File.open(options[:defaults]) {|f| YAML.load(f) }
72
- else
73
- {}
74
- end
63
+ return [[], {}] unless options[:defaults]
64
+ defaults = File.open(options[:defaults]) {|f| YAML.load(f) }
75
65
  recipes = defaults.delete('recipes') { [] }
76
66
  [recipes, defaults]
77
67
  end
78
68
 
79
69
  def print_recipes(recipes)
80
- puts
81
- puts "#{bold}#{cyan}Available Recipes#{clear}:"
70
+ say("\nAvailable Recipes:", [:bold, :cyan])
82
71
  RailsWizard::Recipes.categories.each do |category|
83
- puts "#{bold}#{cyan}#{category}#{clear}: " +RailsWizard::Recipes.for(category).collect {|recipe|
84
- recipes.include?(recipe) ? "#{green}#{bold}#{recipe}#{clear}" : recipe
85
- }.join(', ')
72
+ say("#{category} ", [:bold, :cyan])
73
+ a = RailsWizard::Recipes.for(category)
74
+ a.each_with_index do |e,i|
75
+ s = (a.length - 1 == i) ? "#{e}" : "#{e}, "
76
+ if recipes.include?(e)
77
+ say(s, [:bold, :green])
78
+ else
79
+ say(s)
80
+ end
81
+ end
86
82
  end
87
- puts
88
83
  end
89
84
 
90
85
  def ask_for_recipes(recipes)
91
- if options[:recipes]
92
- return recipes + options[:recipes]
93
- elsif options[:quiet]
94
- return recipes
95
- end
96
- while recipe = ask("#{print_recipes(recipes)}#{bold}Which recipe would you like to add? #{clear}#{yellow}(blank to finish)#{clear}")
97
- if recipe == ''
98
- break
99
- elsif recipes.include?(recipe)
86
+ return recipes + options[:recipes] if options[:recipes]
87
+ return recipes if options[:quiet]
88
+ loop do
89
+ recipe = prompt_for_recipes(recipes)
90
+ break if '' == recipe
91
+ case
92
+ when recipes.include?(recipe)
100
93
  recipes -= [recipe]
101
- elsif RailsWizard::Recipes.list.include?(recipe)
94
+ when RailsWizard::Recipes.list.include?(recipe)
102
95
  recipes << recipe
103
96
  else
104
- puts
105
- puts "> #{red}Invalid recipe, please try again.#{clear}"
97
+ say("\n> Invalid recipe, please try again.", :red)
106
98
  end
107
99
  end
108
100
  recipes
109
101
  end
110
102
 
103
+ def prompt_for_recipes(recipes)
104
+ print_recipes(recipes)
105
+ say("\nWhich recipe would you like to add? ", :bold)
106
+ ask('(blank to finish)', :yellow)
107
+ end
108
+
111
109
  def ask_for_gems(defaults)
112
110
  gems = defaults["gems"] || []
113
- unless options[:quiet]
114
- while getgem = ask("#{bold}What gem would you like to add? #{clear}#{yellow}(blank to finish)#{clear}")
115
- if getgem == ''
116
- break
117
- else
118
- gems << getgem.downcase
119
- end
120
- end
111
+ return gems if options[:quiet]
112
+ loop do
113
+ getgem = prompt_for_gems
114
+ break if '' == getgem
115
+ gems << getgem.downcase
121
116
  end
122
117
  gems
123
118
  end
124
119
 
120
+ def prompt_for_gems
121
+ say('What gem would you like to add? ', :bold)
122
+ ask('(blank to finish)', :yellow)
123
+ end
124
+
125
125
  def ask_for_arg(question, default = nil)
126
- if default.nil?
127
- result = nil
128
- while answer = ask(question)
129
- case answer.downcase
130
- when "yes", "y"
131
- result = true
132
- break
133
- when "no", "n"
134
- result = false
135
- break
136
- end
126
+ return default unless default.nil?
127
+ say("#{question} ", :bold)
128
+ result = nil
129
+ loop do
130
+ answer = ask('(y/n)', :yellow)
131
+ case answer.downcase
132
+ when "yes", "y"
133
+ result = true
134
+ break
135
+ when "no", "n"
136
+ result = false
137
+ break
137
138
  end
138
- result
139
- else
140
- default
141
139
  end
140
+ result
142
141
  end
143
142
 
144
143
  def ask_for_args(defaults)
145
144
  args = []
146
145
  default_args = defaults["args"] || {}
146
+ s = 'Would you like to skip'
147
147
 
148
- question = "#{bold}Would you like to skip Test::Unit? (yes for RSpec) \033[33m(y/n)\033[0m#{clear}"
148
+ question = "#{s} Test::Unit? (yes for RSpec)"
149
149
  args << "-T" if ask_for_arg(question, default_args[:skip_test_unit])
150
150
 
151
- question = "#{bold}Would you like to skip Active Record? (yes for MongoDB) \033[33m(y/n)\033[0m#{clear}"
151
+ question = "#{s} Active Record? (yes for MongoDB)"
152
152
  args << "-O" if ask_for_arg(question, default_args[:skip_active_record])
153
153
 
154
154
  args
155
155
  end
156
156
 
157
+ def make_red(s)
158
+ # http://en.wikipedia.org/wiki/ANSI_escape_code
159
+ # http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#Backslash_Notation
160
+ "\e[31m#{s}\e[0m"
161
+ end
162
+
157
163
  #pass in name if you want to create a rails app
158
164
  #pass in file_name if you want to create a template
159
165
  def run_template(name, recipes, gems, args, defaults, file_name=nil)
160
- if options[:template_root]
161
- RailsWizard::Template.template_root = options[:template_root]
166
+ if opt = options[:template_root]
167
+ RailsWizard::Template.template_root = opt
162
168
  end
163
169
 
164
- if file_name
165
- file = File.new(file_name,'w')
170
+ file = if file_name
171
+ File.new(file_name,'w')
166
172
  else
167
- file = Tempfile.new('template')
173
+ Tempfile.new('template')
168
174
  end
169
175
  begin
170
176
  template = RailsWizard::Template.new(recipes, gems, args, defaults)
@@ -172,17 +178,17 @@ module RailsWizard
172
178
  file.close
173
179
  if name
174
180
  args_list = (args | template.args).join(' ')
175
- puts "Generating basic application, using:"
176
- puts "\"rails new #{name} -m <temp_file> #{args_list}\""
181
+ say('Generating basic application, using: ')
182
+ say("\"rails new #{name} -m <temp_file> #{args_list}\"")
177
183
  system "rails new #{name} -m #{file.path} #{args_list}"
178
184
  else
179
- puts "Generating and saving application template..."
180
- puts "Done."
181
- puts "Generate a new application with the command:"
182
- puts "\"rails new <APP_NAME> -m #{file.path} #{template.args.join(' ')}\""
185
+ say('Generating and saving application template... ')
186
+ say('Done. ')
187
+ say('Generate a new application with the command: ')
188
+ say("\"rails new <APP_NAME> -m #{file.path} #{template.args.join ' '}\"")
183
189
  end
184
190
  rescue RailsWizard::UnknownRecipeError
185
- raise Thor::Error.new("> #{red}#{$!.message}.#{clear}")
191
+ raise Thor::Error.new(make_red("> #{$!.message}."))
186
192
  ensure
187
193
  file.unlink unless file_name
188
194
  end
data/recipes/gems.rb CHANGED
@@ -129,6 +129,7 @@ end
129
129
  ## Signup App
130
130
  if prefer :railsapps, 'rails-prelaunch-signup'
131
131
  gem 'gibbon', '>= 0.4.2'
132
+ gem 'selenium-webdriver', '~> 2.32.1'
132
133
  end
133
134
 
134
135
  ## Gems from a defaults file or added interactively
@@ -216,7 +217,7 @@ after_bundler do
216
217
  gsub_file 'config/application.yml', /# STRIPE_.*\n/, ''
217
218
  prepend_to_file 'config/application.yml' do <<-FILE
218
219
  # Add account credentials and API keys here.
219
- # See http://railsapps.github.com/rails-environment-variables.html
220
+ # See http://railsapps.github.io/rails-environment-variables.html
220
221
  # This file should be listed in .gitignore to keep your settings secret!
221
222
  # Each entry sets a local environment variable and overrides ENV variables in the Unix shell.
222
223
  # For example, setting:
data/recipes/init.rb CHANGED
@@ -48,7 +48,7 @@ FILE
48
48
  ### DATABASE SEED ###
49
49
  append_file 'db/seeds.rb' do <<-FILE
50
50
  # Environment variables (ENV['...']) are set in the file config/application.yml.
51
- # See http://railsapps.github.com/rails-environment-variables.html
51
+ # See http://railsapps.github.io/rails-environment-variables.html
52
52
  FILE
53
53
  end
54
54
  if (prefer :authorization, 'cancan')
@@ -77,23 +77,31 @@ RUBY
77
77
 
78
78
  describe ".from_mongo" do
79
79
  context "when asked for a known recipe" do
80
- let(:recipe_key) {'recipe_example'}
81
- let(:recipe) { RailsWizard::Recipe.generate(recipe_key, "# this is a test", :category => 'example', :name => "RailsWizard Example") }
82
- let(:recipe_klass) { Kernel.const_get("RailsWizard").const_get("Recipes").const_get("RecipeExample") }
83
- before :all do
84
- RailsWizard::Recipes.add(recipe)
80
+ before(:all) do
81
+ @recipe_key = 'recipe_example'
82
+ @recipe = RailsWizard::Recipe.generate(@recipe_key, '# this is a test', {
83
+ :category => 'example',
84
+ :name => 'RailsWizard Example',
85
+ } )
86
+ RailsWizard::Recipes.add(@recipe)
87
+ @recipe_klass = Kernel.
88
+ const_get('RailsWizard' ).
89
+ const_get('Recipes' ).
90
+ const_get('RecipeExample')
85
91
  end
92
+
86
93
  context "by key" do
87
94
  it "returns the recipe" do
88
- RailsWizard::Recipe.from_mongo(recipe_key).should == recipe_klass
95
+ RailsWizard::Recipe.from_mongo(@recipe_key).should == @recipe_klass
89
96
  end
90
97
  end
91
98
  context "by class" do
92
99
  it "returns the recipe" do
93
- RailsWizard::Recipe.from_mongo(recipe_klass).should == recipe_klass
100
+ RailsWizard::Recipe.from_mongo(@recipe_klass).should == @recipe_klass
94
101
  end
95
102
  end
96
103
  end
104
+
97
105
  context "when asked for an unknown recipe" do
98
106
  it "raises an UnknownRecipeError" do
99
107
  expect { RailsWizard::Recipe.from_mongo("foo") }.to raise_error RailsWizard::UnknownRecipeError, "No recipe found with name 'foo'"
@@ -2,14 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe RailsWizard::Recipes do
4
4
  subject{ RailsWizard::Recipes }
5
- let(:recipe){ RailsWizard::Recipe.generate("recipe_test", "# Testing", :name => "Test Recipe", :category => "test", :description => "Just a test.")}
6
5
 
7
6
  before(:all) do
8
- RailsWizard::Recipes.add(recipe)
7
+ @recipe = RailsWizard::Recipe.generate( "recipe_test", "# Testing", {
8
+ :category => 'test',
9
+ :description => 'Just a test.',
10
+ :name => 'Test Recipe',
11
+ } )
12
+ RailsWizard::Recipes.add(@recipe)
9
13
  end
10
14
 
11
15
  it '.list_classes should include recipe classes' do
12
- subject.list_classes.should be_include(recipe)
16
+ subject.list_classes.should be_include(@recipe)
13
17
  end
14
18
 
15
19
  it '.list should include recipe keys' do
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RailsWizard
2
- VERSION = "2.2.40"
2
+ VERSION = "2.2.41"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_apps_composer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.40
4
+ version: 2.2.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kehoe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-19 00:00:00.000000000 Z
11
+ date: 2013-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n