diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-04-02 14:57:30 +0430 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2010-04-02 14:57:30 +0430 |
commit | 0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7 (patch) | |
tree | a3a540e38b1e5f6b36f261ae9b2f0116d1f6e39a /railties/lib/rails/generators | |
parent | 13e3f9c0ce83900d3d5647899a4cff443689c266 (diff) | |
parent | 3adaef8ae73a3061a9fe4c5e0256d80bc09b1cf4 (diff) | |
download | rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.tar.gz rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.tar.bz2 rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'railties/lib/rails/generators')
3 files changed, 16 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index fccae9190a..fbad3c9ef1 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -31,6 +31,9 @@ module Rails::Generators class_option :edge, :type => :boolean, :default => false, :desc => "Setup the application with Gemfile pointing to Rails repository" + class_option :skip_gemfile, :type => :boolean, :default => false, + :desc => "Don't create a Gemfile" + class_option :skip_activerecord, :type => :boolean, :aliases => "-O", :default => false, :desc => "Skip ActiveRecord files" @@ -71,7 +74,7 @@ module Rails::Generators copy_file "gitignore", ".gitignore" unless options[:skip_git] template "Rakefile" template "config.ru" - template "Gemfile" + template "Gemfile" unless options[:skip_gemfile] end def create_app_files diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index dc20ffb2fa..bd4fedcdec 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -11,8 +11,9 @@ require "active_resource/railtie" require "rails/test_unit/railtie" <% end -%> -# Auto-require default libraries and those for the current Rails environment. -Bundler.require :default, Rails.env +# If you have a Gemfile, require the gems listed there, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) if defined?(Bundler) module <%= app_const_base %> class Application < Rails::Application diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb index 3cb561d41f..3971a07012 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb @@ -1,8 +1,14 @@ -# Use Bundler (preferred) +# Use locked gems if present. begin require File.expand_path('../../.bundle/environment', __FILE__) + rescue LoadError + # Otherwise, use RubyGems. require 'rubygems' - require 'bundler' - Bundler.setup + + # And set up the gems listed in the Gemfile. + if File.exist?(File.expand_path('../../Gemfile', __FILE__)) + require 'bundler' + Bundler.setup + end end |