Skip to content

Instantly share code, notes, and snippets.

@marshluca
Created October 21, 2011 10:24
Show Gist options
  • Save marshluca/1303515 to your computer and use it in GitHub Desktop.
Save marshluca/1303515 to your computer and use it in GitHub Desktop.
rails 3 template with mongoid, devise
# Application Generator Template
# Modifies a Rails app to use Mongoid and Devise
# Usage: rails new APP_NAME -m https://raw.github.com/gist/1303515/4f661b5cbc2a6d3ed25e85c78fa8ac4f21eafa83/rails3-mongoid-devise-template.rb -T -O
# Information and a tutorial:
# http://github.com/RailsApps/rails3-mongoid-devise/
# Generated using the rails_apps_composer gem:
# https://github.com/RailsApps/rails_apps_composer/
# Based on application template recipes by:
# Michael Bleigh https://github.com/mbleigh
# Fletcher Nichol https://github.com/fnichol
# Daniel Kehoe https://github.com/fortuity
# Ramon Brooker https://github.com/cognition
# If you are customizing this template, you can use any methods provided by Thor::Actions
# http://rdoc.info/rdoc/wycats/thor/blob/f939a3e8a854616784cac1dcff04ef4f3ee5f7ff/Thor/Actions.html
# and Rails::Generators::Actions
# http://github.com/rails/rails/blob/master/railties/lib/rails/generators/actions.rb
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by rails_apps_composer, a custom version of
# RailsWizard, the application template builder. For more information, see:
# https://github.com/RailsApps/rails_apps_composer/
#
# >---------------------------------------------------------------------------<
# >----------------------------[ Initial Setup ]------------------------------<
initializer 'generators.rb', <<-RUBY
Rails.application.config.generators do |g|
end
RUBY
@recipes = ["jquery", "haml", "rspec", "cucumber", "guard", "mongoid", "action_mailer", "devise", "add_user", "home_page", "home_page_users", "seed_database", "users_page", "css_setup", "application_layout", "html5", "navigation", "cleanup", "ban_spiders", "extras", "git"]
def recipes; @recipes end
def recipe?(name); @recipes.include?(name) end
def say_custom(tag, text); say "\033[1m\033[36m" + tag.to_s.rjust(10) + "\033[0m" + " #{text}" end
def say_recipe(name); say "\033[1m\033[36m" + "recipe".rjust(10) + "\033[0m" + " Running #{name} recipe..." end
def say_wizard(text); say_custom(@current_recipe || 'wizard', text) end
def ask_wizard(question)
ask "\033[1m\033[30m\033[46m" + (@current_recipe || "prompt").rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
end
def yes_wizard?(question)
answer = ask_wizard(question + " \033[33m(y/n)\033[0m")
case answer.downcase
when "yes", "y"
true
when "no", "n"
false
else
yes_wizard?(question)
end
end
def no_wizard?(question); !yes_wizard?(question) end
def multiple_choice(question, choices)
say_custom('question', question)
values = {}
choices.each_with_index do |choice,i|
values[(i + 1).to_s] = choice[1]
say_custom (i + 1).to_s + ')', choice[0]
end
answer = ask_wizard("Enter your selection:") while !values.keys.include?(answer)
values[answer]
end
@current_recipe = nil
@configs = {}
@after_blocks = []
def after_bundler(&block); @after_blocks << [@current_recipe, block]; end
@after_everything_blocks = []
def after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end
@before_configs = {}
def before_config(&block); @before_configs[@current_recipe] = block; end
case Rails::VERSION::MAJOR.to_s
when "3"
case Rails::VERSION::MINOR.to_s
when "1"
say_wizard "You are using Rails version #{Rails::VERSION::STRING}."
@recipes << 'rails 3.1'
when "0"
say_wizard "You are using Rails version #{Rails::VERSION::STRING}."
@recipes << 'rails 3.0'
else
say_wizard "You are using Rails version #{Rails::VERSION::STRING} which is not supported."
end
else
say_wizard "You are using Rails version #{Rails::VERSION::STRING} which is not supported."
end
# show which version of rake is running
# with the added benefit of ensuring that the Gemfile's version of rake is activated
gemfile_rake_ver = run 'bundle exec rake --version', :capture => true, :verbose => false
say_wizard "You are using #{gemfile_rake_ver.strip}"
say_wizard "Checking configuration. Please confirm your preferences."
# >---------------------------[ Javascript Runtime ]-----------------------------<
prepend_file 'Gemfile' do <<-RUBY
require 'rbconfig'
HOST_OS = RbConfig::CONFIG['host_os']
RUBY
end
if recipes.include? 'rails 3.1'
append_file 'Gemfile' do <<-RUBY
# install a Javascript runtime for linux
if HOST_OS =~ /linux/i
gem 'therubyracer', '>= 0.8.2'
end
RUBY
end
end
# >---------------------------------[ Recipes ]----------------------------------<
# >--------------------------------[ jQuery ]---------------------------------<
@current_recipe = "jquery"
@before_configs["jquery"].call if @before_configs["jquery"]
say_recipe 'jQuery'
config = {}
config['jquery'] = yes_wizard?("Would you like to use jQuery?") if true && true unless config.key?('jquery')
config['ui'] = yes_wizard?("Would you like to use jQuery UI?") if true && true unless config.key?('ui')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/jquery.rb
if config['jquery']
if recipes.include? 'rails 3.0'
say_wizard "Replacing Prototype framework with jQuery for Rails 3.0."
after_bundler do
say_wizard "jQuery recipe running 'after bundler'"
# remove the Prototype adapter file
remove_file 'public/javascripts/rails.js'
# remove the Prototype files (if they exist)
remove_file 'public/javascripts/controls.js'
remove_file 'public/javascripts/dragdrop.js'
remove_file 'public/javascripts/effects.js'
remove_file 'public/javascripts/prototype.js'
# add jQuery files
inside "public/javascripts" do
get "https://raw.github.com/rails/jquery-ujs/master/src/rails.js", "rails.js"
get "http://code.jquery.com/jquery-1.6.min.js", "jquery.js"
if config['ui']
get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "jqueryui.js"
end
end
# adjust the Javascript defaults
# first uncomment "config.action_view.javascript_expansions"
gsub_file "config/application.rb", /# config.action_view.javascript_expansions/, "config.action_view.javascript_expansions"
# then add "jquery rails" if necessary
gsub_file "config/application.rb", /= \%w\(\)/, "= %w(jquery rails)"
# finally change to "jquery jqueryui rails" if necessary
if config['ui']
gsub_file "config/application.rb", /jquery rails/, "jquery jqueryui rails"
end
end
elsif recipes.include? 'rails 3.1'
if config['ui']
inside "app/assets/javascripts" do
get "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "jqueryui.js"
end
else
say_wizard "jQuery installed by default in Rails 3.1."
end
else
say_wizard "Don't know what to do for Rails version #{Rails::VERSION::STRING}. jQuery recipe skipped."
end
else
if config['ui']
say_wizard "You said you didn't want jQuery. Can't install jQuery UI without jQuery."
end
recipes.delete('jquery')
end
# >---------------------------------[ HAML ]----------------------------------<
@current_recipe = "haml"
@before_configs["haml"].call if @before_configs["haml"]
say_recipe 'HAML'
config = {}
config['haml'] = yes_wizard?("Would you like to use Haml instead of ERB?") if true && true unless config.key?('haml')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/haml.rb
if config['haml']
if recipes.include? 'rails 3.0'
# for Rails 3.0, use only gem versions we know that work
gem 'haml', '3.1.1'
gem 'haml-rails', '0.3.4', :group => :development
else
# for Rails 3.1+, use optimistic versioning for gems
gem 'haml', '>= 3.1.2'
gem 'haml-rails', '>= 0.3.4', :group => :development
end
else
recipes.delete('haml')
end
# >---------------------------------[ RSpec ]---------------------------------<
@current_recipe = "rspec"
@before_configs["rspec"].call if @before_configs["rspec"]
say_recipe 'RSpec'
config = {}
config['rspec'] = yes_wizard?("Would you like to use RSpec instead of TestUnit?") if true && true unless config.key?('rspec')
config['factory_girl'] = yes_wizard?("Would you like to use factory_girl for test fixtures with RSpec?") if true && true unless config.key?('factory_girl')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rspec.rb
if config['rspec']
if recipes.include? 'rails 3.0'
# for Rails 3.0, use only gem versions we know that work
say_wizard "REMINDER: When creating a Rails app using RSpec..."
say_wizard "you should add the '-T' flag to 'rails new'"
gem 'rspec-rails', '2.6.1', :group => [:development, :test]
if recipes.include? 'mongoid'
# use the database_cleaner gem to reset the test database
gem 'database_cleaner', '0.6.7', :group => :test
# include RSpec matchers from the mongoid-rspec gem
gem 'mongoid-rspec', '1.4.2', :group => :test
end
if config['factory_girl']
# use the factory_girl gem for test fixtures
gem 'factory_girl_rails', '1.1.beta1', :group => :test
end
else
# for Rails 3.1+, use optimistic versioning for gems
gem 'rspec-rails', '>= 2.6.1', :group => [:development, :test]
if recipes.include? 'mongoid'
# use the database_cleaner gem to reset the test database
gem 'database_cleaner', '>= 0.6.7', :group => :test
# include RSpec matchers from the mongoid-rspec gem
gem 'mongoid-rspec', '>= 1.4.4', :group => :test
end
if config['factory_girl']
# use the factory_girl gem for test fixtures
gem 'factory_girl_rails', '>= 1.2.0', :group => :test
end
end
else
recipes.delete('rspec')
end
# note: there is no need to specify the RSpec generator in the config/application.rb file
if config['rspec']
after_bundler do
say_wizard "RSpec recipe running 'after bundler'"
generate 'rspec:install'
say_wizard "Removing test folder (not needed for RSpec)"
run 'rm -rf test/'
inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
# don't generate RSpec tests for views and helpers
config.generators do |g|
g.view_specs false
g.helper_specs false
end
RUBY
end
if recipes.include? 'mongoid'
# remove ActiveRecord artifacts
gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
# reset your application database to a pristine state during testing
inject_into_file 'spec/spec_helper.rb', :before => "\nend" do
<<-RUBY
\n
# Clean up the database
require 'database_cleaner'
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = "mongoid"
end
config.before(:each) do
DatabaseCleaner.clean
end
RUBY
end
# remove either possible occurrence of "require rails/test_unit/railtie"
gsub_file 'config/application.rb', /require 'rails\/test_unit\/railtie'/, '# require "rails/test_unit/railtie"'
gsub_file 'config/application.rb', /require "rails\/test_unit\/railtie"/, '# require "rails/test_unit/railtie"'
# configure RSpec to use matchers from the mongoid-rspec gem
create_file 'spec/support/mongoid.rb' do
<<-RUBY
RSpec.configure do |config|
config.include Mongoid::Matchers
end
RUBY
end
end
if recipes.include? 'devise'
# add Devise test helpers
create_file 'spec/support/devise.rb' do
<<-RUBY
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
end
RUBY
end
end
end
end
# >-------------------------------[ Cucumber ]--------------------------------<
@current_recipe = "cucumber"
@before_configs["cucumber"].call if @before_configs["cucumber"]
say_recipe 'Cucumber'
config = {}
config['cucumber'] = yes_wizard?("Would you like to use Cucumber for your BDD?") if true && true unless config.key?('cucumber')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/cucumber.rb
if config['cucumber']
if recipes.include? 'rails 3.0'
# for Rails 3.0, use only gem versions we know that work
gem 'cucumber-rails', '0.5.1', :group => :test
gem 'capybara', '1.0.0', :group => :test
gem 'database_cleaner', '0.6.7', :group => :test
gem 'launchy', '0.4.0', :group => :test
else
# for Rails 3.1+, use optimistic versioning for gems
gem 'cucumber-rails', '>= 1.1.1', :group => :test
gem 'capybara', '>= 1.1.1', :group => :test
gem 'database_cleaner', '>= 0.6.7', :group => :test
gem 'launchy', '>= 2.0.5', :group => :test
end
else
recipes.delete('cucumber')
end
if config['cucumber']
after_bundler do
say_wizard "Cucumber recipe running 'after bundler'"
generate "cucumber:install --capybara#{' --rspec' if recipes.include?('rspec')}#{' -D' if recipes.include?('mongoid')}"
if recipes.include? 'mongoid'
gsub_file 'features/support/env.rb', /transaction/, "truncation"
inject_into_file 'features/support/env.rb', :after => 'begin' do
"\n DatabaseCleaner.orm = 'mongoid'"
end
end
end
end
if config['cucumber']
if recipes.include? 'devise'
after_bundler do
say_wizard "Copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples"
begin
# copy all the Cucumber scenario files from the rails3-devise-rspec-cucumber example app
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/users/sign_in.feature', 'features/users/sign_in.feature'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/users/sign_out.feature', 'features/users/sign_out.feature'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/users/sign_up.feature', 'features/users/sign_up.feature'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/users/user_edit.feature', 'features/users/user_edit.feature'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/users/user_show.feature', 'features/users/user_show.feature'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/step_definitions/user_steps.rb', 'features/step_definitions/user_steps.rb'
remove_file 'features/support/paths.rb'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/features/support/paths.rb', 'features/support/paths.rb'
rescue OpenURI::HTTPError
say_wizard "Unable to obtain Cucumber example files from the repo"
end
end
end
end
# >---------------------------------[ guard ]---------------------------------<
@current_recipe = "guard"
@before_configs["guard"].call if @before_configs["guard"]
say_recipe 'guard'
config = {}
config['guard'] = yes_wizard?("Would you like to use Guard to automate your workflow?") if true && true unless config.key?('guard')
config['livereload'] = yes_wizard?("Would you like to enable the LiveReload guard?") if true && true unless config.key?('livereload')
@configs[@current_recipe] = config
if config['guard']
gem 'guard', '>= 0.6.2', :group => :development
append_file 'Gemfile' do <<-RUBY
case HOST_OS
when /darwin/i
gem 'rb-fsevent', :group => :development
gem 'growl', :group => :development
when /linux/i
gem 'libnotify', :group => :development
gem 'rb-inotify', :group => :development
when /mswin|windows/i
gem 'rb-fchange', :group => :development
gem 'win32console', :group => :development
gem 'rb-notifu', :group => :development
end
RUBY
end
def guards
@guards ||= []
end
def guard(name, version = nil)
args = []
if version
args << version
end
args << { :group => :development }
gem "guard-#{name}", *args
guards << name
end
guard 'bundler', '>= 0.1.3'
unless recipes.include? 'pow'
guard 'rails', '>= 0.0.3'
end
if config['livereload']
guard 'livereload', '>= 0.3.0'
end
if recipes.include? 'rspec'
guard 'rspec', '>= 0.4.3'
end
if recipes.include? 'cucumber'
guard 'cucumber', '>= 0.6.1'
end
after_bundler do
run 'guard init'
guards.each do |name|
run "guard init #{name}"
end
end
else
recipes.delete 'guard'
end
# >--------------------------------[ Mongoid ]--------------------------------<
@current_recipe = "mongoid"
@before_configs["mongoid"].call if @before_configs["mongoid"]
say_recipe 'Mongoid'
config = {}
config['mongoid'] = yes_wizard?("Would you like to use Mongoid to connect to a MongoDB database?") if true && true unless config.key?('mongoid')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/mongoid.rb
if config['mongoid']
if recipes.include? 'rails 3.0'
# for Rails 3.0, use only gem versions we know that work
say_wizard "REMINDER: When creating a Rails app using Mongoid..."
say_wizard "you should add the '-O' flag to 'rails new'"
gem 'bson_ext', '1.3.1'
gem 'mongoid', '2.0.2'
else
# for Rails 3.1+, use optimistic versioning for gems
gem 'bson_ext', '>= 1.4.0'
gem 'mongoid', '>= 2.3.0'
end
else
recipes.delete('mongoid')
end
if config['mongoid']
after_bundler do
say_wizard "Mongoid recipe running 'after bundler'"
# note: the mongoid generator automatically modifies the config/application.rb file
# to remove the ActiveRecord dependency by commenting out "require active_record/railtie'"
generate 'mongoid:config'
# remove the unnecessary 'config/database.yml' file
remove_file 'config/database.yml'
end
end
# >-----------------------------[ ActionMailer ]------------------------------<
@current_recipe = "action_mailer"
@before_configs["action_mailer"].call if @before_configs["action_mailer"]
say_recipe 'ActionMailer'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/action_mailer.rb
after_bundler do
say_wizard "ActionMailer recipe running 'after bundler'"
# modifying environment configuration files for ActionMailer
gsub_file 'config/environments/development.rb', /# Don't care if the mailer can't send/, '# ActionMailer Config'
gsub_file 'config/environments/development.rb', /config.action_mailer.raise_delivery_errors = false/ do
<<-RUBY
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# A dummy setup for development - no deliveries, but logged
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
RUBY
end
gsub_file 'config/environments/production.rb', /config.active_support.deprecation = :notify/ do
<<-RUBY
config.active_support.deprecation = :notify
config.action_mailer.default_url_options = { :host => 'yourhost.com' }
# ActionMailer Config
# Setup for production - deliveries, no errors raised
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
RUBY
end
end
# >--------------------------------[ Devise ]---------------------------------<
@current_recipe = "devise"
@before_configs["devise"].call if @before_configs["devise"]
say_recipe 'Devise'
config = {}
config['devise'] = yes_wizard?("Would you like to use Devise for authentication?") if true && true unless config.key?('devise')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/devise.rb
if config['devise']
if recipes.include? 'rails 3.0'
# for Rails 3.0, use only gem versions we know that work
gem 'devise', '1.3.4'
else
# for Rails 3.1+, use optimistic versioning for gems
gem 'devise', '>= 1.4.7'
end
else
recipes.delete('devise')
end
if config['devise']
after_bundler do
say_wizard "Devise recipe running 'after bundler'"
# Run the Devise generator
generate 'devise:install'
if recipes.include? 'mongo_mapper'
gem 'mm-devise'
gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
generate 'mongo_mapper:devise User'
elsif recipes.include? 'mongoid'
# Nothing to do (Devise changes its initializer automatically when Mongoid is detected)
# gsub_file 'config/initializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
end
# Prevent logging of password_confirmation
gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
if recipes.include? 'cucumber'
# Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path
# (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)
gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'
end
end
after_everything do
say_wizard "Devise recipe running 'after everything'"
if recipes.include? 'rspec'
say_wizard "Copying RSpec files from the rails3-devise-rspec-cucumber examples"
begin
# copy all the RSpec specs files from the rails3-devise-rspec-cucumber example app
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/factories.rb', 'spec/factories.rb'
remove_file 'spec/controllers/home_controller_spec.rb'
remove_file 'spec/controllers/users_controller_spec.rb'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/controllers/home_controller_spec.rb', 'spec/controllers/home_controller_spec.rb'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/controllers/users_controller_spec.rb', 'spec/controllers/users_controller_spec.rb'
remove_file 'spec/models/user_spec.rb'
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/models/user_spec.rb', 'spec/models/user_spec.rb'
rescue OpenURI::HTTPError
say_wizard "Unable to obtain RSpec example files from the repo"
end
remove_file 'spec/views/home/index.html.erb_spec.rb'
remove_file 'spec/views/home/index.html.haml_spec.rb'
remove_file 'spec/views/users/show.html.erb_spec.rb'
remove_file 'spec/views/users/show.html.haml_spec.rb'
remove_file 'spec/helpers/home_helper_spec.rb'
remove_file 'spec/helpers/users_helper_spec.rb'
end
end
end
# >--------------------------------[ AddUser ]--------------------------------<
@current_recipe = "add_user"
@before_configs["add_user"].call if @before_configs["add_user"]
say_recipe 'AddUser'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/add_user.rb
after_bundler do
say_wizard "AddUser recipe running 'after bundler'"
if recipes.include? 'omniauth'
generate(:model, "user provider:string uid:string name:string email:string")
gsub_file 'app/models/user.rb', /end/ do
<<-RUBY
attr_accessible :provider, :uid, :name, :email
end
RUBY
end
end
if recipes.include? 'devise'
# Generate models and routes for a User
generate 'devise user'
# Add a 'name' attribute to the User model
if recipes.include? 'mongoid'
gsub_file 'app/models/user.rb', /end/ do
<<-RUBY
field :name
validates_presence_of :name
validates_uniqueness_of :name, :email, :case_sensitive => false
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
end
RUBY
end
else
# for ActiveRecord
# Devise created a Users database, we'll modify it
generate 'migration AddNameToUsers name:string'
# Devise created a Users model, we'll modify it
gsub_file 'app/models/user.rb', /attr_accessible :email/, 'attr_accessible :name, :email'
inject_into_file 'app/models/user.rb', :before => 'validates_uniqueness_of' do
"validates_presence_of :name\n"
end
gsub_file 'app/models/user.rb', /validates_uniqueness_of :email/, 'validates_uniqueness_of :name, :email'
end
unless recipes.include? 'haml'
# Generate Devise views (unless you are using Haml)
run 'rails generate devise:views'
# Modify Devise views to add 'name'
inject_into_file "app/views/devise/registrations/edit.html.erb", :after => "<%= devise_error_messages! %>\n" do
<<-ERB
<p><%= f.label :name %><br />
<%= f.text_field :name %></p>
ERB
end
inject_into_file "app/views/devise/registrations/new.html.erb", :after => "<%= devise_error_messages! %>\n" do
<<-ERB
<p><%= f.label :name %><br />
<%= f.text_field :name %></p>
ERB
end
else
# copy Haml versions of modified Devise views
inside 'app/views/devise/registrations' do
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/rails3-mongoid-devise/app/views/devise/registrations/edit.html.haml', 'edit.html.haml'
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/rails3-mongoid-devise/app/views/devise/registrations/new.html.haml', 'new.html.haml'
end
end
end
end
# >-------------------------------[ HomePage ]--------------------------------<
@current_recipe = "home_page"
@before_configs["home_page"].call if @before_configs["home_page"]
say_recipe 'HomePage'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page.rb
after_bundler do
say_wizard "HomePage recipe running 'after bundler'"
# remove the default home page
remove_file 'public/index.html'
# create a home controller and view
generate(:controller, "home index")
# set up a simple home page (with placeholder content)
if recipes.include? 'haml'
remove_file 'app/views/home/index.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file 'app/views/home/index.html.haml' do
<<-'HAML'
%h3 Home
HAML
end
else
remove_file 'app/views/home/index.html.erb'
create_file 'app/views/home/index.html.erb' do
<<-ERB
<h3>Home</h3>
ERB
end
end
# set routes
gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
end
# >-----------------------------[ HomePageUsers ]-----------------------------<
@current_recipe = "home_page_users"
@before_configs["home_page_users"].call if @before_configs["home_page_users"]
say_recipe 'HomePageUsers'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page_users.rb
after_bundler do
say_wizard "HomePageUsers recipe running 'after bundler'"
# Modify the home controller
gsub_file 'app/controllers/home_controller.rb', /def index/ do
<<-RUBY
def index
@users = User.all
RUBY
end
# Replace the home page
if recipes.include? 'haml'
remove_file 'app/views/home/index.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file 'app/views/home/index.html.haml' do
<<-'HAML'
%h3 Home
- @users.each do |user|
%p User: #{user.name}
HAML
end
else
append_file 'app/views/home/index.html.erb' do <<-ERB
<h3>Home</h3>
<% @users.each do |user| %>
<p>User: <%= user.name %></p>
<% end %>
ERB
end
end
end
# >-----------------------------[ SeedDatabase ]------------------------------<
@current_recipe = "seed_database"
@before_configs["seed_database"].call if @before_configs["seed_database"]
say_recipe 'SeedDatabase'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/seed_database.rb
after_bundler do
say_wizard "SeedDatabase recipe running 'after bundler'"
unless recipes.include? 'mongoid'
run 'bundle exec rake db:migrate'
end
if recipes.include? 'mongoid'
append_file 'db/seeds.rb' do <<-FILE
puts 'EMPTY THE MONGODB DATABASE'
Mongoid.master.collections.reject { |c| c.name =~ /^system/}.each(&:drop)
FILE
end
end
if recipes.include? 'devise'
# create a default user
append_file 'db/seeds.rb' do <<-FILE
puts 'SETTING UP DEFAULT USER LOGIN'
user = User.create! :name => 'First User', :email => '[email protected]', :password => 'please', :password_confirmation => 'please'
puts 'New user created: ' << user.name
FILE
end
end
run 'bundle exec rake db:seed'
end
# >-------------------------------[ UsersPage ]-------------------------------<
@current_recipe = "users_page"
@before_configs["users_page"].call if @before_configs["users_page"]
say_recipe 'UsersPage'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/users_page.rb
after_bundler do
say_wizard "UsersPage recipe running 'after bundler'"
#----------------------------------------------------------------------------
# Create a users controller
#----------------------------------------------------------------------------
generate(:controller, "users show")
gsub_file 'app/controllers/users_controller.rb', /def show/ do
<<-RUBY
before_filter :authenticate_user!
def show
@user = User.find(params[:id])
RUBY
end
#----------------------------------------------------------------------------
# Modify the routes
#----------------------------------------------------------------------------
# @devise_for :users@ route must be placed above @resources :users, :only => :show@.
gsub_file 'config/routes.rb', /get \"users\/show\"/, '#get \"users\/show\"'
gsub_file 'config/routes.rb', /devise_for :users/ do
<<-RUBY
devise_for :users
resources :users, :only => :show
RUBY
end
#----------------------------------------------------------------------------
# Create a users show page
#----------------------------------------------------------------------------
if recipes.include? 'haml'
remove_file 'app/views/users/show.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file 'app/views/users/show.html.haml' do <<-'HAML'
%p
User: #{@user.name}
%p
Email: #{@user.email if @user.email}
HAML
end
else
append_file 'app/views/users/show.html.erb' do <<-ERB
<p>User: <%= @user.name %></p>
<p>Email: <%= @user.email if @user.email %></p>
ERB
end
end
#----------------------------------------------------------------------------
# Create a home page containing links to user show pages
# (clobbers code from the home_page_users recipe)
#----------------------------------------------------------------------------
# set up the controller
remove_file 'app/controllers/home_controller.rb'
create_file 'app/controllers/home_controller.rb' do
<<-RUBY
class HomeController < ApplicationController
def index
@users = User.all
end
end
RUBY
end
# modify the home page
if recipes.include? 'haml'
remove_file 'app/views/home/index.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file 'app/views/home/index.html.haml' do
<<-'HAML'
%h3 Home
- @users.each do |user|
%p User: #{link_to user.name, user}
HAML
end
else
remove_file 'app/views/home/index.html.erb'
create_file 'app/views/home/index.html.erb' do <<-ERB
<h3>Home</h3>
<% @users.each do |user| %>
<p>User: <%=link_to user.name, user %></p>
<% end %>
ERB
end
end
end
# >-------------------------------[ CssSetup ]--------------------------------<
@current_recipe = "css_setup"
@before_configs["css_setup"].call if @before_configs["css_setup"]
say_recipe 'CssSetup'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/css_setup.rb
after_bundler do
say_wizard "CssSetup recipe running 'after bundler'"
# Add a stylesheet with styles for a horizontal menu and flash messages
css = <<-CSS
ul.hmenu {
list-style: none;
margin: 0 0 2em;
padding: 0;
}
ul.hmenu li {
display: inline;
}
#flash_notice, #flash_alert {
padding: 5px 8px;
margin: 10px 0;
}
#flash_notice {
background-color: #CFC;
border: solid 1px #6C6;
}
#flash_alert {
background-color: #FCC;
border: solid 1px #C66;
}
CSS
# Add a stylesheet for use with HTML5 Boilerplate
css_boilerplate = <<-CSS
header nav ul {
list-style: none;
margin: 0 0 2em;
padding: 0;
}
header nav ul li {
display: inline;
}
#flash_notice, #flash_alert {
padding: 5px 8px;
margin: 10px 0;
}
#flash_notice {
background-color: #CFC;
border: solid 1px #6C6;
}
#flash_alert {
background-color: #FCC;
border: solid 1px #C66;
}
CSS
if recipes.include? 'rails 3.0'
create_file 'public/stylesheets/application.css', css
else
if recipes.include? 'html5'
append_file 'app/assets/stylesheets/application.css', css_boilerplate
else
append_file 'app/assets/stylesheets/application.css', css
end
end
end
# >---------------------------[ ApplicationLayout ]---------------------------<
@current_recipe = "application_layout"
@before_configs["application_layout"].call if @before_configs["application_layout"]
say_recipe 'ApplicationLayout'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/application_layout.rb
after_bundler do
say_wizard "ApplicationLayout recipe running 'after bundler'"
# Set up the default application layout
if recipes.include? 'haml'
remove_file 'app/views/layouts/application.html.erb'
remove_file 'app/views/layouts/application.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
create_file 'app/views/layouts/application.html.haml' do <<-HAML
!!! 5
%html
%head
%title #{app_name}
= stylesheet_link_tag :application
= javascript_include_tag :application
= csrf_meta_tags
%body
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String)
= yield
HAML
end
if recipes.include? 'rails 3.0'
gsub_file 'app/views/layouts/application.html.haml', /stylesheet_link_tag :application/, 'stylesheet_link_tag :all'
gsub_file 'app/views/layouts/application.html.haml', /javascript_include_tag :application/, 'javascript_include_tag :defaults'
gsub_file 'app/views/layouts/application.html.haml', /csrf_meta_tags/, 'csrf_meta_tag'
end
else
unless recipes.include? 'html5'
inject_into_file 'app/views/layouts/application.html.erb', :after => "<body>\n" do
<<-ERB
<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String) %>
<%- end -%>
ERB
end
end
end
end
# >---------------------------------[ html5 ]---------------------------------<
@current_recipe = "html5"
@before_configs["html5"].call if @before_configs["html5"]
say_recipe 'html5'
config = {}
config['html5'] = yes_wizard?("Would you like to install HTML5 Boilerplate?") if true && true unless config.key?('html5')
config['css_option'] = multiple_choice("If you've chosen HTML5 Boilerplate, how do you like your CSS?", [["Do nothing", "nothing"], ["Normalize CSS and add Skeleton styling", "skeleton"], ["Normalize CSS for consistent styling across browsers", "normalize"], ["Completely reset all CSS to eliminate styling", "reset"]]) if true && true unless config.key?('css_option')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/html5.rb
if config['html5']
if recipes.include? 'rails 3.1'
gem 'frontend-helpers'
after_bundler do
say_wizard "HTML5 Boilerplate recipe running 'after bundler'"
# Download HTML5 Boilerplate JavaScripts
get "https://raw.github.com/paulirish/html5-boilerplate/master/js/libs/modernizr-2.0.6.min.js", "app/assets/javascripts/modernizr.js"
# Download stylesheet to normalize or reset CSS
case config['css_option']
when 'skeleton'
get "https://raw.github.com/necolas/normalize.css/master/normalize.css", "app/assets/stylesheets/normalize.css.scss"
get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css", "app/assets/stylesheets/base.css.scss"
get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css", "app/assets/stylesheets/layout.css.scss"
get "https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css", "app/assets/stylesheets/skeleton.css.scss"
get "https://raw.github.com/dhgamache/Skeleton/master/javascripts/tabs.js", "app/assets/javascripts/tabs.js"
when 'normalize'
get "https://raw.github.com/necolas/normalize.css/master/normalize.css", "app/assets/stylesheets/normalize.css.scss"
when 'reset'
get "https://raw.github.com/paulirish/html5-boilerplate/master/css/style.css", "app/assets/stylesheets/reset.css.scss"
end
# Download HTML5 Boilerplate Site Root Assets
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-114x114-precomposed.png", "public/apple-touch-icon-114x114-precomposed.png"
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-57x57-precomposed.png", "public/apple-touch-icon-57x57-precomposed.png"
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-72x72-precomposed.png", "public/apple-touch-icon-72x72-precomposed.png"
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon-precomposed.png", "public/apple-touch-icon-precomposed.png"
get "https://raw.github.com/paulirish/html5-boilerplate/master/apple-touch-icon.png", "public/apple-touch-icon.png"
get "https://raw.github.com/paulirish/html5-boilerplate/master/crossdomain.xml", "public/crossdomain.xml"
get "https://raw.github.com/paulirish/html5-boilerplate/master/humans.txt", "public/humans.txt"
# Set up the default application layout
if recipes.include? 'haml'
# create some Haml helpers
# We have to use single-quote-style-heredoc to avoid interpolation.
inject_into_file 'app/controllers/application_controller.rb', :after => "protect_from_forgery\n" do <<-'RUBY'
include FrontendHelpers::Html5Helper
RUBY
end
# Haml version of default application layout
remove_file 'app/views/layouts/application.html.erb'
remove_file 'app/views/layouts/application.html.haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
create_file 'app/views/layouts/application.html.haml' do <<-HAML
- html_tag class: 'no-js' do
%head
%title #{app_name}
%meta{:charset => "utf-8"}
%meta{"http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1"}
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1, maximum-scale=1"}
= stylesheet_link_tag :application
= javascript_include_tag :application
= csrf_meta_tags
%body{:class => params[:controller]}
#container.container
%header
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String)
#main{:role => "main"}
= yield
%footer
HAML
end
else
# ERB version of default application layout
remove_file 'app/views/layouts/application.html.erb'
remove_file 'app/views/layouts/application.html.haml'
create_file 'app/views/layouts/application.html.erb' do <<-ERB
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>#{app_name}</title>
<meta name="description" content="">
<meta name="author" content="">
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body class="<%= params[:controller] %>">
<div id="container" class="container">
<header>
</header>
<div id="main" role="main">
<%= yield %>
</div>
<footer>
</footer>
</div> <!--! end of #container -->
</body>
</html>
ERB
end
inject_into_file 'app/views/layouts/application.html.erb', :after => "<header>\n" do
<<-ERB
<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_\#{name}" if msg.is_a?(String) %>
<%- end -%>
ERB
end
end
end
elsif recipes.include? 'rails 3.0'
say_wizard "Not supported for Rails version #{Rails::VERSION::STRING}. HTML5 Boilerplate recipe skipped."
else
say_wizard "Don't know what to do for Rails version #{Rails::VERSION::STRING}. HTML5 Boilerplate recipe skipped."
end
else
say_wizard "HTML5 Boilerplate recipe skipped. No CSS styles added."
recipes.delete('html5')
end
# >------------------------------[ Navigation ]-------------------------------<
@current_recipe = "navigation"
@before_configs["navigation"].call if @before_configs["navigation"]
say_recipe 'Navigation'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/navigation.rb
after_bundler do
say_wizard "Navigation recipe running 'after bundler'"
if recipes.include? 'devise'
# Create navigation links for Devise
if recipes.include? 'haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file "app/views/shared/_navigation.html.haml" do <<-'HAML'
- if user_signed_in?
%li
= link_to('Logout', destroy_user_session_path, :method=>'delete')
- else
%li
= link_to('Login', new_user_session_path)
- if user_signed_in?
%li
= link_to('Edit account', edit_user_registration_path)
- else
%li
= link_to('Sign up', new_user_registration_path)
HAML
end
else
create_file "app/views/shared/_navigation.html.erb" do <<-ERB
<% if user_signed_in? %>
<li>
<%= link_to('Logout', destroy_user_session_path, :method=>'delete') %>
</li>
<% else %>
<li>
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
<% if user_signed_in? %>
<li>
<%= link_to('Edit account', edit_user_registration_path) %>
</li>
<% else %>
<li>
<%= link_to('Sign up', new_user_registration_path) %>
</li>
<% end %>
ERB
end
end
else
# Create navigation links
if recipes.include? 'haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
# We have to use single-quote-style-heredoc to avoid interpolation.
create_file "app/views/shared/_navigation.html.haml" do <<-'HAML'
- if user_signed_in?
%li
Logged in as #{current_user.name}
%li
= link_to('Logout', signout_path)
- else
%li
= link_to('Login', signin_path)
HAML
end
else
create_file "app/views/shared/_navigation.html.erb" do <<-ERB
<% if user_signed_in? %>
<li>
Logged in as <%= current_user.name %>
</li>
<li>
<%= link_to('Logout', signout_path) %>
</li>
<% else %>
<li>
<%= link_to('Login', signin_path) %>
</li>
<% end %>
ERB
end
end
end
# Add navigation links to the default application layout
if recipes.include? 'html5'
if recipes.include? 'haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
inject_into_file 'app/views/layouts/application.html.haml', :after => "%header\n" do <<-HAML
%nav
%ul.hmenu
= render 'shared/navigation'
HAML
end
else
inject_into_file 'app/views/layouts/application.html.erb', :after => "<header>\n" do <<-ERB
<nav>
<ul class="hmenu">
<%= render 'shared/navigation' %>
</ul>
</nav>
ERB
end
end
else
if recipes.include? 'haml'
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
inject_into_file 'app/views/layouts/application.html.haml', :after => "%body\n" do <<-HAML
%ul.hmenu
= render 'shared/navigation'
HAML
end
else
inject_into_file 'app/views/layouts/application.html.erb', :after => "<body>\n" do
<<-ERB
<ul class="hmenu">
<%= render 'shared/navigation' %>
</ul>
ERB
end
end
end
end
# >--------------------------------[ Cleanup ]--------------------------------<
@current_recipe = "cleanup"
@before_configs["cleanup"].call if @before_configs["cleanup"]
say_recipe 'Cleanup'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/cleanup.rb
after_bundler do
say_wizard "Cleanup recipe running 'after bundler'"
# remove unnecessary files
%w{
README
doc/README_FOR_APP
public/index.html
}.each { |file| remove_file file }
if recipes.include? 'rails 3.0'
%w{
public/images/rails.png
}.each { |file| remove_file file }
else
%w{
app/assets/images/rails.png
}.each { |file| remove_file file }
end
# add placeholder READMEs
get "https://raw.github.com/RailsApps/rails3-application-templates/master/files/sample_readme.txt", "README"
get "https://raw.github.com/RailsApps/rails3-application-templates/master/files/sample_readme.textile", "README.textile"
gsub_file "README", /App_Name/, "#{app_name.humanize.titleize}"
gsub_file "README.textile", /App_Name/, "#{app_name.humanize.titleize}"
# remove commented lines from Gemfile
# thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
gsub_file "Gemfile", /#.*\n/, "\n"
gsub_file "Gemfile", /\n+/, "\n"
end
# >------------------------------[ BanSpiders ]-------------------------------<
@current_recipe = "ban_spiders"
@before_configs["ban_spiders"].call if @before_configs["ban_spiders"]
say_recipe 'BanSpiders'
config = {}
config['ban_spiders'] = yes_wizard?("Would you like to set a robots.txt file to ban spiders?") if true && true unless config.key?('ban_spiders')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/ban_spiders.rb
if config['ban_spiders']
say_wizard "BanSpiders recipe running 'after bundler'"
after_bundler do
# ban spiders from your site by changing robots.txt
gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
end
else
recipes.delete('ban_spiders')
end
# >--------------------------------[ Extras ]---------------------------------<
@current_recipe = "extras"
@before_configs["extras"].call if @before_configs["extras"]
say_recipe 'Extras'
config = {}
config['footnotes'] = yes_wizard?("Would you like to use 'rails-footnotes' during development?") if true && true unless config.key?('footnotes')
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb
if config['footnotes']
say_wizard "Extras recipe running 'after bundler'"
gem 'rails-footnotes', '>= 3.7', :group => :development
else
recipes.delete('footnotes')
end
# >----------------------------------[ Git ]----------------------------------<
@current_recipe = "git"
@before_configs["git"].call if @before_configs["git"]
say_recipe 'Git'
@configs[@current_recipe] = config
# Application template recipe for the rails_apps_composer. Check for a newer version here:
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb
after_everything do
say_wizard "Git recipe running 'after everything'"
# Git should ignore some files
remove_file '.gitignore'
get "https://raw.github.com/RailsApps/rails3-application-templates/master/files/gitignore.txt", ".gitignore"
if recipes.include? 'omniauth'
append_file '.gitignore' do <<-TXT
# keep OmniAuth service provider secrets out of the Git repo
config/initializers/omniauth.rb
TXT
end
end
# Initialize new Git repo
git :init
git :add => '.'
git :commit => "-aqm 'new Rails app generated by Rails Apps Composer gem'"
# Create a git branch
git :checkout => ' -b working_branch'
git :add => '.'
git :commit => "-m 'Initial commit of working_branch'"
git :checkout => 'master'
end
@current_recipe = nil
# >-----------------------------[ Run Bundler ]-------------------------------<
say_wizard "Running 'bundle install'. This will take a while."
run 'bundle install --path=vendor/bundle'
say_wizard "Running 'after bundler' callbacks."
require 'bundler/setup'
@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
@current_recipe = nil
say_wizard "Running 'after everything' callbacks."
@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
@current_recipe = nil
say_wizard "Finished running the rails_apps_composer app template."
say_wizard "Your new Rails app is ready."
@marshluca
Copy link
Author

