# >---------------------------------------------------------------------------< # # _____ _ _ __ ___ _ # | __ \ (_) | \ \ / (_) | | # | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| | # | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` | # | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| | # |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_| # # 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 = <%= resolve_recipes.map(&:key).inspect %> <%= render "helpers" %> 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 ]-----------------------------< @current_recipe = "linux" config = {} config['linux'] = yes_wizard?("Are using a Linux OS such as Ubuntu?") if true && true unless config.key?('linux') @configs[@current_recipe] = config if config['linux'] if recipes.include? 'rails 3.0' # nothing needed else # for Rails 3.1+, install a gem for a Javascript runtime gem 'therubyracer', '>= 0.8.2' end end # >---------------------------------[ Recipes ]----------------------------------< <% resolve_recipes.each do |recipe| %> <%= render 'recipe', recipe.get_binding %> <% end %> <% if custom_code? %># >-----------------------------[ Custom Code ]-------------------------------< <%= custom_code %><% end %> @current_recipe = nil # >-----------------------------[ Run Bundler ]-------------------------------< say_wizard "Running 'bundle install'. This will take a while." run 'bundle install' 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. Any problems?" say_wizard "See http://github.com/RailsApps/rails_apps_composer/issues"