[
  {
    "path": ".gitignore",
    "content": ".bundle\ndb/*.sqlite3\nlog/*.log\ntmp/**/*\n.DS_Store"
  },
  {
    "path": "README",
    "content": "Rails3-Application-Templates\n========================\n\nYou can use these templates to generate a Rails web application.\n________________________\n\nSee the README file on GitHub\n\nFor more information, please see the updated README file on GitHub:\n\nhttp://github.com/RailsApps/rails3-application-templates\n\n________________________\n\nMIT License\n\n\n"
  },
  {
    "path": "README.textile",
    "content": "h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails 3.2 Application Templates)! Rails 3.2 Application Templates\n\nh3. These application templates are deprecated (no longer maintained).\n\nh3. Use the \"Rails Composer\":http://railsapps.github.com/rails-composer/ tool instead. The Rails Composer tool creates the example applications for the RailsApps project. The tool gives you a Rails 3.2 starter app you can deploy in minutes.\n\nh2. Dependencies\n\nBefore generating your application, you will need:\n\n* The Ruby language (version 1.9.3)\n* Rails 3.2\n\nSee \"Installing Rails\":http://railsapps.github.com/installing-rails.html for detailed instructions and advice.\n\nh2. Creating a Starter App\n\nTo build a Rails application, run the command (where @myapp@ is the name of your application):\n\n<pre>\n$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb\n</pre>\n\nYou can use the @-T@ flag to skip Test::Unit files or the @-O@ flag to skip Active Record files:\n\n<pre>\n$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb -T -O\n</pre>\n\nh2. Application Template Default\n\nThe @rails new@ command creates a new Rails application. If you want to use a template for every Rails application you build, you can set options for the @rails new@ command in a *.railsrc* file in your home directory. Here's how to set up a *.railsrc* file to use a template when you create a new Rails application:\n\n<pre>\n# ~/.railsrc\n-m https://raw.github.com/RailsApps/rails-composer/master/composer.rb\n</pre>\n\nh2. Troubleshooting\n\nProblems? Check the \"issues for the rails_apps_composer gem\":https://github.com/RailsApps/rails_apps_composer/issues.\n\nYou 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.\n\nh4. Problems with  \"Certificate Verify Failed\"\n\nAre 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.\n\nh4. Problems with \"Segmentation Fault\"\n\nIf you get a \"segfault\" when you try @rails new@, try removing and reinstalling rvm.\n\nh2. Documentation and Support\n\nThe application templates are assembled from recipes supplied by the \"rails_apps_composer\":https://github.com/RailsApps/rails_apps_composer gem. See the rails_apps_composer project to understand how the application templates work.\n\nh4. Customizing the Template\n\nIf you wish to change a template to generate an app with your own customized options, you can copy and edit the template file. However, it is better to use the \"rails_apps_composer\":https://github.com/RailsApps/rails_apps_composer gem to create a new application template. You'll find newer versions of the recipes that make up the application template. You may find issues have been identified and (perhaps) fixed. And it will be easier to maintain your application template if you work from the \"rails_apps_composer\":https://github.com/RailsApps/rails_apps_composer gem.\n\nh4. Writing Recipes\n\nTo 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.\n\nh4. About Rails Application Templates\n\n\"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\n\"Rails Application Templates (16 Sept 2010) by Collin Schaafsma\":http://quickleft.com/blog/rails-application-templates\n\"Application templates in Rails 3 (18 Sept 2009) by Ben Scofield\":http://benscofield.com/2009/09/application-templates-in-rails-3/\n\"Railscasts: App Templates in Rails 2.3 (9 Feb 2009) by Ryan Bates\":http://railscasts.com/episodes/148-app-templates-in-rails-2-3\n\"Rails templates (4 Dec 2008) by Pratik Naik\":http://m.onkey.org/rails-templates\n\nh4. Similar Projects\n\nThere are many similar projects:\n\n* \"Rails application template projects\":http://railsapps.github.com/rails-application-templates.html\n* \"Rails examples, tutorials, and starter apps\":http://railsapps.github.com/rails-examples-tutorials.html.\n\nh4. Issues\n\nPlease review \"issues for the rails_apps_composer gem\":https://github.com/RailsApps/rails_apps_composer/issues and submit any issues there.\n\nh4. Where to Get Help\n\nYour best source for help with problems is \"Stack Overflow\":http://stackoverflow.com/questions/tagged/ruby-on-rails-3. Your issue may have been encountered and addressed by others.\n\nYou can also try \"Rails Hotline\":http://www.railshotline.com/, a free telephone hotline for Rails help staffed by volunteers.\n\nh2. Contributing\n\nPlease make changes to the \"rails_apps_composer\":https://github.com/RailsApps/rails_apps_composer gem rather than changing the application templates.\n\nh2. Credits\n\nDaniel Kehoe initiated the \"RailsApps project\":https://github.com/RailsApps and created the Rails Composer application template.\n\nIs it useful to you? Follow the project on Twitter:\n\"@rails_apps\":http://twitter.com/rails_apps\nand tweet some praise. I'd love to know you were helped out by what I've put together.\n\nh2. License\n\n\"MIT License\":http://www.opensource.org/licenses/mit-license\n\nCopyright 2012 Daniel Kehoe\n\nh2. Useful Links\n\n|_. Getting Started |_. Articles |_. Tutorials |\n| \"Rails Tutorial\":https://tutorials.railsapps.org/rails-tutorial (recommendations) | \"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 |\n| \"Rails\":http://railsapps.github.com/rails.html (resources)| \"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 |\n| \"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 |\n| \"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 |\n| \"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 |\n| \"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 |\n| \"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 |\n| | \"Rails Application Layout\":http://railsapps.github.com/rails-default-application-layout.html | \"Subdomains with Devise\":http://railsapps.github.com/tutorial-rails-subdomains.html |\n| | \"HTML5 Boilerplate for Rails\":http://railsapps.github.com/rails-html5-boilerplate.html | |\n| | \"Example Gemfiles for Rails\":http://railsapps.github.com/rails-3-2-example-gemfile.html | |\n| | \"Rails Application Templates\":http://railsapps.github.com/rails-application-templates.html | |\n\n!https://cruel-carlota.pagodabox.com/face2018e437828af58da43b847d6178(githalytics.com alpha)!\n"
  },
  {
    "path": "files/devise-views-haml/app/views/devise/_links.erb",
    "content": "<%- if controller_name != 'sessions' %>\n  <%= link_to \"Sign in\", new_session_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.registerable? && controller_name != 'registrations' %>\n  <%= link_to \"Sign up\", new_registration_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>\n  <%= link_to \"Forgot your password?\", new_password_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>\n  <%= link_to \"Didn't receive confirmation instructions?\", new_confirmation_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>\n  <%= link_to \"Didn't receive unlock instructions?\", new_unlock_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.omniauthable? %>\n  <%- resource_class.omniauth_providers.each do |provider| %>\n    <%= link_to \"Sign in with #{provider.to_s.titleize}\", omniauth_authorize_path(resource_name, provider) %><br />\n  <% end -%>\n<% end -%>\n"
  },
  {
    "path": "files/devise-views-haml/app/views/devise/registrations/edit.html.haml",
    "content": "%h2\n  Edit #{resource_name.to_s.humanize}\n= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|\n  = devise_error_messages!\n  %p\n    = f.label :name\n    %br/\n    = f.text_field :name\n  %div\n    = f.label :email\n    %br/\n    = f.email_field :email\n  %div\n    = f.label :password\n    %i (leave blank if you don't want to change it)\n    %br/\n    = f.password_field :password, :autocomplete => \"off\"\n  %div\n    = f.label :password_confirmation\n    %br/\n    = f.password_field :password_confirmation\n  %div\n    = f.label :current_password\n    %i (we need your current password to confirm your changes)\n    %br/\n    = f.password_field :current_password\n  %div= f.submit \"Update\"\n%h3 Cancel my account\n%p\n  Unhappy? #{link_to \"Cancel my account\", registration_path(resource_name), :confirm => \"Are you sure?\", :method => :delete}.\n= link_to \"Back\", :back"
  },
  {
    "path": "files/devise-views-haml/app/views/devise/registrations/new.html.haml",
    "content": "%h2 Sign up\n= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|\n  = devise_error_messages!\n  %p\n    = f.label :name\n    %br/\n    = f.text_field :name\n  %div\n    = f.label :email\n    %br/\n    = f.email_field :email\n  %div\n    = f.label :password\n    %br/\n    = f.password_field :password\n  %div\n    = f.label :password_confirmation\n    %br/\n    = f.password_field :password_confirmation\n  %div= f.submit \"Sign up\"\n= render :partial => \"devise/shared/links\""
  },
  {
    "path": "files/devise-views-haml/app/views/devise/shared/_links.html.haml",
    "content": "- if controller_name != 'sessions'\n  = link_to \"Sign in\", new_session_path(resource_name)\n  %br/\n- if devise_mapping.registerable? && controller_name != 'registrations'\n  = link_to \"Sign up\", new_registration_path(resource_name)\n  %br/\n- if devise_mapping.recoverable? && controller_name != 'passwords'\n  = link_to \"Forgot your password?\", new_password_path(resource_name)\n  %br/\n- if devise_mapping.confirmable? && controller_name != 'confirmations'\n  = link_to \"Didn't receive confirmation instructions?\", new_confirmation_path(resource_name)\n  %br/\n- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'\n  = link_to \"Didn't receive unlock instructions?\", new_unlock_path(resource_name)\n  %br/\n- if devise_mapping.omniauthable?\n  - resource_class.omniauth_providers.each do |provider|\n    = link_to \"Sign in with #{provider.to_s.titleize}\", omniauth_authorize_path(resource_name, provider)\n    %br/"
  },
  {
    "path": "files/gitignore.txt",
    "content": "#----------------------------------------------------------------------------\n# Ignore these files when commiting to a git repository.\n#\n# See http://help.github.com/ignore-files/ for more about ignoring files.\n#\n# The original version of this file is found here:\n# https://github.com/RailsApps/rails3-application-templates/raw/master/files/gitignore.txt\n#\n# Corrections? Improvements? Create a GitHub issue: \n# http://github.com/RailsApps/rails3-application-templates/issues\n#----------------------------------------------------------------------------\n\n# bundler state\n/.bundle\n/vendor/bundle/\n\n# minimal Rails specific artifacts\ndb/*.sqlite3\n/log/*\n/tmp/*\n\n# various artifacts\n**.war\n*.rbc\n*.sassc\n.rspec\n.redcar/\n.sass-cache\n/config/config.yml\n/config/database.yml\n/coverage.data\n/coverage/\n/db/*.javadb/\n/db/*.sqlite3\n/doc/api/\n/doc/app/\n/doc/features.html\n/doc/specs.html\n/public/cache\n/public/stylesheets/compiled\n/public/system/*\n/spec/tmp/*\n/cache\n/capybara*\n/capybara-*.html\n/gems\n/spec/requests\n/spec/routing\n/spec/views\n/specifications\nrerun.txt\npickle-email-*.html\n\n# If you find yourself ignoring temporary files generated by your text editor\n# or operating system, you probably want to add a global ignore instead:\n#   git config --global core.excludesfile ~/.gitignore_global\n#\n# Here are some files you may want to ignore globally:\n\n# scm revert files\n**.orig\n\n# Mac finder artifacts\n.DS_Store\n\n# Netbeans project directory\n/nbproject/\n\n# RubyMine project files\n.idea\n\n# Textmate project files\n/*.tmproj\n\n# vim artifacts\n**.swp\n"
  },
  {
    "path": "files/humans.txt",
    "content": "/* the humans responsible & colophon */\n/* humanstxt.org */\n\n\n/* TEAM */\n  <your title>: <your name>\n  Site:\n  Twitter:\n  Location:\n\n/* THANKS */\n  Daniel Kehoe (@rails_apps) for the RailsApps project\n\n/* SITE */\n  Standards: HTML5, CSS3\n  Components: jQuery\n  Software: Ruby on Rails\n\n/* GENERATED BY */\n\tRailsApps application template: http://railsapps.github.com/"
  },
  {
    "path": "files/navigation/devise/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', new_user_session_path %>  \n    </li>\n  <% end %>\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Edit account', edit_user_registration_path %>\n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Sign up', new_user_registration_path %>\n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files/navigation/devise/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      = link_to('Logout', destroy_user_session_path, :method=>'delete')\n  - else\n    %li\n      = link_to('Login', new_user_session_path)\n  - if user_signed_in?\n    %li\n      = link_to('Edit account', edit_user_registration_path)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_path)"
  },
  {
    "path": "files/navigation/devise/authorization/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', new_user_session_path %>  \n    </li>\n  <% end %>\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Edit account', edit_user_registration_path %>\n    </li>\n    <% if current_user.has_role? :admin %>\n      <li>\n      <%= link_to 'Admin', users_path %>\n      </li>\n    <% end %>\n  <% else %>\n    <li>\n    <%= link_to 'Sign up', new_user_registration_path %>\n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files/navigation/devise/authorization/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      = link_to('Logout', destroy_user_session_path, :method=>'delete')\n  - else\n    %li\n      = link_to('Login', new_user_session_path)\n  - if user_signed_in?\n    %li\n      = link_to('Edit account', edit_user_registration_path)\n    - if current_user.has_role? :admin\n      %li\n        = link_to('Admin', users_path)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_path)"
  },
  {
    "path": "files/navigation/none/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>"
  },
  {
    "path": "files/navigation/none/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'"
  },
  {
    "path": "files/navigation/omniauth/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    Logged in as <%= current_user.name %>\n    </li>\n    <li>\n    <%= link_to 'Logout', signout_path %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', signin_path %>  \n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files/navigation/omniauth/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      Logged in as #{current_user.name}\n    %li\n      = link_to('Logout', signout_path)\n  - else\n    %li\n      = link_to('Login', signin_path)"
  },
  {
    "path": "files/navigation/subdomains/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <li>\n    <%= link_to 'Main', root_url(:host => request.domain) %>\n  </li>\n  <% if request.subdomain.present? && request.subdomain != \"www\" %>\n    <% if user_signed_in? %>\n      <li>\n        <%= link_to 'Edit account', edit_user_registration_url %>\n      </li>\n      <li>\n        <%= link_to 'Logout', destroy_user_session_url, :method=>'delete' %>\n      </li>\n    <% else %>\n      <li>\n        <%= link_to 'Login', new_user_session_url %>\n      </li>\n    <% end %>\n  <% else %>\n    <li>\n      <%= link_to 'Sign up', new_user_registration_url(:host => request.domain) %>\n    </li>\n    <% if user_signed_in? %>\n      <li>\n        <%= link_to 'Logout', destroy_user_session_url, :method=>'delete' %>\n      </li>\n    <% end %>\n  <% end %>\n</ul>"
  },
  {
    "path": "files/navigation/subdomains/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  %li\n    = link_to 'Main', root_url(:host => request.domain)\n  - if request.subdomain.present? && request.subdomain != \"www\"\n    - if user_signed_in?\n      %li\n        = link_to('Edit account', edit_user_registration_url)\n      %li\n        = link_to('Logout', destroy_user_session_url, :method=>'delete')\n    - else\n      %li\n        = link_to('Login', new_user_session_url)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_url(:host => request.domain))\n    - if user_signed_in?\n      %li\n        = link_to('Logout', destroy_user_session_url, :method=>'delete')"
  },
  {
    "path": "files/sample_readme.textile",
    "content": "h1. App_Name\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. More Information\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Required Gems\n\nThis application requires this gem:\n\n* \"rails\":http://rubygems.org/gems/rails\n\nh2. Dependencies\n\nTo use this application, you will need:\n\n* The Ruby language (version 1.8.7 or 1.9.2)\n* Rails (version 3.0.4 or newer)\n\nh2. Installing the Application\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Getting Started\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Documentation and Support\n\nThis is the only documentation.\n\nh4. Issues\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Similar Projects\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Contributing\n\nIf you make improvements to this application, please share with others.\n\n* Fork the project on GitHub.\n* Make your feature addition or bug fix.\n* Commit with Git.\n* Send the author a pull request.\n\nIf you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work.\n\nh2. Credits\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. License\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit."
  },
  {
    "path": "files/sample_readme.txt",
    "content": "App_Name\n========================\n\n\n________________________\n\nLicense\n"
  },
  {
    "path": "files/simple/assets/stylesheets/application.css.scss",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n*/\n.brand {\n  float: left;\n  padding-right: 8px;\n}\nul.nav {\n  list-style: none;\n  margin: 0 0 2em;\n  padding: 0;\n}\nul.nav li {\n  display: inline;\n}\n#flash_notice, #flash_alert {\n  padding: 5px 8px;\n  margin: 10px 0;\n}\n#flash_notice {\n  background-color: #CFC;\n  border: solid 1px #6C6;\n}\n#flash_alert {\n  background-color: #FCC;\n  border: solid 1px #C66;\n}\n"
  },
  {
    "path": "files/simple/views/layouts/_messages.html.erb",
    "content": "<% flash.each do |name, msg| %>\n  <%= content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String) %>\n<% end %>"
  },
  {
    "path": "files/simple/views/layouts/_messages.html.haml",
    "content": "- flash.each do |name, msg|\n  = content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String)"
  },
  {
    "path": "files/simple/views/layouts/application.html.erb",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>App_Name</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n    <%= javascript_include_tag \"application\" %>\n    <%= csrf_meta_tags %>\n  </head>\n  <body>\n    <div id=\"container\" class=\"container\">\n      <header>\n        <%= render 'layouts/navigation' %>\n        <%= render 'layouts/messages' %>\n      </header>\n      <div id=\"main\" role=\"main\">\n        <%= yield %>\n      </div>\n      <footer>\n      </footer>\n    </div> <!--! end of #container -->\n  </body>\n</html>\n"
  },
  {
    "path": "files/simple/views/layouts/application.html.haml",
    "content": "!!!\n%html\n  %head\n    %title App_Name\n    %meta{:charset => \"utf-8\"}\n    %meta{\"http-equiv\" => \"X-UA-Compatible\", :content => \"IE=edge,chrome=1\"}\n    %meta{:name => \"viewport\", :content => \"width=device-width, initial-scale=1, maximum-scale=1\"}\n    = stylesheet_link_tag :application, :media => \"all\"\n    = javascript_include_tag :application\n    = csrf_meta_tags\n  %body\n    #container.container\n      %header\n        = render 'layouts/navigation'\n        = render 'layouts/messages'\n      #main{:role => \"main\"}\n        = yield\n      %footer\n"
  },
  {
    "path": "files/twitter-bootstrap/assets/stylesheets/application.css.scss",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n*/\n\n.content {\n  background-color: #eee;\n  padding: 20px;\n  margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */\n  -webkit-border-radius: 0 0 6px 6px;\n  -moz-border-radius: 0 0 6px 6px;\n  border-radius: 0 0 6px 6px;\n  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);\n  -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);\n  box-shadow: 0 1px 2px rgba(0,0,0,.15);\n}\n"
  },
  {
    "path": "files/twitter-bootstrap/views/layouts/_messages.html.erb",
    "content": "<% flash.each do |name, msg| %>\n  <div class=\"alert alert-<%= name == :notice ? \"success\" : \"error\" %>\">\n    <a class=\"close\" data-dismiss=\"alert\">×</a>\n    <%= content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String) %>\n  </div>\n<% end %>"
  },
  {
    "path": "files/twitter-bootstrap/views/layouts/_messages.html.haml",
    "content": "- flash.each do |name, msg|\n  %div{:class => \"alert alert-#{name == :notice ? \"success\" : \"error\"}\"}\n    %a.close{\"data-dismiss\" => \"alert\"} ×\n    = content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String)"
  },
  {
    "path": "files/twitter-bootstrap/views/layouts/application.html.erb",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title><%= content_for?(:title) ? yield(:title) : \"App_Name\" %></title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n    <%= javascript_include_tag \"application\" %>\n    <%= csrf_meta_tags %>\n    <%= yield(:head) %>\n  </head>\n  <body>\n    <header class=\"navbar navbar-fixed-top\">\n      <nav class=\"navbar-inner\">\n        <div class=\"container\">\n          <%= render 'layouts/navigation' %>\n        </div>\n      </nav>\n    </header>\n    <div id=\"main\" role=\"main\">\n      <div class=\"container\">\n        <div class=\"content\">\n           <div class=\"row\">\n            <div class=\"span12\">\n              <%= render 'layouts/messages' %>\n              <%= yield %>\n            </div>\n          </div>\n          <footer>\n          </footer>\n        </div>\n      </div> <!--! end of .container -->\n    </div> <!--! end of #main -->\n  </body>\n</html>"
  },
  {
    "path": "files/twitter-bootstrap/views/layouts/application.html.haml",
    "content": "!!!\n%html\n  %head\n    %meta{:charset => \"utf-8\"}\n    %meta{\"http-equiv\" => \"X-UA-Compatible\", :content => \"IE=edge,chrome=1\"}\n    %meta{:name => \"viewport\", :content => \"width=device-width, initial-scale=1, maximum-scale=1\"}\n    %title= content_for?(:title) ? yield(:title) : \"App_Name\"\n    %meta{:content => \"\", :name => \"description\"}\n    %meta{:content => \"\", :name => \"author\"}\n    = stylesheet_link_tag    \"application\", :media => \"all\"\n    = javascript_include_tag \"application\"\n    = csrf_meta_tags\n    = yield(:head)\n  %body\n    %header.navbar.navbar-fixed-top\n      %nav.navbar-inner\n        .container\n          = render 'layouts/navigation'\n    #main{:role => \"main\"}\n      .container\n        .content\n          .row\n            .span12\n              = render 'layouts/messages'\n              = yield\n          %footer\n"
  },
  {
    "path": "files/views/layouts/application.html.erb",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>App_Name</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n    <%= javascript_include_tag \"application\" %>\n    <%= csrf_meta_tags %>\n  </head>\n  <body>\n    <div id=\"container\" class=\"container\">\n      <header>\n        <%- flash.each do |name, msg| -%>\n          <%= content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String) %>\n        <%- end -%>\n      </header>\n      <div id=\"main\" role=\"main\">\n        <%= yield %>\n      </div>\n      <footer>\n      </footer>\n    </div> <!--! end of #container -->\n  </body>\n</html>"
  },
  {
    "path": "files/views/layouts/application.html.haml",
    "content": "!!!\n%html\n  %head\n    %title App_Name\n    %meta{:charset => \"utf-8\"}\n    %meta{\"http-equiv\" => \"X-UA-Compatible\", :content => \"IE=edge,chrome=1\"}\n    %meta{:name => \"viewport\", :content => \"width=device-width, initial-scale=1, maximum-scale=1\"}\n    = stylesheet_link_tag :application, :media => \"all\"\n    = javascript_include_tag :application\n    = csrf_meta_tags\n  %body\n    #container.container\n      %header\n        - flash.each do |name, msg|\n          = content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String)\n      #main{:role => \"main\"}\n        = yield\n      %footer"
  },
  {
    "path": "files-v2/.rvmrc",
    "content": "#!/usr/bin/env bash\n\n# This is an RVM Project .rvmrc file, used to automatically load the ruby\n# development environment upon cd'ing into the directory\n\n# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,\n# Only full ruby name is supported here, for short names use:\n#     echo \"rvm use 1.9.3\" > .rvmrc\nenvironment_id=\"ruby-1.9.3@App_Name\"\n\n# Uncomment the following lines if you want to verify rvm version per project\n# rvmrc_rvm_version=\"1.14.2 (latest)\" # 1.10.1 seams as a safe start\n# eval \"$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print \"[[ \"$1*65536+$2*256+$3\" -ge \"$4*65536+$5*256+$6\" ]]\"}' )\" || {\n#   echo \"This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading.\"\n#   return 1\n# }\n\n# First we attempt to load the desired environment directly from the environment\n# file. This is very fast and efficient compared to running through the entire\n# CLI and selector. If you want feedback on which environment was used then\n# insert the word 'use' after --create as this triggers verbose mode.\nif [[ -d \"${rvm_path:-$HOME/.rvm}/environments\"\n  && -s \"${rvm_path:-$HOME/.rvm}/environments/$environment_id\" ]]\nthen\n  \\. \"${rvm_path:-$HOME/.rvm}/environments/$environment_id\"\n  [[ -s \"${rvm_path:-$HOME/.rvm}/hooks/after_use\" ]] &&\n    \\. \"${rvm_path:-$HOME/.rvm}/hooks/after_use\" || true\nelse\n  # If the environment file has not yet been created, use the RVM CLI to select.\n  rvm --create  \"$environment_id\" || {\n    echo \"Failed to create RVM environment '${environment_id}'.\"\n    return 1\n  }\nfi\n\n# If you use bundler, this might be useful to you:\n# if [[ -s Gemfile ]] && {\n#   ! builtin command -v bundle >/dev/null ||\n#   builtin command -v bundle | GREP_OPTIONS= \\grep $rvm_path/bin/bundle >/dev/null\n# }\n# then\n#   printf \"%b\" \"The rubygem 'bundler' is not installed. Installing it now.\\n\"\n#   gem install bundler\n# fi\n# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null\n# then\n#   bundle install | GREP_OPTIONS= \\grep -vE '^Using|Your bundle is complete'\n# fi\n"
  },
  {
    "path": "files-v2/README",
    "content": "App_Name\n========================\n\nThis application was generated with the rails_apps_composer gem:\nhttps://github.com/RailsApps/rails_apps_composer\nprovided by the RailsApps Project:\nhttp://railsapps.github.com/\n\n________________________\n\nRecipes:\nRECIPES\n\nPreferences:\nPREFERENCES\n\n________________________\n\nLicense"
  },
  {
    "path": "files-v2/README.textile",
    "content": "h1. App_Name\n\nThis application was generated with the \"rails_apps_composer\":https://github.com/RailsApps/rails_apps_composer gem provided by the \"RailsApps Project\":http://railsapps.github.com/.\n\nh2. Diagnostics\n\nThis application was built with recipes that are known to work together.\n\nThis application was built with preferences that are known to work together.\n\nIf the application doesn't work as expected, please \"report an issue\":https://github.com/RailsApps/rails_apps_composer/issues and include these diagnostics:\n\nWe'd also like to know if you've found combinations of recipes or preferences that do work together.\n\nRecipes:\nRECIPES\n\nPreferences:\nPREFERENCES\n\nh2. Ruby on Rails\n\nThis application requires:\n\n* Ruby\n* Rails\n\nLearn more about \"Installing Rails\":http://railsapps.github.com/installing-rails.html.\n\nh2. Database\n\nThis application uses SQLite with ActiveRecord.\n\nh2. Development\n\n* Template Engine: ERB\n* Testing Framework: Test::Unit\n* Front-end Framework: None\n* Form Builder: None\n* Authentication: None\n* Authorization: None\n\nh2. Email\n\nThe application is configured to send email using a Gmail account.\n\nh2. Getting Started\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Documentation and Support\n\nThis is the only documentation.\n\nh4. Issues\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Similar Projects\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. Contributing\n\nIf you make improvements to this application, please share with others.\n\n* Fork the project on GitHub.\n* Make your feature addition or bug fix.\n* Commit with Git.\n* Send the author a pull request.\n\nIf you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work.\n\nh2. Credits\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\nh2. License\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit."
  },
  {
    "path": "files-v2/app/assets/stylesheets/application-bootstrap.css.scss",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n*/\n\n.content {\n  background-color: #eee;\n  padding: 20px;\n  margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */\n  -webkit-border-radius: 0 0 6px 6px;\n  -moz-border-radius: 0 0 6px 6px;\n  border-radius: 0 0 6px 6px;\n  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);\n  -moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);\n  box-shadow: 0 1px 2px rgba(0,0,0,.15);\n}\n"
  },
  {
    "path": "files-v2/app/assets/stylesheets/application.css.scss",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n*/\n.brand {\n  float: left;\n  padding-right: 8px;\n}\nul.nav {\n  list-style: none;\n  margin: 0 0 2em;\n  padding: 0;\n}\nul.nav li {\n  display: inline;\n}\n#flash_notice, #flash_alert {\n  padding: 5px 8px;\n  margin: 10px 0;\n}\n#flash_notice {\n  background-color: #CFC;\n  border: solid 1px #6C6;\n}\n#flash_alert {\n  background-color: #FCC;\n  border: solid 1px #C66;\n}\n"
  },
  {
    "path": "files-v2/app/views/devise/registrations/edit.html.erb",
    "content": "<h2>Edit <%= resource_name.to_s.humanize %></h2>\n\n<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>\n  <%= devise_error_messages! %>\n<p><%= f.label :name %><br />\n<%= f.text_field :name %></p>\n\n  <div><%= f.label :email %><br />\n  <%= f.email_field :email %></div>\n\n  <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />\n  <%= f.password_field :password, :autocomplete => \"off\" %></div>\n\n  <div><%= f.label :password_confirmation %><br />\n  <%= f.password_field :password_confirmation %></div>\n\n  <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />\n  <%= f.password_field :current_password %></div>\n\n  <div><%= f.submit \"Update\" %></div>\n<% end %>\n\n<h3>Cancel my account</h3>\n\n<p>Unhappy? <%= link_to \"Cancel my account\", registration_path(resource_name), :data => { :confirm => \"Are you sure?\" }, :method => :delete %>.</p>\n\n<%= link_to \"Back\", :back %>\n"
  },
  {
    "path": "files-v2/app/views/devise/registrations/edit.html.haml",
    "content": "%h2\n  Edit #{resource_name.to_s.humanize}\n= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|\n  = devise_error_messages!\n  %p\n    = f.label :name\n    %br/\n    = f.text_field :name\n  %div\n    = f.label :email\n    %br/\n    = f.email_field :email\n  %div\n    = f.label :password\n    %i (leave blank if you don't want to change it)\n    %br/\n    = f.password_field :password, :autocomplete => \"off\"\n  %div\n    = f.label :password_confirmation\n    %br/\n    = f.password_field :password_confirmation\n  %div\n    = f.label :current_password\n    %i (we need your current password to confirm your changes)\n    %br/\n    = f.password_field :current_password\n  %div= f.submit \"Update\"\n%h3 Cancel my account\n%p\n  Unhappy? #{link_to \"Cancel my account\", registration_path(resource_name), :confirm => \"Are you sure?\", :method => :delete}.\n= link_to \"Back\", :back"
  },
  {
    "path": "files-v2/app/views/devise/registrations/new.html.erb",
    "content": "<h2>Sign up</h2>\n\n<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>\n  <%= devise_error_messages! %>\n<p><%= f.label :name %><br />\n<%= f.text_field :name %></p>\n\n  <div><%= f.label :email %><br />\n  <%= f.email_field :email %></div>\n\n  <div><%= f.label :password %><br />\n  <%= f.password_field :password %></div>\n\n  <div><%= f.label :password_confirmation %><br />\n  <%= f.password_field :password_confirmation %></div>\n\n  <div><%= f.submit \"Sign up\" %></div>\n<% end %>\n\n<%= render \"devise/shared/links\" %>\n"
  },
  {
    "path": "files-v2/app/views/devise/registrations/new.html.haml",
    "content": "%h2 Sign up\n= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|\n  = devise_error_messages!\n  %p\n    = f.label :name\n    %br/\n    = f.text_field :name\n  %div\n    = f.label :email\n    %br/\n    = f.email_field :email\n  %div\n    = f.label :password\n    %br/\n    = f.password_field :password\n  %div\n    = f.label :password_confirmation\n    %br/\n    = f.password_field :password_confirmation\n  %div= f.submit \"Sign up\"\n= render :partial => \"devise/shared/links\""
  },
  {
    "path": "files-v2/app/views/devise/shared/_links.html.erb",
    "content": "<%- if controller_name != 'sessions' %>\n  <%= link_to \"Sign in\", new_session_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.registerable? && controller_name != 'registrations' %>\n  <%= link_to \"Sign up\", new_registration_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>\n  <%= link_to \"Forgot your password?\", new_password_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>\n  <%= link_to \"Didn't receive confirmation instructions?\", new_confirmation_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>\n  <%= link_to \"Didn't receive unlock instructions?\", new_unlock_path(resource_name) %><br />\n<% end -%>\n\n<%- if devise_mapping.omniauthable? %>\n  <%- resource_class.omniauth_providers.each do |provider| %>\n    <%= link_to \"Sign in with #{provider.to_s.titleize}\", omniauth_authorize_path(resource_name, provider) %><br />\n  <% end -%>\n<% end -%>"
  },
  {
    "path": "files-v2/app/views/devise/shared/_links.html.haml",
    "content": "- if controller_name != 'sessions'\n  = link_to \"Sign in\", new_session_path(resource_name)\n  %br/\n- if devise_mapping.registerable? && controller_name != 'registrations'\n  = link_to \"Sign up\", new_registration_path(resource_name)\n  %br/\n- if devise_mapping.recoverable? && controller_name != 'passwords'\n  = link_to \"Forgot your password?\", new_password_path(resource_name)\n  %br/\n- if devise_mapping.confirmable? && controller_name != 'confirmations'\n  = link_to \"Didn't receive confirmation instructions?\", new_confirmation_path(resource_name)\n  %br/\n- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'\n  = link_to \"Didn't receive unlock instructions?\", new_unlock_path(resource_name)\n  %br/\n- if devise_mapping.omniauthable?\n  - resource_class.omniauth_providers.each do |provider|\n    = link_to \"Sign in with #{provider.to_s.titleize}\", omniauth_authorize_path(resource_name, provider)\n    %br/"
  },
  {
    "path": "files-v2/app/views/home/index-subdomains_app.html.erb",
    "content": "<h3>Home</h3>\n<% @users.each do |user| %>\n  <p><%= #{user.name} profile: #{link_to root_url(:subdomain => user.name), root_url(:subdomain => user.name)} %></p>\n<% end %>"
  },
  {
    "path": "files-v2/app/views/home/index-subdomains_app.html.haml",
    "content": "%h3 Home\n- @users.each do |user|\n  %br/ \n  #{user.name} profile: #{link_to root_url(:subdomain => user.name), root_url(:subdomain => user.name)}\n"
  },
  {
    "path": "files-v2/app/views/home/index.html.erb",
    "content": "<h3>Home</h3>\n<% @users.each do |user| %>\n  <p>User: <%=link_to user.name, user %></p>\n<% end %>"
  },
  {
    "path": "files-v2/app/views/home/index.html.haml",
    "content": "%h3 Home\n- @users.each do |user|\n  %p\n    User: #{link_to user.name, user}"
  },
  {
    "path": "files-v2/app/views/layouts/_messages-bootstrap.html.erb",
    "content": "<% flash.each do |name, msg| %>\n  <div class=\"alert alert-<%= name == :notice ? \"success\" : \"error\" %>\">\n    <a class=\"close\" data-dismiss=\"alert\">×</a>\n    <%= content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String) %>\n  </div>\n<% end %>"
  },
  {
    "path": "files-v2/app/views/layouts/_messages-bootstrap.html.haml",
    "content": "- flash.each do |name, msg|\n  %div{:class => \"alert alert-#{name == :notice ? \"success\" : \"error\"}\"}\n    %a.close{\"data-dismiss\" => \"alert\"} ×\n    = content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String)"
  },
  {
    "path": "files-v2/app/views/layouts/_messages.html.erb",
    "content": "<% flash.each do |name, msg| %>\n  <%= content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String) %>\n<% end %>"
  },
  {
    "path": "files-v2/app/views/layouts/_messages.html.haml",
    "content": "- flash.each do |name, msg|\n  = content_tag :div, msg, :id => \"flash_#{name}\" if msg.is_a?(String)"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-cancan.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', new_user_session_path %>  \n    </li>\n  <% end %>\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Edit account', edit_user_registration_path %>\n    </li>\n    <% if current_user.has_role? :admin %>\n      <li>\n      <%= link_to 'Admin', users_path %>\n      </li>\n    <% end %>\n  <% else %>\n    <li>\n    <%= link_to 'Sign up', new_user_registration_path %>\n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-cancan.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      = link_to('Logout', destroy_user_session_path, :method=>'delete')\n  - else\n    %li\n      = link_to('Login', new_user_session_path)\n  - if user_signed_in?\n    %li\n      = link_to('Edit account', edit_user_registration_path)\n    - if current_user.has_role? :admin\n      %li\n        = link_to('Admin', users_path)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_path)"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-devise.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Logout', destroy_user_session_path, :method=>'delete' %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', new_user_session_path %>  \n    </li>\n  <% end %>\n  <% if user_signed_in? %>\n    <li>\n    <%= link_to 'Edit account', edit_user_registration_path %>\n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Sign up', new_user_registration_path %>\n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-devise.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      = link_to('Logout', destroy_user_session_path, :method=>'delete')\n  - else\n    %li\n      = link_to('Login', new_user_session_path)\n  - if user_signed_in?\n    %li\n      = link_to('Edit account', edit_user_registration_path)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_path)"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-omniauth.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <% if user_signed_in? %>\n    <li>\n    Logged in as <%= current_user.name %>\n    </li>\n    <li>\n    <%= link_to 'Logout', signout_path %>        \n    </li>\n  <% else %>\n    <li>\n    <%= link_to 'Login', signin_path %>  \n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-omniauth.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  - if user_signed_in?\n    %li\n      Logged in as #{current_user.name}\n    %li\n      = link_to('Logout', signout_path)\n  - else\n    %li\n      = link_to('Login', signin_path)"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-subdomains_app.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>\n<ul class=\"nav\">\n  <li>\n    <%= link_to 'Main', root_url(:host => request.domain) %>\n  </li>\n  <% if request.subdomain.present? && request.subdomain != \"www\" %>\n    <% if user_signed_in? %>\n      <li>\n        <%= link_to 'Edit account', edit_user_registration_url %>\n      </li>\n      <li>\n        <%= link_to 'Logout', destroy_user_session_url, :method=>'delete' %>\n      </li>\n    <% else %>\n      <li>\n        <%= link_to 'Login', new_user_session_url %>\n      </li>\n    <% end %>\n  <% else %>\n    <li>\n      <%= link_to 'Sign up', new_user_registration_url(:host => request.domain) %>\n    </li>\n    <% if user_signed_in? %>\n      <li>\n        <%= link_to 'Logout', destroy_user_session_url, :method=>'delete' %>\n      </li>\n    <% end %>\n  <% end %>\n</ul>"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation-subdomains_app.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'\n%ul.nav\n  %li\n    = link_to 'Main', root_url(:host => request.domain)\n  - if request.subdomain.present? && request.subdomain != \"www\"\n    - if user_signed_in?\n      %li\n        = link_to('Edit account', edit_user_registration_url)\n      %li\n        = link_to('Logout', destroy_user_session_url, :method=>'delete')\n    - else\n      %li\n        = link_to('Login', new_user_session_url)\n  - else\n    %li\n      = link_to('Sign up', new_user_registration_url(:host => request.domain))\n    - if user_signed_in?\n      %li\n        = link_to('Logout', destroy_user_session_url, :method=>'delete')"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation.html.erb",
    "content": "<%= link_to \"App_Name\", root_path, :class => 'brand' %>"
  },
  {
    "path": "files-v2/app/views/layouts/_navigation.html.haml",
    "content": "= link_to \"App_Name\", root_path, :class => 'brand'"
  },
  {
    "path": "files-v2/app/views/layouts/application-bootstrap.html.erb",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title><%= content_for?(:title) ? yield(:title) : \"App_Name\" %></title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n    <%= javascript_include_tag \"application\" %>\n    <%= csrf_meta_tags %>\n    <%= yield(:head) %>\n  </head>\n  <body>\n    <header class=\"navbar navbar-fixed-top\">\n      <nav class=\"navbar-inner\">\n        <div class=\"container\">\n          <%= render 'layouts/navigation' %>\n        </div>\n      </nav>\n    </header>\n    <div id=\"main\" role=\"main\">\n      <div class=\"container\">\n        <div class=\"content\">\n           <div class=\"row\">\n            <div class=\"span12\">\n              <%= render 'layouts/messages' %>\n              <%= yield %>\n            </div>\n          </div>\n          <footer>\n          </footer>\n        </div>\n      </div> <!--! end of .container -->\n    </div> <!--! end of #main -->\n  </body>\n</html>"
  },
  {
    "path": "files-v2/app/views/layouts/application-bootstrap.html.haml",
    "content": "!!!\n%html\n  %head\n    %meta{:charset => \"utf-8\"}\n    %meta{\"http-equiv\" => \"X-UA-Compatible\", :content => \"IE=edge,chrome=1\"}\n    %meta{:name => \"viewport\", :content => \"width=device-width, initial-scale=1, maximum-scale=1\"}\n    %title= content_for?(:title) ? yield(:title) : \"App_Name\"\n    %meta{:content => \"\", :name => \"description\"}\n    %meta{:content => \"\", :name => \"author\"}\n    = stylesheet_link_tag    \"application\", :media => \"all\"\n    = javascript_include_tag \"application\"\n    = csrf_meta_tags\n    = yield(:head)\n  %body\n    %header.navbar.navbar-fixed-top\n      %nav.navbar-inner\n        .container\n          = render 'layouts/navigation'\n    #main{:role => \"main\"}\n      .container\n        .content\n          .row\n            .span12\n              = render 'layouts/messages'\n              = yield\n          %footer\n"
  },
  {
    "path": "files-v2/app/views/layouts/application.html.erb",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>App_Name</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <%= stylesheet_link_tag    \"application\", :media => \"all\" %>\n    <%= javascript_include_tag \"application\" %>\n    <%= csrf_meta_tags %>\n  </head>\n  <body>\n    <div id=\"container\" class=\"container\">\n      <header>\n        <%= render 'layouts/navigation' %>\n        <%= render 'layouts/messages' %>\n      </header>\n      <div id=\"main\" role=\"main\">\n        <%= yield %>\n      </div>\n      <footer>\n      </footer>\n    </div> <!--! end of #container -->\n  </body>\n</html>\n"
  },
  {
    "path": "files-v2/app/views/layouts/application.html.haml",
    "content": "!!!\n%html\n  %head\n    %title App_Name\n    %meta{:charset => \"utf-8\"}\n    %meta{\"http-equiv\" => \"X-UA-Compatible\", :content => \"IE=edge,chrome=1\"}\n    %meta{:name => \"viewport\", :content => \"width=device-width, initial-scale=1, maximum-scale=1\"}\n    = stylesheet_link_tag :application, :media => \"all\"\n    = javascript_include_tag :application\n    = csrf_meta_tags\n  %body\n    #container.container\n      %header\n        = render 'layouts/navigation'\n        = render 'layouts/messages'\n      #main{:role => \"main\"}\n        = yield\n      %footer\n"
  },
  {
    "path": "files-v2/app/views/profiles/show-subdomains_app.html.erb",
    "content": "<h1>Profile</h1>\n<h3><%= @user.name %></h3>\n<h3><%= @user.email %></h3>"
  },
  {
    "path": "files-v2/app/views/profiles/show-subdomains_app.html.haml",
    "content": "%h1 Profile\n%h3= @user.name\n%h3= @user.email\n"
  },
  {
    "path": "files-v2/app/views/users/edit-omniauth.html.erb",
    "content": "<%= form_for(@user) do |f| %>\n  <%= f.label :email %>\n  <%= f.text_field :email %>\n  <br />\n  <%= f.submit \"Sign in\" %>\n<% end %>\n"
  },
  {
    "path": "files-v2/app/views/users/edit-omniauth.html.haml",
    "content": "= form_for(@user) do |f|\n  = f.label :email\n  = f.text_field :email\n  %br/\n  = f.submit \"Sign in\""
  },
  {
    "path": "files-v2/app/views/users/index.html.erb",
    "content": "<h3>Users</h3>\n<ul class=\"users\">\n  <% @users.each do |user| %>\n    <li>\n      <%= link_to user.name, user %> signed up <%= user.created_at.to_date %>\n    </li>\n  <% end %>\n</ul>"
  },
  {
    "path": "files-v2/app/views/users/index.html.haml",
    "content": "%h3 Users\n%ul.users\n  - @users.each do |user|\n    %li\n      = link_to user.name, user\n      signed up #{user.created_at.to_date}"
  },
  {
    "path": "files-v2/app/views/users/show-subdomains_app.html.erb",
    "content": "<p>User: <%= @user.name %></p>\n<p>Email: <%= @user.email if @user.email %></p>\n<p>Profile: <%= #{link_to root_url(:subdomain => @user.name), root_url(:subdomain => @user.name)} %></p>\n"
  },
  {
    "path": "files-v2/app/views/users/show-subdomains_app.html.haml",
    "content": "%p\n  User: #{@user.name}\n%p\n  Email: #{@user.email if @user.email}\n%p\n  Profile: #{link_to root_url(:subdomain => @user.name), root_url(:subdomain => @user.name)}\n"
  },
  {
    "path": "files-v2/app/views/users/show.html.erb",
    "content": "<h3>User</h3>\n<p>User: <%= @user.name %></p>\n<p>Email: <%= @user.email if @user.email %></p>"
  },
  {
    "path": "files-v2/app/views/users/show.html.haml",
    "content": "%h3 User\n%p\n  User: #{@user.name}\n%p\n  Email: #{@user.email if @user.email}"
  },
  {
    "path": "files-v2/config/database-mysql.yml",
    "content": "# MySQL.  Versions 4.1 and 5.0 are recommended.\n# \n# Install the MYSQL driver\n#   gem install mysql2\n#\n# Ensure the MySQL gem is defined in your Gemfile\n#   gem 'mysql2'\n#\n# And be sure to use new-style password hashing:\n#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html\ndevelopment:\n  adapter: mysql2\n  encoding: utf8\n  reconnect: false\n  database: myapp_development\n  pool: 5\n  username: root\n  password:\n  host: localhost\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  adapter: mysql2\n  encoding: utf8\n  reconnect: false\n  database: myapp_test\n  pool: 5\n  username: root\n  password:\n  host: localhost\n\nproduction:\n  adapter: mysql2\n  encoding: utf8\n  reconnect: false\n  database: myapp_production\n  pool: 5\n  username: root\n  password:\n  host: localhost\n"
  },
  {
    "path": "files-v2/config/database-postgresql.yml",
    "content": "# PostgreSQL. Versions 8.2 and up are supported.\n#\n# Install the pg driver:\n#   gem install pg\n# On Mac OS X with macports:\n#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config\n# On Windows:\n#   gem install pg\n#       Choose the win32 build.\n#       Install PostgreSQL and put its /bin directory on your path.\n#\n# Configure Using Gemfile\n# gem 'pg'\n#\ndevelopment:\n  adapter: postgresql\n  encoding: unicode\n  database: myapp_development\n  pool: 5\n  username: myapp\n  password:\n\n  # Connect on a TCP socket. Omitted by default since the client uses a\n  # domain socket that doesn't need configuration. Windows does not have\n  # domain sockets, so uncomment these lines.\n  #host: localhost\n  #port: 5432\n\n  # Schema search path. The server defaults to $user,public\n  #schema_search_path: myapp,sharedapp,public\n\n  # Minimum log levels, in increasing order:\n  #   debug5, debug4, debug3, debug2, debug1,\n  #   log, notice, warning, error, fatal, and panic\n  # The server defaults to notice.\n  #min_messages: warning\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  adapter: postgresql\n  encoding: unicode\n  database: myapp_test\n  pool: 5\n  username: myapp\n  password:\n\nproduction:\n  adapter: postgresql\n  encoding: unicode\n  database: myapp_production\n  pool: 5\n  username: myapp\n  password:\n"
  },
  {
    "path": "files-v2/public/humans.txt",
    "content": "/* the humans responsible & colophon */\n/* humanstxt.org */\n\n\n/* TEAM */\n  <your title>: <your name>\n  Site:\n  Twitter:\n  Location:\n\n/* THANKS */\n  Daniel Kehoe (@rails_apps) for the RailsApps project\n\n/* SITE */\n  Standards: HTML5, CSS3\n  Components: jQuery\n  Software: Ruby on Rails\n\n/* GENERATED BY */\n\tRailsApps application template: http://railsapps.github.com/"
  },
  {
    "path": "rails-prelaunch-signup-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Application template generated by the rails_apps_composer gem.\n#   Restrain your impulse to make changes to this file; instead,\n#   make changes to the recipes in the rails_apps_composer gem.\n#   \n#   For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   \n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"saas\", \"extras\"]\n@prefs = {:railsapps=>\"rails-prelaunch-signup\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :templates=>\"erb\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true, :github=>false, :quiet_assets=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"saas\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"saas\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-stripe-membership-saas\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails-stripe-membership-saas\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"rspec-capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i|\n    values[(i + 1).to_s] = choice[1]\n    say_custom( (i + 1).to_s + ')', choice[0] )\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '-A'\n  git :commit => '-qm \"rails_apps_composer: initial commit\"'\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails-stripe-membership-saas\", \"rails-stripe-membership-saas\"], \n  [\"rails-prelaunch-signup\", \"rails-prelaunch-signup\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-stripe-membership-saas'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    prefs[:quiet_assets] = true\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    prefs[:quiet_assets] = true\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    prefs[:quiet_assets] = true\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n    prefs[:quiet_assets] = true\n  when 'rails3-devise-rspec-cucumber-fabrication'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'fabrication'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n    prefs[:quiet_assets] = true\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n    prefs[:quiet_assets] = true\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n    prefs[:quiet_assets] = true\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\n    prefs[:quiet_assets] = true\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim (experimental)\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"], [\"MiniTest\", \"minitest\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"rspec-capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"], [\"MiniTest with Capybara\", \"minitest-capybara\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"], [\"Fabrication\",\"fabrication\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google_oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: add README files\"' if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.5.0' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.5.0', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.5.0', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.9' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.3'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.4', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test if prefer :integration, 'rspec-capybara'\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.9.1', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test\nend\nif prefer :unit_test, 'minitest'\n  gem 'minitest-spec-rails', '>= 3.0.7', :group => :test\n  gem 'minitest-wscolor', '>= 0.0.3', :group => :test\n  gem 'capybara', '>= 1.1.2', :group => :test if prefer :integration, 'minitest-capybara'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.9.1', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\n  gem 'capybara', '>= 1.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.1.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'fabrication', '>= 2.3.0', :group => [:development, :test] if prefer :fixtures, 'fabrication'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.1' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.2.0', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.4', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.1.1' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google_oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.4' if prefer :form_builder, 'simple_form'\n\n## Membership App \nif prefer :railsapps, 'rails-stripe-membership-saas'\n  gem 'stripe', '>= 1.7.4'\n  gem 'stripe_event', '>= 0.4.0'\nend\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.1'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '-A' if prefer :git, true\ngit :commit => '-qm \"rails_apps_composer: Gemfile\"' if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      pg_username = ask_wizard(\"Username for PostgreSQL? (leave blank to use the app name)\")\n      if pg_username.blank?\n        say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n        run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n        gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      else\n        gsub_file \"config/database.yml\", /username: .*/, \"username: #{pg_username}\"\n        pg_password = ask_wizard(\"Password for PostgreSQL user #{pg_username}?\")\n        gsub_file \"config/database.yml\", /password:/, \"password: #{pg_password}\"\n        say_wizard \"set config/database.yml for username/password #{pg_username}/#{pg_password}\"\n      end\n    rescue StandardError => e\n      raise \"unable to create a user for PostgreSQL, reason: #{e}\"\n    end\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  if prefer :database, 'mysql'\n    mysql_username = ask_wizard(\"Username for MySQL? (leave blank to use the app name)\")\n    if mysql_username.blank?\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n    else\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{mysql_username}\"\n      mysql_password = ask_wizard(\"Password for MySQL user #{mysql_username}?\")\n      gsub_file \"config/database.yml\", /password:/, \"password: #{mysql_password}\"\n      say_wizard \"set config/database.yml for username/password #{mysql_username}/#{mysql_password}\"\n    end\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = yes_wizard? \"Drop any existing databases named #{app_name}?\"\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: create database\"' if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: generators\"' if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### TEST/UNIT ###\n  if prefer :unit_test, 'test_unit'\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    config.generators do |g|\n      #{\"g.test_framework :test_unit, fixture_replacement: :fabrication\" if prefer :fixtures, 'fabrication'}\n      #{\"g.fixture_replacement :fabrication, dir: 'test/fabricators'\" if prefer :fixtures, 'fabrication'}\n    end\n\nRUBY\n    end  \n  end\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    generate 'email_spec:steps'\n    inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n    inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      #{\"g.test_framework :rspec\" if prefer :fixtures, 'none'}\n      #{\"g.test_framework :rspec, fixture: true\" unless prefer :fixtures, 'none'}\n      #{\"g.fixture_replacement :factory_girl\" if prefer :fixtures, 'factory_girl'}\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n      #{\"g.fixture_replacement :fabrication\" if prefer :fixtures, 'fabrication'}\n      g.view_specs false\n      g.helper_specs false\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n    generate 'fabrication:cucumber_steps' if prefer :fixtures, 'fabrication'\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: testing framework\"' if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: rspec files\"' if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: cucumber files\"' if prefer :git, true\n  end\n  ### FABRICATION ###\n  if prefer :fixtures, 'fabrication'\n    say_wizard \"replacing FactoryGirl fixtures with Fabrication\"\n    remove_file 'spec/factories/users.rb'\n    remove_file 'spec/fabricators/user_fabricator.rb'\n    create_file 'spec/fabricators/user_fabricator.rb' do\n      <<-RUBY\nFabricator(:user) do\n  name     'Test User'\n  email    'example@example.com'\n  password 'please'\n  password_confirmation 'please'\n  # required if the Devise Confirmable module is used\n  # confirmed_at Time.now\nend\nRUBY\n    end\n    if prefer :integration, 'cucumber'\n      gsub_file 'features/step_definitions/user_steps.rb', /@user = FactoryGirl.create\\(:user, email: @visitor\\[:email\\]\\)/, '@user = Fabricate(:user, email: @visitor[:email])'\n    end\n    gsub_file 'spec/controllers/users_controller_spec.rb', /@user = FactoryGirl.create\\(:user\\)/, '@user = Fabricate(:user)'\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: set email accounts\"' if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    gsub_file 'config/initializers/omniauth.rb', /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' \n      # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      # allow an admin to update roles\n      insert_into_file 'app/models/user.rb', \"  attr_accessible :role_ids, :as => :admin\\n\", :before => \"  attr_accessible\"\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: models\"' if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  case prefs[:starter_app]\n    when 'users_app'\n      if prefer :authentication, 'devise'\n        copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      elsif prefer :authentication, 'omniauth'\n        copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      end\n    when 'admin_app'\n      if prefer :authentication, 'devise'\n        copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      elsif prefer :authentication, 'omniauth'\n        copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      end\n    when 'subdomains_app'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n  end\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: controllers\"' if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    copy_from_repo 'app/views/devise/shared/_links.html.erb'\n    unless prefer :form_builder, 'simple_form'\n      copy_from_repo 'app/views/devise/registrations/edit.html.erb'\n      copy_from_repo 'app/views/devise/registrations/new.html.erb'\n    else\n      copy_from_repo 'app/views/devise/registrations/edit-simple_form.html.erb', :prefs => 'simple_form'\n      copy_from_repo 'app/views/devise/registrations/new-simple_form.html.erb', :prefs => 'simple_form'\n      copy_from_repo 'app/views/devise/sessions/new-simple_form.html.erb', :prefs => 'simple_form'\n    end\n  end\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    if prefer :starter_app, 'admin_app'\n      copy_from_repo 'app/views/users/index.html.erb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      unless prefer :railsapps, 'rails-prelaunch-signup' \n        copy_from_repo 'app/views/users/_user.html.erb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      end\n    else\n      copy_from_repo 'app/views/users/index.html.erb'\n    end\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: views\"' if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: routes\"' if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: front-end framework\"' if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :authorization, 'cancan') && !(prefer :railsapps, 'rails-prelaunch-signup')\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'CREATING ROLES'\nRole.create([\n  { :name => 'admin' }, \n  { :name => 'user' }, \n  { :name => 'VIP' }\n], :without_protection => true)\nFILE\n      end\n    end    \n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nuser2.add_role :VIP\nFILE\n      end\n    end\n    if prefer :railsapps, 'rails-prelaunch-signup'\n      gsub_file 'db/seeds.rb', /user2.add_role :VIP/, ''\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: set up database\"' if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: clean up starter app\"' if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: prelaunch app\"' if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"saas\"\n@before_configs[\"saas\"].call if @before_configs[\"saas\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/saas.rb\n\nif prefer :railsapps, 'rails-stripe-membership-saas'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-stripe-membership-saas/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: clean up starter app\"' if prefer :git, true\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-stripe-membership-saas examples\"\n    remove_file 'features/users/user_show.feature'\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n    \n    # >-------------------------------[ Models ]--------------------------------<\n    copy_from_repo 'app/models/ability.rb', :repo => repo\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Init ]--------------------------------<\n    copy_from_repo 'db/seeds.rb', :repo => repo\n    copy_from_repo 'config/initializers/stripe.rb', :repo => repo\n    \n    # >-------------------------------[ Migrations ]--------------------------------<\n    generate 'migration AddStripeToUsers customer_id:string last_4_digits:string'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    generate 'controller content silver gold platinum --skip-stylesheets --skip-javascripts'\n    copy_from_repo 'app/controllers/content_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    generate 'mailer UserMailer'\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/layouts/_navigation.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/edit.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/expire_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/expire_email.text.erb', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/jquery.readyselector.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/jquery.externalscript.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/registrations.js.erb', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/pricing.css.scss', :repo => repo\n\n    # >-------------------------------[ RSpec ]--------------------------------<\n    say_wizard \"copying RSpec tests from the rails-stripe-membership-saas examples\"\n    copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    copy_from_repo 'spec/controllers/content_controller_spec.rb', :repo => repo\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n\n    ### GIT ###\n    git :add => '-A' if prefer :git, true\n    git :commit => '-qm \"rails_apps_composer: membership app\"' if prefer :git, true\n  end # after_bundler\nend # rails-stripe-membership-saas\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['quiet_assets'] = yes_wizard?(\"Reduce assets logger noise during development?\") if true && true unless config.key?('quiet_assets') || prefs.has_key?(:quiet_assets)\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## QUIET ASSETS\nif config['quiet_assets']\n  prefs[:quiet_assets] = true\nend\nif prefs[:quiet_assets]\n  say_wizard \"recipe setting quiet_assets for reduced asset pipeline logging\"\n  gem 'quiet_assets', '>= 1.0.1', :group => :development\nend\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  # RVM.gemset_use! requires rvm version 1.11.3.5 or newer\n  rvm_spec =\n    if Gem::Specification.respond_to?(:find_by_name)\n      Gem::Specification.find_by_name(\"rvm\")\n    else\n      Gem.source_index.find_name(\"rvm\").last\n    end\n    unless rvm_spec.version > Gem::Version.create('1.11.3.4')\n      say_wizard \"rvm gem version: #{rvm_spec.version}\"\n      raise \"Please update rvm gem to 1.11.3.5 or newer\"\n    end\n  begin\n    RVM.gemset_use! app_name\n  rescue => e\n    say_wizard \"rvm failure: unable to use gemset #{app_name}, reason: #{e}\"\n    raise\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '-A' if prefer :git, true\n  git :commit => '-qm \"rails_apps_composer: extras\"' if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  prefs[:github] = true\nend\nif prefs[:github]\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:quiet_assets)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:github)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  },
  {
    "path": "rails3-bootstrap-devise-cancan-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Template generated by rails_apps_composer. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"extras\"]\n@prefs = {:railsapps=>\"rails3-bootstrap-devise-cancan\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"haml\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'rails_apps_composer: initial commit'\"\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google-oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: add README files'\" if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.4.1' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.5' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.0'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.8.0', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.0' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.0.9', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.3', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.0'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '.' if prefer :git, true\ngit :commit => \"-aqm 'rails_apps_composer: Gemfile'\" if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n      run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n      gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n      gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n    rescue StandardError\n      raise \"unable to create a user for PostgreSQL\"\n    end\n  end\n  if prefer :database, 'mysql'\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = multiple_choice \"Drop any existing databases named #{app_name}?\", \n      [[\"Yes (continue)\",true], [\"No (abort)\",false]]\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: create database'\" if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: generators'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    unless prefer :email, 'none'\n      generate 'email_spec:steps'\n      inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n      inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n      end\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      g.view_specs false\n      g.helper_specs false\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    unless prefer :email, 'none'\n      create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n      end      \n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: testing framework'\" if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: rspec files'\" if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: cucumber files'\" if prefer :git, true\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: set email accounts'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: models'\" if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    if prefer :authentication, 'devise'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    elsif prefer :authentication, 'omniauth'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    end\n    if prefer :authorization, 'cancan'\n      inject_into_file 'app/controllers/users_controller.rb', \"    authorize! :index, @user, :message => 'Not authorized as an administrator.'\\n\", :after => \"def index\\n\"\n    end\n  end\n  gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: controllers'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  copy_from_repo 'app/views/devise/shared/_links.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/edit.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/new.html.erb' if prefer :authentication, 'devise'\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    copy_from_repo 'app/views/users/index.html.erb'\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: views'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: routes'\" if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: front-end framework'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nFILE\n      end\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: set up database'\" if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: clean up starter app'\" if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: prelaunch app'\" if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  begin\n    RVM.gemset_use! app_name\n  rescue StandardError\n    raise \"rvm failure: unable to use gemset #{app_name}\"\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: extras'\" if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  },
  {
    "path": "rails3-devise-rspec-cucumber-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Template generated by rails_apps_composer. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"extras\"]\n@prefs = {:railsapps=>\"rails3-devise-rspec-cucumber\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"haml\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'rails_apps_composer: initial commit'\"\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google-oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: add README files'\" if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.4.1' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.5' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.0'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.8.0', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.0' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.0.9', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.3', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.0'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '.' if prefer :git, true\ngit :commit => \"-aqm 'rails_apps_composer: Gemfile'\" if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n      run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n      gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n      gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n    rescue StandardError\n      raise \"unable to create a user for PostgreSQL\"\n    end\n  end\n  if prefer :database, 'mysql'\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = multiple_choice \"Drop any existing databases named #{app_name}?\", \n      [[\"Yes (continue)\",true], [\"No (abort)\",false]]\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: create database'\" if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: generators'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    unless prefer :email, 'none'\n      generate 'email_spec:steps'\n      inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n      inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n      end\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      g.view_specs false\n      g.helper_specs false\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    unless prefer :email, 'none'\n      create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n      end      \n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: testing framework'\" if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: rspec files'\" if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: cucumber files'\" if prefer :git, true\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: set email accounts'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: models'\" if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    if prefer :authentication, 'devise'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    elsif prefer :authentication, 'omniauth'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    end\n    if prefer :authorization, 'cancan'\n      inject_into_file 'app/controllers/users_controller.rb', \"    authorize! :index, @user, :message => 'Not authorized as an administrator.'\\n\", :after => \"def index\\n\"\n    end\n  end\n  gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: controllers'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  copy_from_repo 'app/views/devise/shared/_links.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/edit.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/new.html.erb' if prefer :authentication, 'devise'\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    copy_from_repo 'app/views/users/index.html.erb'\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: views'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: routes'\" if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: front-end framework'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nFILE\n      end\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: set up database'\" if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: clean up starter app'\" if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: prelaunch app'\" if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  begin\n    RVM.gemset_use! app_name\n  rescue StandardError\n    raise \"rvm failure: unable to use gemset #{app_name}\"\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: extras'\" if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  },
  {
    "path": "rails3-haml-html5-template.rb",
    "content": "# Application Generator Template\n# Modifies a Rails app to set up Haml with an HTML5 application layout and options for CSS with Twitter Bootstrap\n# Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-haml-html5-template.rb\n\n# Generated using the rails_apps_composer gem:\n# https://github.com/RailsApps/rails_apps_composer/\n\n# Based on application template recipes by:\n# Michael Bleigh https://github.com/mbleigh\n# Daniel Kehoe https://github.com/DanielKehoe\n\n# If you are customizing this template, you can use any methods provided by Thor::Actions\n# http://rdoc.info/rdoc/wycats/thor/blob/f939a3e8a854616784cac1dcff04ef4f3ee5f7ff/Thor/Actions.html\n# and Rails::Generators::Actions\n# http://github.com/rails/rails/blob/master/railties/lib/rails/generators/actions.rb\n\n# >---------------------------------------------------------------------------<\n#\n#            _____       _ _   __          ___                  _ \n#           |  __ \\     (_) |  \\ \\        / (_)                | |\n#           | |__) |__ _ _| |___\\ \\  /\\  / / _ ______ _ _ __ __| |\n#           |  _  // _` | | / __|\\ \\/  \\/ / | |_  / _` | '__/ _` |\n#           | | \\ \\ (_| | | \\__ \\ \\  /\\  /  | |/ / (_| | | | (_| |\n#           |_|  \\_\\__,_|_|_|___/  \\/  \\/   |_/___\\__,_|_|  \\__,_|\n#\n#   This template was generated by rails_apps_composer, a custom version of\n#   RailsWizard, the application template builder. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"haml\", \"home_page\", \"html5\", \"cleanup\", \"extras\", \"git\"]\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'wizard', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[0m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"2\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n  when \"1\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  else\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Checking configuration. Please confirm your preferences.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ HAML ]----------------------------------<\n\n@current_recipe = \"haml\"\n@before_configs[\"haml\"].call if @before_configs[\"haml\"]\nsay_recipe 'HAML'\n\nconfig = {}\nconfig['haml'] = yes_wizard?(\"Would you like to use Haml instead of ERB?\") if true && true unless config.key?('haml')\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/haml.rb\n\nif config['haml']\n  gem 'haml', '>= 3.1.6'\n  gem 'haml-rails', '>= 0.3.4', :group => :development\nelse\n  recipes.delete('haml')\nend\n\n\n# >-------------------------------[ HomePage ]--------------------------------<\n\n@current_recipe = \"home_page\"\n@before_configs[\"home_page\"].call if @before_configs[\"home_page\"]\nsay_recipe 'HomePage'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page.rb\n\nafter_bundler do\n  \n  say_wizard \"HomePage recipe running 'after bundler'\"\n  \n  # remove the default home page\n  remove_file 'public/index.html'\n  \n  # create a home controller and view\n  generate(:controller, \"home index\")\n\n  # set up a simple home page (with placeholder content)\n  if recipes.include? 'haml'\n    remove_file 'app/views/home/index.html.haml'\n    # There is Haml code in this script. Changing the indentation is perilous between HAMLs.\n    # We have to use single-quote-style-heredoc to avoid interpolation.\n    create_file 'app/views/home/index.html.haml' do \n    <<-'HAML'\n%h3 Home\nHAML\n    end\n  elsif recipes.include? 'slim'\n    # skip\n  else\n    remove_file 'app/views/home/index.html.erb'\n    create_file 'app/views/home/index.html.erb' do \n    <<-ERB\n<h3>Home</h3>\nERB\n    end\n  end\n\n  # set routes\n  gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n\n  if recipes.include? 'devise'\n    inject_into_file 'config/routes.rb', :before => \"  root :to\" do \n    <<-RUBY\n  authenticated :user do\n    root :to => 'home#index'\n  end\n\\n  \nRUBY\n    end\n  end\n\nend\n\n\n# >---------------------------------[ html5 ]---------------------------------<\n\n@current_recipe = \"html5\"\n@before_configs[\"html5\"].call if @before_configs[\"html5\"]\nsay_recipe 'html5'\n\nconfig = {}\nconfig['css_option'] = multiple_choice(\"Which front-end framework would you like for HTML5 and CSS?\", [[\"None\", \"nothing\"], [\"Zurb Foundation\", \"foundation\"], [\"Twitter Bootstrap (less)\", \"bootstrap_less\"], [\"Twitter Bootstrap (sass)\", \"bootstrap_sass\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]]) if true && true unless config.key?('css_option')\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/html5.rb\n\ncase config['css_option']\n\n  when 'foundation'\n    # https://github.com/zurb/foundation-rails\n    gem 'zurb-foundation', '>= 3.0.5'\n\n  when 'bootstrap_less'\n    # https://github.com/seyhunak/twitter-bootstrap-rails\n    # http://railscasts.com/episodes/328-twitter-bootstrap-basics\n    gem 'twitter-bootstrap-rails', '>= 2.0.3', :group => :assets\n    # please install gem 'therubyracer' to use Less\n    gem 'therubyracer', :group => :assets, :platform => :ruby\n    recipes << 'bootstrap'\n    recipes << 'jsruntime'\n\n  when 'bootstrap_sass'\n    # https://github.com/thomas-mcdonald/bootstrap-sass\n    # http://rubysource.com/twitter-bootstrap-less-and-sass-understanding-your-options-for-rails-3-1/\n    gem 'bootstrap-sass', '>= 2.0.4.0'\n    recipes << 'bootstrap'\n\nend\nafter_bundler do\n  say_wizard \"HTML5 recipe running 'after bundler'\"\n  # add a humans.txt file\n  get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/humans.txt', 'public/humans.txt'\n  # install a front-end framework for HTML5 and CSS3\n  remove_file 'app/assets/stylesheets/application.css'\n  remove_file 'app/views/layouts/application.html.erb'\n  remove_file 'app/views/layouts/application.html.haml'\n  unless recipes.include? 'bootstrap'\n    if recipes.include? 'haml'\n      # Haml version of a simple application layout\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/application.html.haml', 'app/views/layouts/application.html.haml'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/_messages.html.haml', 'app/views/layouts/_messages.html.haml'\n    else\n      # ERB version of a simple application layout\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/application.html.erb', 'app/views/layouts/application.html.erb'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/_messages.html.erb', 'app/views/layouts/_messages.html.erb'\n    end\n    # simple css styles\n    get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/assets/stylesheets/application.css.scss', 'app/assets/stylesheets/application.css.scss'  \n  else # for Twitter Bootstrap\n    if recipes.include? 'haml'\n      # Haml version of a complex application layout using Twitter Bootstrap\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/application.html.haml', 'app/views/layouts/application.html.haml'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/_messages.html.haml', 'app/views/layouts/_messages.html.haml'\n    else\n      # ERB version of a complex application layout using Twitter Bootstrap\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/application.html.erb', 'app/views/layouts/application.html.erb'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/_messages.html.erb', 'app/views/layouts/_messages.html.erb'\n    end\n    # complex css styles using Twitter Bootstrap\n    get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/assets/stylesheets/application.css.scss', 'app/assets/stylesheets/application.css.scss'\n  end\n  # get an appropriate navigation partial\n  if recipes.include? 'haml'\n    if recipes.include? 'devise'\n      if recipes.include? 'authorization'\n        get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/authorization/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'\n      else\n        get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'        \n      end\n    elsif recipes.include? 'omniauth'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/omniauth/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'\n    elsif recipes.include? 'subdomains'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/subdomains/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'\n    else\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/none/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'\n    end\n  else\n    if recipes.include? 'devise'\n      if recipes.include? 'authorization'\n        get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/authorization/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'\n      else\n        get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'        \n      end\n    elsif recipes.include? 'omniauth'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/omniauth/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'\n    elsif recipes.include? 'subdomains'\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/subdomains/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'\n    else\n      get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/none/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  end\n  if recipes.include? 'haml'\n    gsub_file 'app/views/layouts/application.html.haml', /App_Name/, \"#{app_name.humanize.titleize}\"\n    gsub_file 'app/views/layouts/_navigation.html.haml', /App_Name/, \"#{app_name.humanize.titleize}\"\n  else\n    gsub_file 'app/views/layouts/application.html.erb', /App_Name/, \"#{app_name.humanize.titleize}\"\n    gsub_file 'app/views/layouts/_navigation.html.erb', /App_Name/, \"#{app_name.humanize.titleize}\"\n  end\n  case config['css_option']\n\n    when 'bootstrap_less'\n      say_wizard 'installing Twitter Bootstrap HTML5 framework (less)'\n      generate 'bootstrap:install'\n      remove_file 'app/assets/stylesheets/application.css' # already created application.css.scss above\n      insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n\n    when 'bootstrap_sass'\n      say_wizard 'installing Twitter Bootstrap HTML5 framework (sass)'\n      insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n      create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n// Set the correct sprite paths\n$iconSpritePath: asset-url('glyphicons-halflings.png', image);\n$iconWhiteSpritePath: asset-url('glyphicons-halflings-white.png', image);\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n\n    when 'foundation'\n      say_wizard 'installing Zurb Foundation HTML5 framework'\n      insert_into_file 'app/assets/javascripts/application.js', \"//= require foundation\\n\", :after => \"jquery_ujs\\n\"\n      insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation\\n\", :after => \"require_self\\n\"\n\n    when 'skeleton'\n      say_wizard 'installing Skeleton HTML5 framework'\n      get 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css.scss'\n      get 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css.scss'\n      get 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css.scss'\n      get 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css.scss'\n\n    when 'normalize'\n      say_wizard 'normalizing CSS for consistent styling'\n      get 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css.scss'\n\n    when 'nothing'\n      say_wizard 'no HTML5 front-end framework selected'\n\n  end\n\nend\n\n\n# >--------------------------------[ Cleanup ]--------------------------------<\n\n@current_recipe = \"cleanup\"\n@before_configs[\"cleanup\"].call if @before_configs[\"cleanup\"]\nsay_recipe 'Cleanup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/cleanup.rb\n\nafter_bundler do\n\n  say_wizard \"Cleanup recipe running 'after bundler'\"\n\n  # remove unnecessary files\n  %w{\n    README\n    doc/README_FOR_APP\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs\n  get \"https://raw.github.com/RailsApps/rails3-application-templates/master/files/sample_readme.txt\", \"README\"\n  get \"https://raw.github.com/RailsApps/rails3-application-templates/master/files/sample_readme.textile\", \"README.textile\"\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  \nend\n\n\n# >--------------------------------[ Extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'Extras'\n\nconfig = {}\nconfig['footnotes'] = yes_wizard?(\"Would you like to use 'rails-footnotes' (it's SLOW!)?\") if true && true unless config.key?('footnotes')\nconfig['ban_spiders'] = yes_wizard?(\"Would you like to set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders')\nconfig['paginate'] = yes_wizard?(\"Would you like to add 'will_paginate' for pagination?\") if true && true unless config.key?('paginate')\nconfig['jsruntime'] = yes_wizard?(\"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\") if true && true unless config.key?('jsruntime')\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\nif config['footnotes']\n  say_wizard \"Adding 'rails-footnotes'\"\n  gem 'rails-footnotes', '>= 3.7', :group => :development\n  after_bundler do\n    generate 'rails_footnotes:install'\n  end\nend\n\nif config['ban_spiders']\n  say_wizard \"Banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    # ban spiders from your site by changing robots.txt\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\nif config['paginate']\n  say_wizard \"Adding 'will_paginate'\"\n  if recipes.include? 'mongoid'\n    gem 'will_paginate_mongoid'\n  else\n    gem 'will_paginate', '>= 3.0.3'\n  end\n  recipes << 'paginate'\nend\n\nif config['jsruntime']\n  say_wizard \"Adding 'therubyracer' JavaScript runtime gem\"\n  # maybe it was already added by the html5 recipe for bootstrap_less?\n  unless recipes.include? 'jsruntime'\n    gem 'therubyracer', :group => :assets, :platform => :ruby\n  end\nend\n\n\n# >----------------------------------[ Git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'Git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Check for a newer version here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\nafter_everything do\n  \n  say_wizard \"Git recipe running 'after everything'\"\n  \n  # Git should ignore some files\n  remove_file '.gitignore'\n  get \"https://raw.github.com/RailsApps/rails3-application-templates/master/files/gitignore.txt\", \".gitignore\"\n\n  if recipes.include? 'omniauth'\n    append_file '.gitignore' do <<-TXT\n\n# keep OmniAuth service provider secrets out of the Git repo\nconfig/initializers/omniauth.rb\nTXT\n    end\n  end\n\n  # Initialize new Git repo\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'new Rails app generated by Rails Apps Composer gem'\"\n  # Create a git branch\n  git :checkout => ' -b working_branch'\n  git :add => '.'\n  git :commit => \"-m 'Initial commit of working_branch'\"\n  git :checkout => 'master'\nend\n\n\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run Bundler ]-------------------------------<\n\nsay_wizard \"Running 'bundle install'. This will take a while.\"\nrun 'bundle install'\nrun 'bundle update'\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready.\"\n"
  },
  {
    "path": "rails3-mongoid-devise-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Template generated by rails_apps_composer. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"extras\"]\n@prefs = {:railsapps=>\"rails3-mongoid-devise\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"haml\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'rails_apps_composer: initial commit'\"\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google-oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: add README files'\" if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.4.1' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.5' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.0'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.8.0', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.0' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.0.9', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.3', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.0'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '.' if prefer :git, true\ngit :commit => \"-aqm 'rails_apps_composer: Gemfile'\" if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n      run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n      gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n      gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n    rescue StandardError\n      raise \"unable to create a user for PostgreSQL\"\n    end\n  end\n  if prefer :database, 'mysql'\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = multiple_choice \"Drop any existing databases named #{app_name}?\", \n      [[\"Yes (continue)\",true], [\"No (abort)\",false]]\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: create database'\" if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: generators'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    unless prefer :email, 'none'\n      generate 'email_spec:steps'\n      inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n      inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n      end\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      g.view_specs false\n      g.helper_specs false\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    unless prefer :email, 'none'\n      create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n      end      \n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: testing framework'\" if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: rspec files'\" if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: cucumber files'\" if prefer :git, true\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: set email accounts'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: models'\" if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    if prefer :authentication, 'devise'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    elsif prefer :authentication, 'omniauth'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    end\n    if prefer :authorization, 'cancan'\n      inject_into_file 'app/controllers/users_controller.rb', \"    authorize! :index, @user, :message => 'Not authorized as an administrator.'\\n\", :after => \"def index\\n\"\n    end\n  end\n  gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: controllers'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  copy_from_repo 'app/views/devise/shared/_links.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/edit.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/new.html.erb' if prefer :authentication, 'devise'\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    copy_from_repo 'app/views/users/index.html.erb'\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: views'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: routes'\" if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: front-end framework'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nFILE\n      end\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: set up database'\" if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: clean up starter app'\" if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: prelaunch app'\" if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  begin\n    RVM.gemset_use! app_name\n  rescue StandardError\n    raise \"rvm failure: unable to use gemset #{app_name}\"\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: extras'\" if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  },
  {
    "path": "rails3-mongoid-omniauth-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Template generated by rails_apps_composer. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"extras\"]\n@prefs = {:railsapps=>\"rails3-mongoid-omniauth\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"haml\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'rails_apps_composer: initial commit'\"\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google-oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: add README files'\" if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.4.1' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.5' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.0'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.8.0', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.0' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.0.9', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.3', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.0'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '.' if prefer :git, true\ngit :commit => \"-aqm 'rails_apps_composer: Gemfile'\" if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n      run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n      gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n      gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n    rescue StandardError\n      raise \"unable to create a user for PostgreSQL\"\n    end\n  end\n  if prefer :database, 'mysql'\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = multiple_choice \"Drop any existing databases named #{app_name}?\", \n      [[\"Yes (continue)\",true], [\"No (abort)\",false]]\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: create database'\" if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: generators'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    unless prefer :email, 'none'\n      generate 'email_spec:steps'\n      inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n      inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n      end\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      g.view_specs false\n      g.helper_specs false\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    unless prefer :email, 'none'\n      create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n      end      \n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: testing framework'\" if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: rspec files'\" if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: cucumber files'\" if prefer :git, true\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: set email accounts'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: models'\" if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    if prefer :authentication, 'devise'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    elsif prefer :authentication, 'omniauth'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    end\n    if prefer :authorization, 'cancan'\n      inject_into_file 'app/controllers/users_controller.rb', \"    authorize! :index, @user, :message => 'Not authorized as an administrator.'\\n\", :after => \"def index\\n\"\n    end\n  end\n  gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: controllers'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  copy_from_repo 'app/views/devise/shared/_links.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/edit.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/new.html.erb' if prefer :authentication, 'devise'\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    copy_from_repo 'app/views/users/index.html.erb'\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: views'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: routes'\" if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: front-end framework'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nFILE\n      end\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: set up database'\" if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: clean up starter app'\" if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: prelaunch app'\" if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  begin\n    RVM.gemset_use! app_name\n  rescue StandardError\n    raise \"rvm failure: unable to use gemset #{app_name}\"\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: extras'\" if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  },
  {
    "path": "rails3-subdomains-template.rb",
    "content": "# >---------------------------------------------------------------------------<\n#\n#            _____       _ _                              \n#           |  __ \\     (_) |       /\\                    \n#           | |__) |__ _ _| |___   /  \\   _ __  _ __  ___ \n#           |  _  // _` | | / __| / /\\ \\ | '_ \\| '_ \\/ __|\n#           | | \\ \\ (_| | | \\__ \\/ ____ \\| |_) | |_) \\__ \\\n#           |_|  \\_\\__,_|_|_|___/_/    \\_\\ .__/| .__/|___/\n#                                        | |   | |        \n#                                        |_|   |_|\n#\n#   Template generated by rails_apps_composer. For more information, see:\n#   https://github.com/RailsApps/rails_apps_composer/\n#   Thank you to Michael Bleigh for leading the way with the RailsWizard gem.\n#\n# >---------------------------------------------------------------------------<\n\n# >----------------------------[ Initial Setup ]------------------------------<\n\nrun 'bundle update'\n\ninitializer 'generators.rb', <<-RUBY\nRails.application.config.generators do |g|\nend\nRUBY\n\n@recipes = [\"core\", \"git\", \"railsapps\", \"setup\", \"readme\", \"gems\", \"testing\", \"email\", \"models\", \"controllers\", \"views\", \"routes\", \"frontend\", \"init\", \"prelaunch\", \"extras\"]\n@prefs = {:railsapps=>\"rails3-subdomains\", :dev_webserver=>\"webrick\", :prod_webserver=>\"same\", :ban_spiders=>true, :jsruntime=>false, :rvmrc=>true}\n@gems = []\n@diagnostics_recipes = [[\"example\"], [\"setup\"], [\"railsapps\"], [\"gems\", \"setup\"], [\"gems\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"readme\", \"setup\"], [\"example\", \"git\"], [\"git\", \"setup\"], [\"git\", \"railsapps\"], [\"gems\", \"git\", \"setup\"], [\"gems\", \"git\", \"readme\", \"setup\"], [\"extras\", \"gems\", \"git\", \"readme\", \"setup\"], [\"controllers\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"core\", \"email\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"], [\"controllers\", \"email\", \"example\", \"extras\", \"frontend\", \"gems\", \"git\", \"init\", \"models\", \"prelaunch\", \"railsapps\", \"readme\", \"routes\", \"setup\", \"testing\", \"views\"]]\n@diagnostics_prefs = [{:railsapps=>\"rails-prelaunch-signup\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"mandrill\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"simple_form\"}, {:railsapps=>\"rails3-bootstrap-devise-cancan\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :starter_app=>\"admin_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-devise-rspec-cucumber\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-devise\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-mongoid-omniauth\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"erb\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"none\", :starter_app=>\"users_app\", :form_builder=>\"none\"}, {:railsapps=>\"rails3-subdomains\", :database=>\"mongodb\", :orm=>\"mongoid\", :templates=>\"haml\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"none\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"none\", :starter_app=>\"subdomains_app\", :form_builder=>\"none\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"capybara\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"none\", :authentication=>\"omniauth\", :omniauth_provider=>\"twitter\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"invitable\", :authorization=>\"cancan\", :form_builder=>\"simple_form\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"rspec\", :integration=>\"cucumber\", :fixtures=>\"factory_girl\", :frontend=>\"bootstrap\", :bootstrap=>\"sass\", :email=>\"gmail\", :authentication=>\"devise\", :devise_modules=>\"default\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}, {:railsapps=>\"none\", :database=>\"sqlite\", :unit_test=>\"test_unit\", :integration=>\"none\", :fixtures=>\"none\", :frontend=>\"bootstrap\", :bootstrap=>\"less\", :email=>\"sendgrid\", :authentication=>\"devise\", :devise_modules=>\"confirmable\", :authorization=>\"cancan\", :form_builder=>\"none\", :starter_app=>\"admin_app\"}]\ndiagnostics = {}\n\ndef recipes; @recipes end\ndef recipe?(name); @recipes.include?(name) end\ndef prefs; @prefs end\ndef prefer(key, value); @prefs[key].eql? value end\ndef gems; @gems end\ndef diagnostics_recipes; @diagnostics_recipes end\ndef diagnostics_prefs; @diagnostics_prefs end\n\ndef say_custom(tag, text); say \"\\033[1m\\033[36m\" + tag.to_s.rjust(10) + \"\\033[0m\" + \"  #{text}\" end\ndef say_recipe(name); say \"\\033[1m\\033[36m\" + \"recipe\".rjust(10) + \"\\033[0m\" + \"  Running #{name} recipe...\" end\ndef say_wizard(text); say_custom(@current_recipe || 'composer', text) end\n\ndef ask_wizard(question)\n  ask \"\\033[1m\\033[30m\\033[46m\" + (@current_recipe || \"prompt\").rjust(10) + \"\\033[1m\\033[36m\" + \"  #{question}\\033[0m\"\nend\n\ndef yes_wizard?(question)\n  answer = ask_wizard(question + \" \\033[33m(y/n)\\033[0m\")\n  case answer.downcase\n    when \"yes\", \"y\"\n      true\n    when \"no\", \"n\"\n      false\n    else\n      yes_wizard?(question)\n  end\nend\n\ndef no_wizard?(question); !yes_wizard?(question) end\n\ndef multiple_choice(question, choices)\n  say_custom('question', question)\n  values = {}\n  choices.each_with_index do |choice,i| \n    values[(i + 1).to_s] = choice[1]\n    say_custom (i + 1).to_s + ')', choice[0]\n  end\n  answer = ask_wizard(\"Enter your selection:\") while !values.keys.include?(answer)\n  values[answer]\nend\n\n@current_recipe = nil\n@configs = {}\n\n@after_blocks = []\ndef after_bundler(&block); @after_blocks << [@current_recipe, block]; end\n@after_everything_blocks = []\ndef after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end\n@before_configs = {}\ndef before_config(&block); @before_configs[@current_recipe] = block; end\n\ndef copy_from(source, destination)\n  begin\n    remove_file destination\n    get source, destination\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source}\"\n  end\nend\n\ndef copy_from_repo(filename, opts = {})\n  repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'\n  repo = opts[:repo] unless opts[:repo].nil?\n  if (!opts[:prefs].nil?) && (!prefs.has_value? opts[:prefs])\n    return\n  end\n  source_filename = filename\n  destination_filename = filename\n  unless opts[:prefs].nil?\n    if filename.include? opts[:prefs]\n      destination_filename = filename.gsub(/\\-#{opts[:prefs]}/, '')\n    end\n  end\n  if (prefer :templates, 'haml') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.haml')\n  end\n  if (prefer :templates, 'slim') && (filename.include? 'views')\n    remove_file destination_filename\n    destination_filename = destination_filename.gsub(/.erb/, '.slim')\n  end\n  begin\n    remove_file destination_filename\n    if (prefer :templates, 'haml') && (filename.include? 'views')\n      create_file destination_filename, html_to_haml(repo + source_filename)\n    elsif (prefer :templates, 'slim') && (filename.include? 'views')\n      create_file destination_filename, html_to_slim(repo + source_filename)\n    else\n      get repo + source_filename, destination_filename\n    end\n  rescue OpenURI::HTTPError\n    say_wizard \"Unable to obtain #{source_filename} from the repo #{repo}\"\n  end\nend\n\ndef html_to_haml(source)\n  html = open(source) {|input| input.binmode.read }\n  Haml::HTML.new(html, :erb => true, :xhtml => true).render\nend\n\ndef html_to_slim(source)\n  html = open(source) {|input| input.binmode.read }\n  haml = Haml::HTML.new(html, :erb => true, :xhtml => true).render\n  Haml2Slim.convert!(haml)\nend\n\n\nif diagnostics_recipes.sort.include? recipes.sort\n  diagnostics[:recipes] = 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\nelse\n  diagnostics[:recipes] = 'fail'\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\n  say_wizard(\"Continuing...\")\nend\n\n# this application template only supports Rails version 3.1 and newer\ncase Rails::VERSION::MAJOR.to_s\nwhen \"3\"\n  case Rails::VERSION::MINOR.to_s\n  when \"0\"\n    say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n    raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\n  end\nelse\n  say_wizard \"You are using Rails version #{Rails::VERSION::STRING} which is not supported. Try 3.1 or newer.\"\n  raise StandardError.new \"Rails #{Rails::VERSION::STRING} is not supported. Try 3.1 or newer.\"\nend\n\nsay_wizard \"Using rails_apps_composer recipes to generate an application.\"\n\n# >---------------------------[ Autoload Modules/Classes ]-----------------------------<\n\ninject_into_file 'config/application.rb', :after => 'config.autoload_paths += %W(#{config.root}/extras)' do <<-'RUBY'\n\n    config.autoload_paths += %W(#{config.root}/lib)\nRUBY\nend\n\n# >---------------------------------[ Recipes ]----------------------------------<\n\n\n# >---------------------------------[ core ]----------------------------------<\n\n@current_recipe = \"core\"\n@before_configs[\"core\"].call if @before_configs[\"core\"]\nsay_recipe 'core'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/core.rb\n\n## Git\nsay_wizard \"selected all core recipes\"\n\n\n# >----------------------------------[ git ]----------------------------------<\n\n@current_recipe = \"git\"\n@before_configs[\"git\"].call if @before_configs[\"git\"]\nsay_recipe 'git'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb\n\n## Git\nsay_wizard \"initialize git\"\nprefs[:git] = true unless prefs.has_key? :git\nif prefer :git, true\n  copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'\n  git :init\n  git :add => '.'\n  git :commit => \"-aqm 'rails_apps_composer: initial commit'\"\nend\n\n\n# >-------------------------------[ railsapps ]-------------------------------<\n\n@current_recipe = \"railsapps\"\n@before_configs[\"railsapps\"].call if @before_configs[\"railsapps\"]\nsay_recipe 'railsapps'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/railsapps.rb\n\nprefs[:railsapps] = multiple_choice \"Install an example application?\", \n  [[\"I want to build my own application\", \"none\"], \n  [\"rails3-bootstrap-devise-cancan\", \"rails3-bootstrap-devise-cancan\"], \n  [\"rails3-devise-rspec-cucumber\", \"rails3-devise-rspec-cucumber\"], \n  [\"rails3-mongoid-devise\", \"rails3-mongoid-devise\"],\n  [\"rails3-mongoid-omniauth\", \"rails3-mongoid-omniauth\"],\n  [\"rails3-subdomains\", \"rails3-subdomains\"]] unless prefs.has_key? :railsapps\n\ncase prefs[:railsapps]\n  when 'rails-prelaunch-signup'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'mandrill'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'confirmable'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'simple_form'\n    if prefer :git, true\n      prefs[:prelaunch_branch] = multiple_choice \"Git branch for the prelaunch app?\", [[\"wip (work-in-progress)\", \"wip\"], [\"master\", \"master\"], [\"prelaunch\", \"prelaunch\"], [\"staging\", \"staging\"]]\n      if prefs[:prelaunch_branch] == 'master'\n        prefs[:main_branch] = multiple_choice \"Git branch for the main app?\", [[\"None\", \"none\"], [\"wip (work-in-progress)\", \"wip\"], [\"edge\", \"edge\"]]\n      else\n        prefs[:main_branch] = 'master'\n      end\n    end\n  when 'rails3-bootstrap-devise-cancan'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'bootstrap'\n    prefs[:bootstrap] = 'sass'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'cancan'\n    prefs[:starter_app] = 'admin_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-devise-rspec-cucumber'\n    prefs[:git] = true\n    prefs[:database] = 'sqlite'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-devise'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-mongoid-omniauth'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'none'\n    prefs[:authentication] = 'omniauth'\n    prefs[:omniauth_provider] = 'twitter'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'users_app'\n    prefs[:form_builder] = 'none'\n  when 'rails3-subdomains'\n    prefs[:git] = true\n    prefs[:database] = 'mongodb'\n    prefs[:orm] = 'mongoid'\n    prefs[:unit_test] = 'rspec'\n    prefs[:integration] = 'cucumber'\n    prefs[:fixtures] = 'factory_girl'\n    prefs[:frontend] = 'none'\n    prefs[:email] = 'gmail'\n    prefs[:authentication] = 'devise'\n    prefs[:devise_modules] = 'default'\n    prefs[:authorization] = 'none'\n    prefs[:starter_app] = 'subdomains_app'\n    prefs[:form_builder] = 'none'\nend\n\n\n# >---------------------------------[ setup ]---------------------------------<\n\n@current_recipe = \"setup\"\n@before_configs[\"setup\"].call if @before_configs[\"setup\"]\nsay_recipe 'setup'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/setup.rb\n\n## Ruby on Rails\nHOST_OS = RbConfig::CONFIG['host_os']\nsay_wizard \"Your operating system is #{HOST_OS}.\"\nsay_wizard \"You are using Ruby version #{RUBY_VERSION}.\"\nsay_wizard \"You are using Rails version #{Rails::VERSION::STRING}.\"\n\n## Is sqlite3 in the Gemfile?\ngemfile = File.read(destination_root() + '/Gemfile')\nsqlite_detected = gemfile.include? 'sqlite3'\n\n## Web Server\nprefs[:dev_webserver] = multiple_choice \"Web server for development?\", [[\"WEBrick (default)\", \"webrick\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :dev_webserver\nwebserver = multiple_choice \"Web server for production?\", [[\"Same as development\", \"same\"], \n  [\"Thin\", \"thin\"], [\"Unicorn\", \"unicorn\"], [\"Puma\", \"puma\"]] unless prefs.has_key? :prod_webserver\nif webserver == 'same'\n  case prefs[:dev_webserver]\n    when 'thin'\n      prefs[:prod_webserver] = 'thin'\n    when 'unicorn'\n      prefs[:prod_webserver] = 'unicorn'\n    when 'puma'\n      prefs[:prod_webserver] = 'puma'\n  end\nelse\n  prefs[:prod_webserver] = webserver\nend\n\n## Database Adapter\nprefs[:database] = multiple_choice \"Database used in development?\", [[\"SQLite\", \"sqlite\"], [\"PostgreSQL\", \"postgresql\"], \n  [\"MySQL\", \"mysql\"], [\"MongoDB\", \"mongodb\"]] unless prefs.has_key? :database\ncase prefs[:database]\n  when 'mongodb'\n    unless sqlite_detected\n      prefs[:orm] = multiple_choice \"How will you connect to MongoDB?\", [[\"Mongoid\",\"mongoid\"]] unless prefs.has_key? :orm\n    else\n      say_wizard \"WARNING! SQLite gem detected in the Gemfile\"\n      say_wizard \"If you wish to use MongoDB you must skip Active Record.\"\n      say_wizard \"If using rails_apps_composer, choose 'skip Active Record'.\"\n      say_wizard \"If using Rails Composer or an application template, use the '-O' flag as in 'rails new foo -O'.\"\n      prefs[:fail] = multiple_choice \"Abort or continue?\", [[\"abort\", \"abort\"], [\"continue\", \"continue\"]]\n      if prefer :fail, 'abort'\n        raise StandardError.new \"SQLite detected in the Gemfile. Use '-O' or '--skip-activerecord' as in 'rails new foo -O' if you don't want ActiveRecord and SQLite\"\n      end\n    end\nend\n\n## Template Engine\nprefs[:templates] = multiple_choice \"Template engine?\", [[\"ERB\", \"erb\"], [\"Haml\", \"haml\"], [\"Slim\", \"slim\"]] unless prefs.has_key? :templates\n\n## Testing Framework\nif recipes.include? 'testing'\n  prefs[:unit_test] = multiple_choice \"Unit testing?\", [[\"Test::Unit\", \"test_unit\"], [\"RSpec\", \"rspec\"]] unless prefs.has_key? :unit_test\n  prefs[:integration] = multiple_choice \"Integration testing?\", [[\"None\", \"none\"], [\"RSpec with Capybara\", \"capybara\"], \n    [\"Cucumber with Capybara\", \"cucumber\"], [\"Turnip with Capybara\", \"turnip\"]] unless prefs.has_key? :integration\n  prefs[:fixtures] = multiple_choice \"Fixture replacement?\", [[\"None\",\"none\"], [\"Factory Girl\",\"factory_girl\"], [\"Machinist\",\"machinist\"]] unless prefs.has_key? :fixtures\nend\n\n## Front-end Framework\nif recipes.include? 'frontend'\n  prefs[:frontend] = multiple_choice \"Front-end framework?\", [[\"None\", \"none\"], [\"Twitter Bootstrap\", \"bootstrap\"], \n    [\"Zurb Foundation\", \"foundation\"], [\"Skeleton\", \"skeleton\"], [\"Just normalize CSS for consistent styling\", \"normalize\"]] unless prefs.has_key? :frontend\n  if prefer :frontend, 'bootstrap'\n    case HOST_OS\n      when /mswin|windows/i\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n      else\n        prefs[:bootstrap] = multiple_choice \"Twitter Bootstrap version?\", [[\"Twitter Bootstrap (Less)\", \"less\"],\n          [\"Twitter Bootstrap (Sass)\", \"sass\"]] unless prefs.has_key? :bootstrap\n    end\n  end\nend\n\n## Email\nif recipes.include? 'email'\n  prefs[:email] = multiple_choice \"Add support for sending email?\", [[\"None\", \"none\"], [\"Gmail\",\"gmail\"], [\"SMTP\",\"smtp\"], \n    [\"SendGrid\",\"sendgrid\"], [\"Mandrill\",\"mandrill\"]] unless prefs.has_key? :email\nelse\n  prefs[:email] = 'none'\nend\n\n## Authentication and Authorization\nif recipes.include? 'models'\n  prefs[:authentication] = multiple_choice \"Authentication?\", [[\"None\", \"none\"], [\"Devise\", \"devise\"], [\"OmniAuth\", \"omniauth\"]] unless prefs.has_key? :authentication\n  case prefs[:authentication]\n    when 'devise'\n      if prefer :orm, 'mongoid'\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"]] unless prefs.has_key? :devise_modules\n      else\n        prefs[:devise_modules] = multiple_choice \"Devise modules?\", [[\"Devise with default modules\",\"default\"], [\"Devise with Confirmable module\",\"confirmable\"], \n          [\"Devise with Confirmable and Invitable modules\",\"invitable\"]] unless prefs.has_key? :devise_modules\n      end\n    when 'omniauth'\n      prefs[:omniauth_provider] = multiple_choice \"OmniAuth provider?\", [[\"Facebook\", \"facebook\"], [\"Twitter\", \"twitter\"], [\"GitHub\", \"github\"], \n        [\"LinkedIn\", \"linkedin\"], [\"Google-Oauth-2\", \"google-oauth2\"], [\"Tumblr\", \"tumblr\"]] unless prefs.has_key? :omniauth_provider\n  end\n  prefs[:authorization] = multiple_choice \"Authorization?\", [[\"None\", \"none\"], [\"CanCan with Rolify\", \"cancan\"]] unless prefs.has_key? :authorization\nend\n\n## Form Builder\nprefs[:form_builder] = multiple_choice \"Use a form builder gem?\", [[\"None\", \"none\"], [\"SimpleForm\", \"simple_form\"]] unless prefs.has_key? :form_builder\n\n## MVC\nif (recipes.include? 'models') && (recipes.include? 'controllers') && (recipes.include? 'views') && (recipes.include? 'routes')\n  if prefer :authorization, 'cancan'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Admin Dashboard\", \"admin_app\"]] unless prefs.has_key? :starter_app\n  elsif prefer :authentication, 'devise'\n    if prefer :orm, 'mongoid'\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"], [\"Home Page, User Accounts, Subdomains\", \"subdomains_app\"]] unless prefs.has_key? :starter_app\n    else\n      prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n        [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n    end\n  elsif prefer :authentication, 'omniauth'\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"], \n      [\"Home Page, User Accounts\", \"users_app\"]] unless prefs.has_key? :starter_app\n  else\n    prefs[:starter_app] = multiple_choice \"Install a starter app?\", [[\"None\", \"none\"], [\"Home Page\", \"home_app\"]] unless prefs.has_key? :starter_app\n  end\nend\n\n# save diagnostics before anything can fail\ncreate_file \"README\", \"RECIPES\\n#{recipes.sort.inspect}\\n\"\nappend_file \"README\", \"PREFERENCES\\n#{prefs.inspect}\"\n\n\n# >--------------------------------[ readme ]---------------------------------<\n\n@current_recipe = \"readme\"\n@before_configs[\"readme\"].call if @before_configs[\"readme\"]\nsay_recipe 'readme'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  \n  # remove default READMEs\n  %w{\n    README\n    README.rdoc\n    doc/README_FOR_APP\n  }.each { |file| remove_file file }\n\n  # add placeholder READMEs and humans.txt file\n  copy_from_repo 'public/humans.txt'\n  copy_from_repo 'README'\n  copy_from_repo 'README.textile'\n  gsub_file \"README\", /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file \"README.textile\", /App_Name/, \"#{app_name.humanize.titleize}\"\n\n  # Diagnostics\n  gsub_file \"README.textile\", /recipes that are known/, \"recipes that are NOT known\" if diagnostics[:recipes] == 'fail'\n  gsub_file \"README.textile\", /preferences that are known/, \"preferences that are NOT known\" if diagnostics[:prefs] == 'fail'\n  gsub_file \"README.textile\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README.textile\", /PREFERENCES/, prefs.inspect\n  gsub_file \"README\", /RECIPES/, recipes.sort.inspect\n  gsub_file \"README\", /PREFERENCES/, prefs.inspect\n  \n  # Ruby on Rails\n  gsub_file \"README.textile\", /\\* Ruby/, \"* Ruby version #{RUBY_VERSION}\"\n  gsub_file \"README.textile\", /\\* Rails/, \"* Rails version #{Rails::VERSION::STRING}\"\n    \n  # Database\n  gsub_file \"README.textile\", /SQLite/, \"PostgreSQL\" if prefer :database, 'postgresql'\n  gsub_file \"README.textile\", /SQLite/, \"MySQL\" if prefer :database, 'mysql'\n  gsub_file \"README.textile\", /SQLite/, \"MongoDB\" if prefer :database, 'mongodb'\n  gsub_file \"README.textile\", /ActiveRecord/, \"the Mongoid ORM\" if prefer :orm, 'mongoid'\n\n  # Template Engine\n  gsub_file \"README.textile\", /ERB/, \"Haml\" if prefer :templates, 'haml'\n  gsub_file \"README.textile\", /ERB/, \"Slim\" if prefer :templates, 'slim'\n\n  # Testing Framework\n  gsub_file \"README.textile\", /Test::Unit/, \"RSpec\" if prefer :unit_test, 'rspec'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Cucumber\" if prefer :integration, 'cucumber'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Factory Girl\" if prefer :fixtures, 'factory_girl'\n  gsub_file \"README.textile\", /RSpec/, \"RSpec and Machinist\" if prefer :fixtures, 'machinist'\n\n  # Front-end Framework\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Sass)\" if prefer :bootstrap, 'sass'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Twitter Bootstrap (Less)\" if prefer :bootstrap, 'less'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Zurb Foundation\" if prefer :frontend, 'foundation'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Skeleton\" if prefer :frontend, 'skeleton'\n  gsub_file \"README.textile\", /Front-end Framework: None/, \"Front-end Framework: Normalized CSS\" if prefer :frontend, 'normalize'\n\n  # Form Builder\n  gsub_file \"README.textile\", /Form Builder: None/, \"Form Builder: SimpleForm\" if prefer :form_builder, 'simple_form'\n\n  # Email\n  unless prefer :email, 'none'\n    gsub_file \"README.textile\", /Gmail/, \"SMTP\" if prefer :email, 'smtp'\n    gsub_file \"README.textile\", /Gmail/, \"SendGrid\" if prefer :email, 'sendgrid'\n    gsub_file \"README.textile\", /Gmail/, \"Mandrill\" if prefer :email, 'mandrill'\n  else\n    gsub_file \"README.textile\", /h2. Email/, \"\"\n    gsub_file \"README.textile\", /The application is configured to send email using a Gmail account./, \"\"\n  end\n\n  # Authentication and Authorization\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: Devise\" if prefer :authentication, 'devise'\n  gsub_file \"README.textile\", /Authentication: None/, \"Authentication: OmniAuth\" if prefer :authentication, 'omniauth'\n  gsub_file \"README.textile\", /Authorization: None/, \"Authorization: CanCan\" if prefer :authorization, 'cancan'\n\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: add README files'\" if prefer :git, true\n  \nend # after_everything\n\n\n# >---------------------------------[ gems ]----------------------------------<\n\n@current_recipe = \"gems\"\n@before_configs[\"gems\"].call if @before_configs[\"gems\"]\nsay_recipe 'gems'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb\n\n### GEMFILE ###\n\n## Ruby on Rails\ninsert_into_file 'Gemfile', \"ruby '1.9.3'\\n\", :before => \"gem 'rails', '3.2.6'\" if prefer :deploy, 'heroku'\n\n## Web Server\nif (prefs[:dev_webserver] == prefs[:prod_webserver])\n  gem 'thin', '>= 1.4.1' if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1' if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3' if prefer :dev_webserver, 'puma'\nelse\n  gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => [:development, :test] if prefer :dev_webserver, 'puma'\n  gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'\n  gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'\n  gem 'puma', '>= 1.6.3', :group => :production if prefer :prod_webserver, 'puma'\nend\n\n## Database Adapter\ngsub_file 'Gemfile', /gem 'sqlite3'\\n/, '' unless prefer :database, 'sqlite'\ngem 'mongoid', '>= 3.0.5' if prefer :orm, 'mongoid'\ngem 'pg', '>= 0.14.1' if prefer :database, 'postgresql'\ngem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'\n\n## Template Engine\nif prefer :templates, 'haml'\n  gem 'haml', '>= 3.1.7'\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  # hpricot and ruby_parser are needed for conversion of HTML to Haml\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\nif prefer :templates, 'slim'\n  gem 'slim', '>= 1.3.0'\n  gem 'haml2slim', '>= 0.4.6', :group => :development\n  # Haml is needed for conversion of HTML to Slim\n  gem 'haml', '>= 3.1.6', :group => :development\n  gem 'haml-rails', '>= 0.3.5', :group => :development\n  gem 'hpricot', '>= 0.8.6', :group => :development\n  gem 'ruby_parser', '>= 2.3.1', :group => :development\nend\n\n## Testing Framework\nif prefer :unit_test, 'rspec'\n  gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]\n  gem 'capybara', '>= 1.1.2', :group => :test\n  if prefer :orm, 'mongoid'\n    # use the database_cleaner gem to reset the test database\n    gem 'database_cleaner', '>= 0.8.0', :group => :test\n    # include RSpec matchers from the mongoid-rspec gem\n    gem 'mongoid-rspec', '>= 1.4.6', :group => :test\n  end\n  gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'\nend\nif prefer :integration, 'cucumber'\n  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false\n  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'\n  gem 'launchy', '>= 2.1.2', :group => :test\nend\ngem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'\ngem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'\ngem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'\n\n## Front-end Framework\ngem 'bootstrap-sass', '>= 2.1.0.0' if prefer :bootstrap, 'sass'\ngem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'\ngem 'zurb-foundation', '>= 3.0.9', :group => :assets if prefer :frontend, 'foundation'\nif prefer :bootstrap, 'less'\n  gem 'twitter-bootstrap-rails', '>= 2.1.3', :group => :assets\n  # install gem 'therubyracer' to use Less\n  gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\nend\n\n## Email\ngem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'\ngem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'\n\n## Authentication (Devise)\ngem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'\ngem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'\n\n## Authentication (OmniAuth)\ngem 'omniauth', '>= 1.1.1' if prefer :authentication, 'omniauth'\ngem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'\ngem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'\ngem 'omniauth-github' if prefer :omniauth_provider, 'github'\ngem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'\ngem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'\ngem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'\n\n## Authorization \nif prefer :authorization, 'cancan'\n  gem 'cancan', '>= 1.6.8'\n  gem 'rolify', '>= 3.2.0'\nend\n\n## Form Builder\ngem 'simple_form', '>= 2.0.2' if prefer :form_builder, 'simple_form'\n\n## Signup App \nif prefer :railsapps, 'rails-prelaunch-signup'\n  gem 'google_visualr', '>= 2.1.2'\n  gem 'jquery-datatables-rails', '>= 1.11.0'\nend\n\n## Gems from a defaults file or added interactively\ngems.each do |g|\n  gem g\nend\n\n## Git\ngit :add => '.' if prefer :git, true\ngit :commit => \"-aqm 'rails_apps_composer: Gemfile'\" if prefer :git, true\n\n### CREATE DATABASE ###\nafter_bundler do\n  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'\n  copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'\n  generate 'mongoid:config' if prefer :orm, 'mongoid'\n  remove_file 'config/database.yml' if prefer :orm, 'mongoid'\n  if prefer :database, 'postgresql'\n    begin\n      say_wizard \"Creating a user named '#{app_name}' for PostgreSQL\"\n      run \"createuser #{app_name}\" if prefer :database, 'postgresql'\n      gsub_file \"config/database.yml\", /username: .*/, \"username: #{app_name}\"\n      gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n      gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n      gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n    rescue StandardError\n      raise \"unable to create a user for PostgreSQL\"\n    end\n  end\n  if prefer :database, 'mysql'\n    gsub_file \"config/database.yml\", /database: myapp_development/, \"database: #{app_name}_development\"\n    gsub_file \"config/database.yml\", /database: myapp_test/,        \"database: #{app_name}_test\"\n    gsub_file \"config/database.yml\", /database: myapp_production/,  \"database: #{app_name}_production\"\n  end\n  unless prefer :database, 'sqlite'\n    affirm = multiple_choice \"Drop any existing databases named #{app_name}?\", \n      [[\"Yes (continue)\",true], [\"No (abort)\",false]]\n    if affirm\n      run 'bundle exec rake db:drop'\n    else\n      raise \"aborted at user's request\"\n    end\n  end\n  run 'bundle exec rake db:create:all' unless prefer :orm, 'mongoid'\n  run 'bundle exec rake db:create' if prefer :orm, 'mongoid'\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: create database'\" if prefer :git, true\nend # after_bundler\n\n### GENERATORS ###\nafter_bundler do\n  ## Front-end Framework\n  generate 'foundation:install' if prefer :frontend, 'foundation'\n  ## Form Builder\n  if prefer :form_builder, 'simple_form'\n    if prefer :frontend, 'bootstrap'\n      say_wizard \"recipe installing simple_form for use with Twitter Bootstrap\"\n      generate 'simple_form:install --bootstrap'\n    else\n      say_wizard \"recipe installing simple_form\"\n      generate 'simple_form:install'\n    end\n  end\n  ## Git\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: generators'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ testing ]--------------------------------<\n\n@current_recipe = \"testing\"\n@before_configs[\"testing\"].call if @before_configs[\"testing\"]\nsay_recipe 'testing'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    say_wizard \"recipe installing RSpec\"\n    generate 'rspec:install'\n    copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    unless prefer :email, 'none'\n      generate 'email_spec:steps'\n      inject_into_file 'spec/spec_helper.rb', \"require 'email_spec'\\n\", :after => \"require 'rspec/rails'\\n\"\n      inject_into_file 'spec/spec_helper.rb', :after => \"RSpec.configure do |config|\\n\" do <<-RUBY\n  config.include(EmailSpec::Helpers)\n  config.include(EmailSpec::Matchers)\nRUBY\n      end\n    end\n    run 'rm -rf test/' # Removing test folder (not needed for RSpec)\n    inject_into_file 'config/application.rb', :after => \"Rails::Application\\n\" do <<-RUBY\n\n    # don't generate RSpec tests for views and helpers\n    config.generators do |g|\n      g.view_specs false\n      g.helper_specs false\n      #{\"g.fixture_replacement :machinist\" if prefer :fixtures, 'machinist'}\n    end\n\nRUBY\n    end\n    ## RSPEC AND MONGOID\n    if prefer :orm, 'mongoid'\n      # remove ActiveRecord artifacts\n      gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'\n      gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'\n      # remove either possible occurrence of \"require rails/test_unit/railtie\"\n      gsub_file 'config/application.rb', /require 'rails\\/test_unit\\/railtie'/, '# require \"rails/test_unit/railtie\"'\n      gsub_file 'config/application.rb', /require \"rails\\/test_unit\\/railtie\"/, '# require \"rails/test_unit/railtie\"'\n      # configure RSpec to use matchers from the mongoid-rspec gem\n      create_file 'spec/support/mongoid.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Mongoid::Matchers\nend\nRUBY\n      end\n    end\n    ## RSPEC AND DEVISE\n    if prefer :authentication, 'devise'\n      # add Devise test helpers\n      create_file 'spec/support/devise.rb' do\n      <<-RUBY\nRSpec.configure do |config|\n  config.include Devise::TestHelpers, :type => :controller\nend\nRUBY\n      end\n    end\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    say_wizard \"recipe installing Cucumber\"\n    generate \"cucumber:install --capybara#{' --rspec' if prefer :unit_test, 'rspec'}#{' -D' if prefer :orm, 'mongoid'}\"\n    # make it easy to run Cucumber for single features without adding \"--require features\" to the command line\n    gsub_file 'config/cucumber.yml', /std_opts = \"/, 'std_opts = \"-r features/support/ -r features/step_definitions '\n    unless prefer :email, 'none'\n      create_file 'features/support/email_spec.rb' do <<-RUBY\nrequire 'email_spec/cucumber'\nRUBY\n      end      \n    end\n    ## CUCUMBER AND MONGOID\n    if prefer :orm, 'mongoid'\n      gsub_file 'features/support/env.rb', /transaction/, \"truncation\"\n      inject_into_file 'features/support/env.rb', :after => 'begin' do\n        \"\\n  DatabaseCleaner.orm = 'mongoid'\"\n      end\n    end\n  end\n  ## TURNIP\n  if prefer :integration, 'turnip'\n    append_file '.rspec', '-r turnip/rspec'\n    inject_into_file 'spec/spec_helper.rb', \"require 'turnip/capybara'\\n\", :after => \"require 'rspec/rails'\\n\"\n    create_file 'spec/acceptance/steps/.gitkeep'\n  end\n  ## FIXTURE REPLACEMENTS\n  if prefer :fixtures, 'machinist'\n    say_wizard \"generating blueprints file for 'machinist'\"\n    generate 'machinist:install'\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: testing framework'\" if prefer :git, true\nend # after_bundler\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### RSPEC ###\n  if prefer :unit_test, 'rspec'\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying RSpec files from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      gsub_file 'spec/factories/users.rb', /# confirmed_at/, \"confirmed_at\" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n      remove_file 'spec/views/home/index.html.erb_spec.rb'\n      remove_file 'spec/views/home/index.html.haml_spec.rb'\n      remove_file 'spec/views/users/show.html.erb_spec.rb'\n      remove_file 'spec/views/users/show.html.haml_spec.rb'\n      remove_file 'spec/helpers/home_helper_spec.rb'\n      remove_file 'spec/helpers/users_helper_spec.rb'\n    end\n    ## RSPEC AND OMNIAUTH\n    if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying RSpec files from the rails3-mongoid-omniauth examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## SUBDOMAINS\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'spec/factories/users.rb', :repo => repo\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo\n      copy_from_repo 'spec/models/user_spec.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: rspec files'\" if prefer :git, true\n  end\n  ### CUCUMBER ###\n  if prefer :integration, 'cucumber'\n    ## CUCUMBER AND DEVISE (USERS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'users_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (ADMIN APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')\n      say_wizard \"copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n      copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, \"A message with a confirmation link has been sent to your email address.\"\n        inject_into_file 'features/users/sign_in.feature', :before => '    Scenario: User signs in successfully' do\n<<-RUBY\n  Scenario: User has not confirmed account\n    Given I exist as an unconfirmed user\n    And I am not logged in\n    When I sign in with valid credentials\n    Then I see an unconfirmed account message\n    And I should be signed out\nRUBY\n        end\n      end\n    end\n    ## CUCUMBER AND DEVISE (SUBDOMAINS APP)\n    if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')\n      say_wizard \"copying RSpec files from the rails3-subdomains examples\"\n      repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'\n      copy_from_repo 'features/users/sign_in.feature', :repo => repo\n      copy_from_repo 'features/users/sign_out.feature', :repo => repo\n      copy_from_repo 'features/users/sign_up.feature', :repo => repo\n      copy_from_repo 'features/users/user_edit.feature', :repo => repo\n      copy_from_repo 'features/users/user_show.feature', :repo => repo\n      copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo\n      copy_from_repo 'features/support/paths.rb', :repo => repo\n    end\n    ## GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: cucumber files'\" if prefer :git, true\n  end\nend # after_everything\n\n\n# >---------------------------------[ email ]---------------------------------<\n\n@current_recipe = \"email\"\n@before_configs[\"email\"].call if @before_configs[\"email\"]\nsay_recipe 'email'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  unless prefer :email, 'none'\n    ### DEVELOPMENT\n    gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'\n    gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do\n  <<-RUBY\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n  config.action_mailer.delivery_method = :smtp\n  # change to true to allow email to be sent during development\n  config.action_mailer.perform_deliveries = false\n  config.action_mailer.raise_delivery_errors = true\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n    ### TEST\n    inject_into_file 'config/environments/test.rb', :before => \"\\nend\" do \n  <<-RUBY\n\\n  \n  # ActionMailer Config\n  config.action_mailer.default_url_options = { :host => 'example.com' }\nRUBY\n    end\n    ### PRODUCTION\n    gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do\n  <<-RUBY\nconfig.active_support.deprecation = :notify\n\n  config.action_mailer.default_url_options = { :host => 'example.com' }\n  # ActionMailer Config\n  # Setup for production - deliveries, no errors raised\n  config.action_mailer.delivery_method = :smtp\n  config.action_mailer.perform_deliveries = true\n  config.action_mailer.raise_delivery_errors = false\n  config.action_mailer.default :charset => \"utf-8\"\nRUBY\n    end\n  end\n  ### GMAIL ACCOUNT\n  if prefer :email, 'gmail'\n    gmail_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.gmail.com\",\n    port: 587,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    enable_starttls_auto: true,\n    user_name: ENV[\"GMAIL_USERNAME\"],\n    password: ENV[\"GMAIL_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', gmail_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n  ### SENDGRID ACCOUNT\n  if prefer :email, 'sendgrid'\n    sendgrid_configuration_text = <<-TEXT\n\\n\n  config.action_mailer.smtp_settings = {\n    address: \"smtp.sendgrid.net\",\n    port: 25,\n    domain: \"example.com\",\n    authentication: \"plain\",\n    user_name: ENV[\"SENDGRID_USERNAME\"],\n    password: ENV[\"SENDGRID_PASSWORD\"]\n  }\nTEXT\n    inject_into_file 'config/environments/development.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    inject_into_file 'config/environments/production.rb', sendgrid_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n  end\n    ### MANDRILL ACCOUNT\n    if prefer :email, 'mandrill'\n      mandrill_configuration_text = <<-TEXT\n  \\n\n    config.action_mailer.smtp_settings = {\n      :address   => \"smtp.mandrillapp.com\",\n      :port      => 25,\n      :user_name => ENV[\"MANDRILL_USERNAME\"],\n      :password  => ENV[\"MANDRILL_API_KEY\"]\n    }\n  TEXT\n      inject_into_file 'config/environments/development.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n      inject_into_file 'config/environments/production.rb', mandrill_configuration_text, :after => 'config.action_mailer.default :charset => \"utf-8\"'\n    end\n    ### GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: set email accounts'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ models ]---------------------------------<\n\n@current_recipe = \"models\"\n@before_configs[\"models\"].call if @before_configs[\"models\"]\nsay_recipe 'models'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  if prefer :authentication, 'devise'\n    # prevent logging of password_confirmation\n    gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'\n    generate 'devise:install'\n    generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'\n    generate 'devise user' # create the User model\n    if prefer :orm, 'mongoid'\n      ## DEVISE AND MONGOID\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_token/, \"field :confirmation_token\"\n        gsub_file 'app/models/user.rb', /# field :confirmed_at/, \"field :confirmed_at\"\n        gsub_file 'app/models/user.rb', /# field :confirmation_sent_at/, \"field :confirmation_sent_at\"\n        gsub_file 'app/models/user.rb', /# field :unconfirmed_email/, \"field :unconfirmed_email\"\n      end\n      if (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /\\bend\\s*\\Z/ do\n  <<-RUBY\n  #invitable\n  field :invitation_token, :type => String\n  field :invitation_sent_at, :type => Time\n  field :invitation_accepted_at, :type => Time\n  field :invitation_limit, :type => Integer\n  field :invited_by_id, :type => String\n  field :invited_by_type, :type => String\nend\nRUBY\n        end\n      end\n    else\n      ## DEVISE AND ACTIVE RECORD\n      generate 'migration AddNameToUsers name:string'\n      copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n      if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n        gsub_file 'app/models/user.rb', /:registerable,/, \":registerable, :confirmable,\"\n        generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'\n      end\n    end\n    ## DEVISE AND CUCUMBER\n    if prefer :integration, 'cucumber'\n      # Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path\n      # (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)\n      gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'\n    end\n  end\n  ### OMNIAUTH ###\n  if prefer :authentication, 'omniauth'\n    repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    copy_from_repo 'config/initializers/omniauth.rb', :repo => repo\n    generate 'model User name:string email:string provider:string uid:string' unless prefer :orm, 'mongoid'\n    run 'bundle exec rake db:migrate' unless prefer :orm, 'mongoid' \n    copy_from_repo 'app/models/user.rb', :repo => repo  # copy the User model (Mongoid version)\n    unless prefer :orm, 'mongoid'\n      ## OMNIAUTH AND ACTIVE RECORD\n      gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'\n      gsub_file 'app/models/user.rb', /^\\s*include Mongoid::Document\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*field.*\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*# run 'rake db:mongoid:create_indexes' to create indexes\\n/, ''\n      gsub_file 'app/models/user.rb', /^\\s*index\\(\\{ email: 1 \\}, \\{ unique: true, background: true \\}\\)\\n/, ''\n    end\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### AUTHORIZATION ###\n  if prefer :authorization, 'cancan'\n    generate 'cancan:ability'\n    if prefer :starter_app, 'admin_app' # Limit access to the users#index page\n      copy_from_repo 'app/models/ability.rb', :repo => 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'\n    end\n    unless prefer :orm, 'mongoid'\n      generate 'rolify:role Role User'\n    else\n      generate 'rolify:role Role User mongoid'\n    \t# correct the generation of rolify 3.1 with mongoid\n    \t# the call to `rolify` should be *after* the inclusion of mongoid\n    \t# (see https://github.com/EppO/rolify/issues/61)\n    \t# This isn't needed for rolify>=3.2.0.beta4, but should cause no harm\n    \tgsub_file 'app/models/user.rb',\n    \t\t  /^\\s*(rolify.*?)$\\s*(include Mongoid::Document.*?)$/,\n    \t\t  \"  \\\\2\\n  extend Rolify\\n  \\\\1\\n\"\n    end\n  end\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: models'\" if prefer :git, true\nend # after_bundler\n\n\n# >------------------------------[ controllers ]------------------------------<\n\n@current_recipe = \"controllers\"\n@before_configs[\"controllers\"].call if @before_configs[\"controllers\"]\nsay_recipe 'controllers'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/controllers.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### APPLICATION_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    copy_from_repo 'app/controllers/application_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n  end\n  if prefer :authorization, 'cancan'\n    inject_into_file 'app/controllers/application_controller.rb', :before => \"\\nend\" do <<-RUBY\n\\n\n  rescue_from CanCan::AccessDenied do |exception|\n    redirect_to root_path, :alert => exception.message\n  end\nRUBY\n    end\n  end  \n  ### HOME_CONTROLLER ###\n  if ['home_app','users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    generate(:controller, \"home index\")\n  end\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    gsub_file 'app/controllers/home_controller.rb', /def index/, \"def index\\n    @users = User.all\"\n  end\n  ### USERS_CONTROLLER ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    if prefer :authentication, 'devise'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'\n    elsif prefer :authentication, 'omniauth'\n      copy_from_repo 'app/controllers/users_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    end\n    if prefer :authorization, 'cancan'\n      inject_into_file 'app/controllers/users_controller.rb', \"    authorize! :index, @user, :message => 'Not authorized as an administrator.'\\n\", :after => \"def index\\n\"\n    end\n  end\n  gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, '' if prefer :starter_app, 'subdomains_app'\n  ### SESSIONS_CONTROLLER ###\n  if prefer :authentication, 'omniauth'\n    filename = 'app/controllers/sessions_controller.rb'\n    copy_from_repo filename, :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'\n    gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'\n    if prefer :authorization, 'cancan'\n      inject_into_file filename, \"    user.add_role :admin if User.count == 1 # make the first user an admin\\n\", :after => \"session[:user_id] = user.id\\n\"\n    end\n  end\n  ### PROFILES_CONTROLLER ###\n  copy_from_repo 'app/controllers/profiles_controller.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: controllers'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ views ]---------------------------------<\n\n@current_recipe = \"views\"\n@before_configs[\"views\"].call if @before_configs[\"views\"]\nsay_recipe 'views'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/views.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### DEVISE ###\n  copy_from_repo 'app/views/devise/shared/_links.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/edit.html.erb' if prefer :authentication, 'devise'\n  copy_from_repo 'app/views/devise/registrations/new.html.erb' if prefer :authentication, 'devise'\n  ### HOME ###\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'users_app'\n  copy_from_repo 'app/views/home/index.html.erb' if prefer :starter_app, 'admin_app'\n  copy_from_repo 'app/views/home/index-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### USERS ###\n  if ['users_app','admin_app','subdomains_app'].include? prefs[:starter_app]\n    ## INDEX\n    copy_from_repo 'app/views/users/index.html.erb'\n    ## SHOW\n    copy_from_repo 'app/views/users/show.html.erb'\n    copy_from_repo 'app/views/users/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n    ## EDIT\n    copy_from_repo 'app/views/users/edit-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  ### PROFILES ###\n  copy_from_repo 'app/views/profiles/show-subdomains_app.html.erb', :prefs => 'subdomains_app'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: views'\" if prefer :git, true\nend # after_bundler\n\n\n# >--------------------------------[ routes ]---------------------------------<\n\n@current_recipe = \"routes\"\n@before_configs[\"routes\"].call if @before_configs[\"routes\"]\nsay_recipe 'routes'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### HOME ###\n  if prefer :starter_app, 'home_app'\n    remove_file 'public/index.html'\n    gsub_file 'config/routes.rb', /get \\\"home\\/index\\\"/, 'root :to => \"home#index\"'\n  end\n  ### USER_ACCOUNTS ###\n  if ['users_app','admin_app'].include? prefs[:starter_app]\n    ## DEVISE\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'\n    ## OMNIAUTH\n    copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'\n  end\n  ### SUBDOMAINS ###\n  copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains_app'\n  ### CORRECT APPLICATION NAME ###\n  gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: routes'\" if prefer :git, true\nend # after_bundler\n\n\n# >-------------------------------[ frontend ]--------------------------------<\n\n@current_recipe = \"frontend\"\n@before_configs[\"frontend\"].call if @before_configs[\"frontend\"]\nsay_recipe 'frontend'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb\n\nafter_bundler do\n  say_wizard \"recipe running after 'bundle install'\"\n  ### LAYOUTS ###\n  copy_from_repo 'app/views/layouts/application.html.erb'\n  copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_messages.html.erb'\n  copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'\n  copy_from_repo 'app/views/layouts/_navigation.html.erb'\n  if prefer :authorization, 'cancan'\n    case prefs[:authentication]\n      when 'devise'\n        copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'\n      when 'omniauth'\n        copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/app/views/layouts/_navigation-cancan-omniauth.html.erb', 'app/views/layouts/_navigation.html.erb'\n    end\n  else\n    copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'\n    copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'\n  end\n  copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'  \n  ## APPLICATION NAME\n  application_layout_file = Dir['app/views/layouts/application.html.*'].first\n  navigation_partial_file = Dir['app/views/layouts/_navigation.html.*'].first\n  gsub_file application_layout_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  gsub_file navigation_partial_file, /App_Name/, \"#{app_name.humanize.titleize}\"\n  ### CSS ###\n  copy_from_repo 'app/assets/stylesheets/application.css.scss'\n  copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'\n  if prefer :bootstrap, 'less'\n    generate 'bootstrap:install'\n    insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', \"body { padding-top: 60px; }\\n\", :after => \"@import \\\"twitter/bootstrap/bootstrap\\\";\\n\"\n  elsif prefer :bootstrap, 'sass'\n    insert_into_file 'app/assets/javascripts/application.js', \"//= require bootstrap\\n\", :after => \"jquery_ujs\\n\"\n    create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY\n@import \"bootstrap\";\nbody { padding-top: 60px; }\n@import \"bootstrap-responsive\";\nRUBY\n  elsif prefer :frontend, 'foundation'\n    insert_into_file 'app/assets/stylesheets/application.css.scss', \" *= require foundation_and_overrides\\n\", :after => \"require_self\\n\"\n  elsif prefer :frontend, 'skeleton'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'\n    copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'\n  elsif prefer :frontend, 'normalize'\n    copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'\n  end\n  remove_file 'app/assets/stylesheets/application.css'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: front-end framework'\" if prefer :git, true\nend # after_bundler\n\n\n# >---------------------------------[ init ]----------------------------------<\n\n@current_recipe = \"init\"\n@before_configs[\"init\"].call if @before_configs[\"init\"]\nsay_recipe 'init'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb\n\nafter_everything do\n  say_wizard \"recipe running after everything\"\n  ### PREPARE SEED ###\n  if prefer :authentication, 'devise'\n    if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')\n      ## DEVISE-CONFIRMABLE\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nuser.confirm!\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nuser2.confirm!\nputs 'New user created: ' << user2.name\nFILE\n      end\n    else\n      ## DEVISE-DEFAULT\n      append_file 'db/seeds.rb' do <<-FILE\nputs 'SETTING UP DEFAULT USER LOGIN'\nuser = User.create! :name => 'First User', :email => 'user@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user.name\nuser2 = User.create! :name => 'Second User', :email => 'user2@example.com', :password => 'please', :password_confirmation => 'please'\nputs 'New user created: ' << user2.name\nFILE\n      end\n    end\n    if prefer :starter_app, 'subdomains_app'\n      gsub_file 'db/seeds.rb', /First User/, 'user1'\n      gsub_file 'db/seeds.rb', /Second User/, 'user2'\n    end\n    if prefer :authorization, 'cancan'\n      append_file 'db/seeds.rb' do <<-FILE\nuser.add_role :admin\nFILE\n      end\n    end\n    ## DEVISE-INVITABLE\n    if prefer :devise_modules, 'invitable'\n      run 'bundle exec rake db:migrate'\n      generate 'devise_invitable user'\n    end    \n  end\n  ### APPLY SEED ###\n  unless prefer :orm, 'mongoid'\n    ## ACTIVE_RECORD\n    say_wizard \"applying migrations and seeding the database\"\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n  else\n    ## MONGOID\n    say_wizard \"dropping database, creating indexes and seeding the database\"\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:mongoid:create_indexes'\n  end\n  run 'bundle exec rake db:seed'\n  ### GIT ###\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: set up database'\" if prefer :git, true\nend # after_everything\n\n\n# >-------------------------------[ prelaunch ]-------------------------------<\n\n@current_recipe = \"prelaunch\"\n@before_configs[\"prelaunch\"].call if @before_configs[\"prelaunch\"]\nsay_recipe 'prelaunch'\n\n\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb\n\nif prefer :railsapps, 'rails-prelaunch-signup'\n  \n  after_everything do\n    say_wizard \"recipe running after 'bundle install'\"\n    repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'\n\n    # >-------------------------------[ Clean up starter app ]--------------------------------<\n\n    %w{\n      public/index.html\n      app/assets/images/rails.png\n    }.each { |file| remove_file file }\n    # remove commented lines and multiple blank lines from Gemfile\n    # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n    gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n    gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n    # remove commented lines and multiple blank lines from config/routes.rb\n    gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n    gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n    # GIT\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: clean up starter app'\" if prefer :git, true\n\n    # >-------------------------------[ Create a git branch ]--------------------------------<\n    if prefer :git, true\n      if prefer :prelaunch_branch, 'master'\n        unless prefer :main_branch, 'none'\n          say_wizard \"renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app\"\n          git :branch => \"-m master #{prefs[:main_branch]}\"\n          git :checkout => \"-b master\"\n        else\n          say_wizard \"creating prelaunch app on git branch 'master'\"\n        end\n      else\n        say_wizard \"creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app\"\n        git :checkout => \"-b #{prefs[:prelaunch_branch]}\"\n      end\n    end\n\n    # >-------------------------------[ Cucumber ]--------------------------------<\n    say_wizard \"copying Cucumber scenarios from the rails-prelaunch-signup examples\"\n    copy_from_repo 'features/admin/send_invitations.feature', :repo => repo    \n    copy_from_repo 'features/admin/view_progress.feature', :repo => repo\n    copy_from_repo 'features/visitors/request_invitation.feature', :repo => repo\n    copy_from_repo 'features/users/sign_in.feature', :repo => repo\n    copy_from_repo 'features/users/sign_up.feature', :repo => repo\n    copy_from_repo 'features/users/user_show.feature', :repo => repo\n    copy_from_repo 'features/step_definitions/admin_steps.rb', :repo => repo\n    copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo    \n    copy_from_repo 'features/step_definitions/visitor_steps.rb', :repo => repo\n    copy_from_repo 'config/locales/devise.en.yml', :repo => repo\n\n    # >-------------------------------[ Migrations ]--------------------------------<\n\n    generate 'migration AddOptinToUsers opt_in:boolean'\n    run 'bundle exec rake db:drop'\n    run 'bundle exec rake db:migrate'\n    run 'bundle exec rake db:test:prepare'\n    run 'bundle exec rake db:seed'\n\n    # >-------------------------------[ Models ]--------------------------------<\n\n    copy_from_repo 'app/models/user.rb', :repo => repo\n\n    # >-------------------------------[ Controllers ]--------------------------------<\n\n    copy_from_repo 'app/controllers/confirmations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/home_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo\n    copy_from_repo 'app/controllers/users_controller.rb', :repo => repo\n\n    # >-------------------------------[ Mailers ]--------------------------------<\n    \n    generate 'mailer UserMailer'\n    copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo\n    copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo\n\n    # >-------------------------------[ Views ]--------------------------------<\n\n    copy_from_repo 'app/views/devise/confirmations/show.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/mailer/confirmation_instructions.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/_thankyou.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/registrations/new.html.erb', :repo => repo\n    copy_from_repo 'app/views/devise/shared/_links.html.erb', :repo => repo\n    copy_from_repo 'app/views/home/index.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.html.erb', :repo => repo\n    copy_from_repo 'app/views/user_mailer/welcome_email.text.erb', :repo => repo\n    copy_from_repo 'app/views/users/index.html.erb', :repo => repo\n    copy_from_repo 'public/thankyou.html', :repo => repo\n\n    # >-------------------------------[ Routes ]--------------------------------<\n    \n    copy_from_repo 'config/routes.rb', :repo => repo\n    ### CORRECT APPLICATION NAME ###\n    gsub_file 'config/routes.rb', /^.*.routes.draw do/, \"#{app_const}.routes.draw do\"\n    \n    # >-------------------------------[ Assets ]--------------------------------<\n    \n    copy_from_repo 'app/assets/javascripts/application.js', :repo => repo\n    copy_from_repo 'app/assets/javascripts/users.js.coffee', :repo => repo\n    copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo\n    \n    ### GIT ###\n    git :add => '.' if prefer :git, true\n    git :commit => \"-aqm 'rails_apps_composer: prelaunch app'\" if prefer :git, true\n  end # after_bundler\nend # rails-prelaunch-signup\n\n\n# >--------------------------------[ extras ]---------------------------------<\n\n@current_recipe = \"extras\"\n@before_configs[\"extras\"].call if @before_configs[\"extras\"]\nsay_recipe 'extras'\n\nconfig = {}\nconfig['ban_spiders'] = yes_wizard?(\"Set a robots.txt file to ban spiders?\") if true && true unless config.key?('ban_spiders') || prefs.has_key?(:ban_spiders)\nconfig['rvmrc'] = yes_wizard?(\"Create a project-specific rvm gemset and .rvmrc?\") if true && true unless config.key?('rvmrc') || prefs.has_key?(:rvmrc)\nconfig['github'] = yes_wizard?(\"Create a GitHub repository?\") if true && true unless config.key?('github') || prefs.has_key?(:github)\n@configs[@current_recipe] = config\n\n# Application template recipe for the rails_apps_composer. Change the recipe here:\n# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb\n\n## BAN SPIDERS\nif config['ban_spiders']\n  prefs[:ban_spiders] = true\nend\nif prefs[:ban_spiders]\n  say_wizard \"recipe banning spiders by modifying 'public/robots.txt'\"\n  after_bundler do\n    gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'\n    gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'\n  end\nend\n\n## JSRUNTIME\ncase RbConfig::CONFIG['host_os']\n  when /linux/i\n    prefs[:jsruntime] = yes_wizard? \"Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?\" unless prefs.has_key? :jsruntime\n    if prefs[:jsruntime]\n      # was it already added for bootstrap-less?\n      unless prefer :bootstrap, 'less'\n        say_wizard \"recipe adding 'therubyracer' JavaScript runtime gem\"\n        gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby\n      end\n    end\nend\n\n## RVMRC\nif config['rvmrc']\n  prefs[:rvmrc] = true\nend\nif prefs[:rvmrc]\n  say_wizard \"recipe creating project-specific rvm gemset and .rvmrc\"\n  # using the rvm Ruby API, see:\n  # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/\n  # https://rvm.io/integration/passenger\n  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')\n    begin\n      gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')\n      ENV['GEM_PATH'] = \"#{gems_path}:#{gems_path}@global\"\n      require 'rvm'\n      RVM.use_from_path! File.dirname(File.dirname(__FILE__))\n    rescue LoadError\n      raise \"RVM gem is currently unavailable.\"\n    end\n  end\n  say_wizard \"creating RVM gemset '#{app_name}'\"\n  RVM.gemset_create app_name\n  run \"rvm rvmrc trust\"\n  say_wizard \"switching to gemset '#{app_name}'\"\n  begin\n    RVM.gemset_use! app_name\n  rescue StandardError\n    raise \"rvm failure: unable to use gemset #{app_name}\"\n  end\n  run \"rvm gemset list\"\n  copy_from_repo '.rvmrc'\n  gsub_file '.rvmrc', /App_Name/, \"#{app_name}\"\nend\n\n## AFTER_EVERYTHING\nafter_everything do\n  say_wizard \"recipe removing unnecessary files and whitespace\"\n  %w{\n    public/index.html\n    app/assets/images/rails.png\n  }.each { |file| remove_file file }\n  # remove commented lines and multiple blank lines from Gemfile\n  # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb\n  gsub_file 'Gemfile', /#.*\\n/, \"\\n\"\n  gsub_file 'Gemfile', /\\n^\\s*\\n/, \"\\n\"\n  # remove commented lines and multiple blank lines from config/routes.rb\n  gsub_file 'config/routes.rb', /  #.*\\n/, \"\\n\"\n  gsub_file 'config/routes.rb', /\\n^\\s*\\n/, \"\\n\"\n  # GIT\n  git :add => '.' if prefer :git, true\n  git :commit => \"-aqm 'rails_apps_composer: extras'\" if prefer :git, true\nend\n\n## GITHUB\nif config['github']\n  gem 'hub', '>= 1.10.2', :require => nil, :group => [:development]\n  after_everything do\n    say_wizard \"recipe creating GitHub repository\"\n    git_uri = `git config remote.origin.url`.strip\n    unless git_uri.size == 0\n      say_wizard \"Repository already exists:\"\n      say_wizard \"#{git_uri}\"\n    else\n      run \"hub create #{app_name}\"\n      unless prefer :railsapps, 'rails-prelaunch-signup'\n        run \"hub push -u origin master\"\n      else\n        run \"hub push -u origin #{prefs[:prelaunch_branch]}\"\n        run \"hub push -u origin #{prefs[:main_branch]}\" unless prefer :main_branch, 'none'\n      end\n    end\n  end\nend\n\n\n\n# >---------------------------------[ Diagnostics ]----------------------------------<\n\n# remove prefs which are diagnostically irrelevant\nredacted_prefs = prefs.clone\nredacted_prefs.delete(:git)\nredacted_prefs.delete(:dev_webserver)\nredacted_prefs.delete(:prod_webserver)\nredacted_prefs.delete(:templates)\nredacted_prefs.delete(:ban_spiders)\nredacted_prefs.delete(:jsruntime)\nredacted_prefs.delete(:rvmrc)\nredacted_prefs.delete(:prelaunch_branch)\nredacted_prefs.delete(:main_branch)\n\nif diagnostics_prefs.include? redacted_prefs\n  diagnostics[:prefs] = 'success'\nelse\n  diagnostics[:prefs] = 'fail'\nend\n\n\n\n@current_recipe = nil\n\n# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<\n\nsay_wizard \"Installing gems. This will take a while.\"\nif prefs.has_key? :bundle_path\n  run \"bundle install --without production --path #{prefs[:bundle_path]}\"\nelse\n  run 'bundle install --without production'\nend\n\n# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<\n\nsay_wizard \"Running 'after bundler' callbacks.\"\nrequire 'bundler/setup'\nif prefer :templates, 'haml'\n  say_wizard \"importing html2haml conversion tool\"\n  require 'haml/html'\nend\nif prefer :templates, 'slim'\n  say_wizard \"importing html2haml and haml2slim conversion tools\"\n  require 'haml/html'\n  require 'haml2slim'\nend\n@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n# >-----------------------------[ Run 'After Everything' Callbacks ]-------------------------------<\n\n@current_recipe = nil\nsay_wizard \"Running 'after everything' callbacks.\"\n@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}\n\n@current_recipe = nil\nif diagnostics[:recipes] == 'success'\n  say_wizard(\"WOOT! The recipes you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The recipes you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nif diagnostics[:prefs] == 'success'\n  say_wizard(\"WOOT! The preferences you've selected are known to work together.\")\n  say_wizard(\"If they don't, open an issue for rails_apps_composer on GitHub.\")\nelse\n  say_wizard(\"\\033[1m\\033[36m\" + \"WARNING! The preferences you've selected might not work together.\" + \"\\033[0m\")\n  say_wizard(\"Help us out by reporting whether this combination works or fails.\")\n  say_wizard(\"Please open an issue for rails_apps_composer on GitHub.\")\n  say_wizard(\"Your new application will contain diagnostics in its README file.\")\nend\nsay_wizard \"Finished running the rails_apps_composer app template.\"\nsay_wizard \"Your new Rails app is ready. Time to run 'bundle install'.\"\n"
  }
]