➜ ~ rails new Wiki -m https://raw.github.com/gist/1303515/4f661b5cbc2a6d3ed25e85c78fa8ac4f21eafa83/rails3-mongoid-devise-template.rb -T -O
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create tmp/cache
create tmp/cache/assets
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
apply https://raw.github.com/gist/1303515/4f661b5cbc2a6d3ed25e85c78fa8ac4f21eafa83/rails3-mongoid-devise-template.rb
initializer generators.rb
wizard You are using Rails version 3.1.1.
wizard You are using Could not find gem 'rails (= 3.1.1) ruby' in any of the gem sources listed in your Gemfile.
wizard Checking configuration. Please confirm your preferences.
prepend Gemfile
append Gemfile
recipe Running jQuery recipe...
jquery Would you like to use jQuery? (y/n) y
jquery Would you like to use jQuery UI? (y/n) y
create app/assets/javascripts/jqueryui.js
recipe Running HAML recipe...
haml Would you like to use Haml instead of ERB? (y/n) y
gemfile haml (>= 3.1.2)
gemfile haml-rails (>= 0.3.4)
recipe Running RSpec recipe...
rspec Would you like to use RSpec instead of TestUnit? (y/n) y
rspec Would you like to use factory_girl for test fixtures with RSpec? (y/n) y
gemfile rspec-rails (>= 2.6.1)
gemfile database_cleaner (>= 0.6.7)
gemfile mongoid-rspec (>= 1.4.4)
gemfile factory_girl_rails (>= 1.2.0)
recipe Running Cucumber recipe...
cucumber Would you like to use Cucumber for your BDD? (y/n) y
gemfile cucumber-rails (>= 1.1.1)
gemfile capybara (>= 1.1.1)
gemfile database_cleaner (>= 0.6.7)
gemfile launchy (>= 2.0.5)
recipe Running guard recipe...
guard Would you like to use Guard to automate your workflow? (y/n) y
guard Would you like to enable the LiveReload guard? (y/n) y
gemfile guard (>= 0.6.2)
append Gemfile
gemfile guard-bundler (>= 0.1.3)
gemfile guard-rails (>= 0.0.3)
gemfile guard-livereload (>= 0.3.0)
gemfile guard-rspec (>= 0.4.3)
gemfile guard-cucumber (>= 0.6.1)
recipe Running Mongoid recipe...
mongoid Would you like to use Mongoid to connect to a MongoDB database? (y/n) y
gemfile bson_ext (>= 1.4.0)
gemfile mongoid (>= 2.3.0)
recipe Running ActionMailer recipe...
recipe Running Devise recipe...
devise Would you like to use Devise for authentication? (y/n) y
gemfile devise (>= 1.4.7)
recipe Running AddUser recipe...
recipe Running HomePage recipe...
recipe Running HomePageUsers recipe...
recipe Running SeedDatabase recipe...
recipe Running UsersPage recipe...
recipe Running CssSetup recipe...
recipe Running ApplicationLayout recipe...
recipe Running html5 recipe...
html5 Would you like to install HTML5 Boilerplate? (y/n) y
question If you've chosen HTML5 Boilerplate, how do you like your CSS?
1) Do nothing
2) Normalize CSS and add Skeleton styling
3) Normalize CSS for consistent styling across browsers
4) Completely reset all CSS to eliminate styling
html5 Enter your selection: 2
gemfile frontend-helpers
recipe Running Navigation recipe...
recipe Running Cleanup recipe...
recipe Running BanSpiders recipe...
ban_spiders Would you like to set a robots.txt file to ban spiders? (y/n) y
ban_spiders BanSpiders recipe running 'after bundler'
recipe Running Extras recipe...
extras Would you like to use 'rails-footnotes' during development? (y/n) y
extras Extras recipe running 'after bundler'
gemfile rails-footnotes (>= 3.7)
recipe Running Git recipe...
wizard Running 'bundle install'. This will take a while.
run bundle install --path=vendor/bundle from "."
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Installing multi_json (1.0.3)
Installing activesupport (3.1.1)
Installing builder (3.0.0)
Installing i18n (0.6.0)
Installing activemodel (3.1.1)
Installing erubis (2.7.0)
Installing rack (1.3.5)
Installing rack-cache (1.1)
Installing rack-mount (0.8.3)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.0.3)
Installing actionpack (3.1.1)
Installing mime-types (1.16)
Installing polyglot (0.3.2)
Installing treetop (1.4.10)
Installing mail (2.3.0)
Installing actionmailer (3.1.1)
Installing arel (2.2.1)
Installing tzinfo (0.3.30)
Installing activerecord (3.1.1)
Installing activeresource (3.1.1)
Installing addressable (2.2.6)
Installing bcrypt-ruby (3.0.1) with native extensions
Installing bson (1.4.1)
Installing bson_ext (1.4.1) with native extensions
Using bundler (1.0.21)
Installing nokogiri (1.5.0) with native extensions
Installing ffi (1.0.10) with native extensions
Installing childprocess (0.2.2)
Installing json_pure (1.6.1)
Installing rubyzip (0.9.4)
Installing selenium-webdriver (2.8.0)
Installing xpath (0.1.4)
Installing capybara (1.1.1)
Installing coffee-script-source (1.1.2)
Installing execjs (1.2.9)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.6.1) with native extensions
Installing rdoc (3.11)
Installing thor (0.14.6)
Installing railties (3.1.1)
Installing coffee-rails (3.1.1)
Installing diff-lcs (1.1.3)
Installing gherkin (2.5.4) with native extensions
Installing term-ansicolor (1.0.7)
Installing cucumber (1.1.0)
Installing cucumber-rails (1.1.1)
Installing database_cleaner (0.6.7)
Installing orm_adapter (0.0.5)
Installing warden (1.0.6)
Installing devise (1.4.8)
Installing eventmachine (0.12.10) with native extensions
Installing em-websocket (0.3.2)
Installing factory_girl (2.2.0)
Installing factory_girl_rails (1.3.0)
Installing haml (3.1.3)
Installing haml-rails (0.3.4)
Installing rails (3.1.1)
Installing sass (3.1.10)
Installing sass-rails (3.1.4)
Installing frontend-helpers (0.1.1)
Installing growl (1.0.3)
Installing guard (0.8.7)
Installing guard-bundler (0.1.3)
Installing guard-cucumber (0.7.3)
Installing guard-livereload (0.3.1)
Installing guard-rails (0.0.3)
Installing guard-rspec (0.5.0)
Installing jquery-rails (1.0.16)
Installing launchy (2.0.5)
Installing mongo (1.4.1)
Installing mongoid (2.3.2)
Installing rspec-core (2.7.1)
Installing rspec-expectations (2.7.0)
Installing rspec-mocks (2.7.0)
Installing rspec (2.7.0)
Installing mongoid-rspec (1.4.4)
Installing rails-footnotes (3.7.5)
Installing rb-fsevent (0.4.3.1) with native extensions
Installing rspec-rails (2.7.0)
Installing uglifier (1.0.4)
Your bundle is complete! It was installed into ./vendor/bundle
wizard Running 'after bundler' callbacks.
rspec RSpec recipe running 'after bundler'
generate rspec:install

