Add --skip-bundler option to rails application generator

NOTE: This does not fix the bundler activation issue. The "bundler"
gem will still be installed and activated when you install rails.
This commit is contained in:
Joshua Peek
2010-03-31 14:11:51 -05:00
parent db28d407f7
commit fc3a39b599
3 changed files with 10 additions and 1 deletions

View File

@@ -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_bundler, :type => :boolean, :default => false,
:desc => "Skip Bundler files"
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_bundler]
end
def create_app_files

View File

@@ -11,9 +11,11 @@ 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
<% end -%>
module <%= app_const_base %>
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.

View File

@@ -1,3 +1,6 @@
<% if options[:skip_bundler] -%>
require 'rubygems'
<% else -%>
# Use Bundler (preferred)
begin
require File.expand_path('../../.bundle/environment', __FILE__)
@@ -6,3 +9,4 @@ rescue LoadError
require 'bundler'
Bundler.setup
end
<% end -%>