Permalink
Browse files

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.
  • Loading branch information...
1 parent db28d40 commit fc3a39b599fbbed86a153b9742258db020eefa3c @josh josh committed Mar 31, 2010
@@ -31,6 +31,9 @@ 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_activerecord, :type => :boolean, :aliases => "-O", :default => false,
:desc => "Skip ActiveRecord files"
@@ -71,7 +74,7 @@ def create_root_files
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
@@ -11,9 +11,11 @@
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.
@@ -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 @@
require 'bundler'
Bundler.setup
end
+<% end -%>

5 comments on commit fc3a39b

hmm, seems like --use-rubygems might be more appropriate in this case, as you're not just skipping bundler...

What else is skipped?

yfeldblum, nothing else is skipped, but you're adding rubygems as well, which the option doesn't hint at.

So I think --use-rubygems would be a better option, or at the least, change the current options description to be "Skip Bundler configurations and use rubygems for managing dependencies"

Member

josh replied Mar 31, 2010

Bundler uses rubygems too. But using bundler means you have to use a Gemfile. It also neuters rubygems to enforce this.

Its more like saying use traditional rubygem loading, maybe. The whole idea was to give you a clear bundler free blankslate to add an alternative pkg manager.

Other options include "--skip-activerecord", and "--skip-prototoype". "--skip-bundler" brings parity to those options. Though most the time you mean "--use-datamapper" or "--use-jquery".

Contributor

rubys replied Apr 2, 2010

In order to support "edge rails", it would be helpful if vendor rails support were restored, perhaps only if --skip-bundler was specified. Something along the following lines:

http://github.com/rubys/gorp/blob/master/lib/gorp/rails.env

Please sign in to comment.