Mongoid config not found. Create a config file at: config/mongoid.yml
to generate one run: rails generate mongoid:config

  create  .rspec
  create  spec
  create  spec/spec_helper.rb
   rspec  Removing test folder (not needed for RSpec)
     run    rm -rf test/ from "."
  insert    config/application.rb
    gsub    spec/spec_helper.rb
    gsub    spec/spec_helper.rb
  insert    spec/spec_helper.rb
    gsub    config/application.rb
    gsub    config/application.rb
  create    spec/support/mongoid.rb
  create    spec/support/devise.rb
cucumber  Cucumber recipe running 'after bundler'
generate    cucumber:install --capybara --rspec -D

Mongoid config not found. Create a config file at: config/mongoid.yml
to generate one run: rails generate mongoid:config

  create  config/cucumber.yml
  create  script/cucumber
   chmod  script/cucumber
  create  features/step_definitions
  create  features/support
  create  features/support/env.rb
   exist  lib/tasks
  create  lib/tasks/cucumber.rake
    gsub    features/support/env.rb
  insert    features/support/env.rb
cucumber  Copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples
  create    features/users/sign_in.feature
  create    features/users/sign_out.feature
  create    features/users/sign_up.feature
  create    features/users/user_edit.feature
  create    features/users/user_show.feature
  create    features/step_definitions/user_steps.rb
  remove    features/support/paths.rb
  create    features/support/paths.rb
     run    guard init from "."

