diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-31 12:51:59 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-31 13:56:44 -0700 |
commit | b3980af8d114b68a5e859ccea7c286f94189f713 (patch) | |
tree | b16f2f8efbe25063816c4d7d8bceabeef8e1beca /railties/lib/rails | |
parent | fc3a39b599fbbed86a153b9742258db020eefa3c (diff) | |
download | rails-b3980af8d114b68a5e859ccea7c286f94189f713.tar.gz rails-b3980af8d114b68a5e859ccea7c286f94189f713.tar.bz2 rails-b3980af8d114b68a5e859ccea7c286f94189f713.zip |
To skip bundler, `rm Gemfile`. Create a Gemfile to use it again.
Diffstat (limited to 'railties/lib/rails')
3 files changed, 15 insertions, 14 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 0af7f2aa56..fbad3c9ef1 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -31,8 +31,8 @@ module Rails::Generators class_option :edge, :type => :boolean, :default => false, :desc => "Setup the application with Gemfile pointing to Rails repository" - class_option :skip_bundler, :type => :boolean, :default => false, - :desc => "Skip Bundler files" + 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" @@ -74,7 +74,7 @@ module Rails::Generators copy_file "gitignore", ".gitignore" unless options[:skip_git] template "Rakefile" template "config.ru" - template "Gemfile" unless options[:skip_bundler] + 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 a355aac7a6..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,11 +11,10 @@ require "active_resource/railtie" require "rails/test_unit/railtie" <% end -%> -<% unless options[:skip_bundler] -%> -# 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) -<% end -%> module <%= app_const_base %> class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. 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 0c7ae74b0a..809fef02c1 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb @@ -1,12 +1,14 @@ -<% if options[:skip_bundler] -%> -require 'rubygems' -<% else -%> -# 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')) + require 'bundler' + Bundler.setup + end end -<% end -%> |