Skip to content

Commit

Permalink
To skip bundler, rm Gemfile. Create a Gemfile to use it again.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Mar 31, 2010
1 parent fc3a39b commit b3980af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions railties/lib/rails/generators/rails/app/app_generator.rb
Expand Up @@ -31,8 +31,8 @@ class AppGenerator < Base
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"
Expand Down Expand Up @@ -74,7 +74,7 @@ def create_root_files
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
Expand Down
Expand Up @@ -11,11 +11,10 @@
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.
Expand Down
16 changes: 9 additions & 7 deletions 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 -%>

0 comments on commit b3980af

Please sign in to comment.