Writing new Guardfile to /Users/marshluca/Wiki/Guardfile
run guard init bundler from "."
bundler guard added to Guardfile, feel free to edit it
run guard init rails from "."
rails guard added to Guardfile, feel free to edit it
run guard init livereload from "."
livereload guard added to Guardfile, feel free to edit it
run guard init rspec from "."
rspec guard added to Guardfile, feel free to edit it
run guard init cucumber from "."
cucumber guard added to Guardfile, feel free to edit it
mongoid Mongoid recipe running 'after bundler'
generate mongoid:config

Mongoid config not found. Create a config file at: config/mongoid.yml
to generate one run: rails generate mongoid:config

  create  config/mongoid.yml
  remove    config/database.yml

action_mailer ActionMailer recipe running 'after bundler'
gsub config/environments/development.rb
gsub config/environments/development.rb
gsub config/environments/production.rb
devise Devise recipe running 'after bundler'
generate devise:install
create config/initializers/devise.rb
create config/locales/devise.en.yml

Some setup you must do manually if you haven't yet:

  1. Setup default url options for your specific environment. Here is an
    example of development environment:

    config.action_mailer.default_url_options = { :host => 'localhost:3000' }

    This is a required Rails configuration. In production it must be the
    actual host of your application

  2. Ensure you have defined root_url to something in your config/routes.rb.
    For example:

    root :to => "home#index"

  3. Ensure you have flash messages in app/views/layouts/application.html.erb.
    For example:

    <%= notice %>

    <%= alert %>

  4. If you are deploying Rails 3.1 on Heroku, you may want to set:

    config.assets.initialize_on_precompile = false

    On config/application.rb forcing your application to not access the DB
    or load models when precompiling your assets.

    gsub    config/application.rb
    gsub    config/initializers/devise.rb
add_user  AddUser recipe running 'after bundler'
generate    devise user
  invoke  mongoid
  create    app/models/user.rb
  invoke    rspec
  create      spec/models/user_spec.rb
  insert    app/models/user.rb
   route  devise_for :users
    gsub    app/models/user.rb
  create    app/views/devise/registrations/edit.html.haml
  create    app/views/devise/registrations/new.html.haml

home_page HomePage recipe running 'after bundler'
remove public/index.html
generate controller
create app/controllers/home_controller.rb
route get "home/index"
invoke haml
create app/views/home
create app/views/home/index.html.haml
invoke rspec
create spec/controllers/home_controller_spec.rb
invoke helper
create app/helpers/home_helper.rb
invoke rspec
invoke assets
invoke coffee
create app/assets/javascripts/home.js.coffee
invoke scss
create app/assets/stylesheets/home.css.scss
remove app/views/home/index.html.haml
create app/views/home/index.html.haml
gsub config/routes.rb
home_page_users HomePageUsers recipe running 'after bundler'
gsub app/controllers/home_controller.rb
remove app/views/home/index.html.haml
create app/views/home/index.html.haml
seed_database SeedDatabase recipe running 'after bundler'
append db/seeds.rb
append db/seeds.rb
run bundle exec rake db:seed from "."
EMPTY THE MONGODB DATABASE
SETTING UP DEFAULT USER LOGIN
New user created: First User
users_page UsersPage recipe running 'after bundler'
generate controller
create app/controllers/users_controller.rb
route get "users/show"
invoke haml
create app/views/users
create app/views/users/show.html.haml
invoke rspec
create spec/controllers/users_controller_spec.rb
invoke helper
create app/helpers/users_helper.rb
invoke rspec
invoke assets
invoke coffee
create app/assets/javascripts/users.js.coffee
invoke scss
create app/assets/stylesheets/users.css.scss
gsub app/controllers/users_controller.rb
gsub config/routes.rb
gsub config/routes.rb
remove app/views/users/show.html.haml
create app/views/users/show.html.haml
remove app/controllers/home_controller.rb
create app/controllers/home_controller.rb
remove app/views/home/index.html.haml
create app/views/home/index.html.haml
css_setup CssSetup recipe running 'after bundler'
append app/assets/stylesheets/application.css
application_layout ApplicationLayout recipe running 'after bundler'
remove app/views/layouts/application.html.erb
remove app/views/layouts/application.html.haml
create app/views/layouts/application.html.haml
html5 HTML5 Boilerplate recipe running 'after bundler'
create app/assets/javascripts/modernizr.js
create app/assets/stylesheets/normalize.css.scss
create app/assets/stylesheets/base.css.scss
create app/assets/stylesheets/layout.css.scss
create app/assets/stylesheets/skeleton.css.scss
create app/assets/javascripts/tabs.js
create public/apple-touch-icon-114x114-precomposed.png
create public/apple-touch-icon-57x57-precomposed.png
create public/apple-touch-icon-72x72-precomposed.png
create public/apple-touch-icon-precomposed.png
create public/apple-touch-icon.png
create public/crossdomain.xml
create public/humans.txt
insert app/controllers/application_controller.rb
remove app/views/layouts/application.html.erb
remove app/views/layouts/application.html.haml
create app/views/layouts/application.html.haml
navigation Navigation recipe running 'after bundler'
create app/views/shared/_navigation.html.haml
insert app/views/layouts/application.html.haml
cleanup Cleanup recipe running 'after bundler'
remove README
remove doc/README_FOR_APP
remove public/index.html
remove app/assets/images/rails.png
create README
create README.textile
gsub README
gsub README.textile
gsub Gemfile
gsub Gemfile
gsub public/robots.txt
gsub public/robots.txt
wizard Running 'after everything' callbacks.
devise Devise recipe running 'after everything'
devise Copying RSpec files from the rails3-devise-rspec-cucumber examples
create spec/factories.rb
remove spec/controllers/home_controller_spec.rb
remove spec/controllers/users_controller_spec.rb
create spec/controllers/home_controller_spec.rb
create spec/controllers/users_controller_spec.rb
remove spec/models/user_spec.rb
create spec/models/user_spec.rb
remove spec/views/home/index.html.erb_spec.rb
remove spec/views/home/index.html.haml_spec.rb
remove spec/views/users/show.html.erb_spec.rb
remove spec/views/users/show.html.haml_spec.rb
remove spec/helpers/home_helper_spec.rb
remove spec/helpers/users_helper_spec.rb
git Git recipe running 'after everything'
remove .gitignore
create .gitignore
run git init from "."
Initialized empty Git repository in /Users/marshluca/Wiki/.git/
run git add . from "."
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Gemfile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Guardfile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in README.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in README.textile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Rakefile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/application.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/home.js.coffee.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/jqueryui.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/modernizr.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/tabs.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/users.js.coffee.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/application.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/base.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/home.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/layout.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/normalize.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/skeleton.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/users.css.scss.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/controllers/application_controller.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/controllers/home_controller.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/controllers/users_controller.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/helpers/application_helper.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/helpers/home_helper.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/helpers/users_helper.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/models/user.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/devise/registrations/edit.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/devise/registrations/new.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/home/index.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/layouts/application.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/shared/_navigation.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/users/show.html.haml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config.ru.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/application.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/boot.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/cucumber.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environment.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/development.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/production.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/test.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/backtrace_silencers.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/devise.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/generators.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/inflections.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/mime_types.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/secret_token.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/session_store.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/wrap_parameters.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/locales/devise.en.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/locales/en.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/mongoid.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/routes.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in db/seeds.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/step_definitions/user_steps.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/support/env.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/support/paths.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/users/sign_in.feature.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/users/sign_out.feature.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/users/sign_up.feature.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/users/user_edit.feature.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in features/users/user_show.feature.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in lib/tasks/cucumber.rake.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/404.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/422.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/500.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/crossdomain.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/humans.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/robots.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in script/cucumber.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in script/rails.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/controllers/home_controller_spec.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/controllers/users_controller_spec.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/factories.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/models/user_spec.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/spec_helper.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/support/devise.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spec/support/mongoid.rb.
The file will have its original line endings in your working directory.
run git commit -aqm 'new Rails app generated by Rails Apps Composer gem' from "."
run git checkout -b working_branch from "."
Switched to a new branch 'working_branch'
run git add . from "."
run git commit -m 'Initial commit of working_branch' from "."

On branch working_branch

nothing to commit (working directory clean)
run git checkout master from "."
Switched to branch 'master'
wizard Finished running the rails_apps_composer app template.
wizard Your new Rails app is ready.
run bundle install
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.1)
Using erubis (2.7.0)
Using rack (1.3.5)
Using rack-cache (1.1)
Using rack-mount (0.8.3)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.3)
Using actionpack (3.1.1)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.1.1)
Using arel (2.2.1)
Using tzinfo (0.3.30)
Using activerecord (3.1.1)
Using activeresource (3.1.1)
Using addressable (2.2.6)
Using bcrypt-ruby (3.0.1)
Using bson (1.4.1)
Using bson_ext (1.4.1)
Using bundler (1.0.21)
Using nokogiri (1.5.0)
Using ffi (1.0.10)
Using childprocess (0.2.2)
Using json_pure (1.6.1)
Using rubyzip (0.9.4)
Using selenium-webdriver (2.8.0)
Using xpath (0.1.4)
Using capybara (1.1.1)
Using coffee-script-source (1.1.2)
Using execjs (1.2.9)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.1)
Using rdoc (3.11)
Using thor (0.14.6)
Using railties (3.1.1)
Using coffee-rails (3.1.1)
Using diff-lcs (1.1.3)
Using gherkin (2.5.4)
Using term-ansicolor (1.0.7)
Using cucumber (1.1.0)
Using cucumber-rails (1.1.1)
Using database_cleaner (0.6.7)
Using orm_adapter (0.0.5)
Using warden (1.0.6)
Using devise (1.4.8)
Using eventmachine (0.12.10)
Using em-websocket (0.3.2)
Using factory_girl (2.2.0)
Using factory_girl_rails (1.3.0)
Using haml (3.1.3)
Using haml-rails (0.3.4)
Using rails (3.1.1)
Using sass (3.1.10)
Using sass-rails (3.1.4)
Using frontend-helpers (0.1.1)
Using growl (1.0.3)
Using guard (0.8.7)
Using guard-bundler (0.1.3)
Using guard-cucumber (0.7.3)
Using guard-livereload (0.3.1)
Using guard-rails (0.0.3)
Using guard-rspec (0.5.0)
Using jquery-rails (1.0.16)
Using launchy (2.0.5)
Using mongo (1.4.1)
Using mongoid (2.3.2)
Using rspec-core (2.7.1)
Using rspec-expectations (2.7.0)
Using rspec-mocks (2.7.0)
Using rspec (2.7.0)
Using mongoid-rspec (1.4.4)
Using rails-footnotes (3.7.5)
Using rb-fsevent (0.4.3.1)
Using rspec-rails (2.7.0)
Using uglifier (1.0.4)
Your bundle is complete! It was installed into ./vendor/bundle

@marshluca
Copy link
Author

fixed the issue in production: RoutingError (No route matches [GET] "/assets/rails.png") in production

edit config/environments/production.rb

config.assets.compile = true

bundle exec rake assets:precompile
bundle exec rails s -e production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment