diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-17 20:02:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-17 20:35:09 -0300 |
commit | 10565895805887d4faf004a6f71219da177f78b7 (patch) | |
tree | 1a6f76bbc2dd3e897f45b118bb8212a7e9d14054 /railties/lib | |
parent | 43262ea882e7ae6fe2b1baa9eb8de395dc881a8c (diff) | |
download | rails-10565895805887d4faf004a6f71219da177f78b7.tar.gz rails-10565895805887d4faf004a6f71219da177f78b7.tar.bz2 rails-10565895805887d4faf004a6f71219da177f78b7.zip |
Add a generic --skip-gems options to generator
Also remove --skip-turbolinks.
This option is useful if users want to remove some gems like jbuilder,
turbolinks, coffee-rails, etc that don't have specific options on the
generator.
rails new my_app --skip-gems turbolinks coffee-rails
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 3f253e3d3e..12f3767424 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -41,6 +41,9 @@ module Rails class_option :skip_active_record, type: :boolean, aliases: '-O', default: false, desc: 'Skip Active Record files' + class_option :skip_gems, type: :array, default: [], + desc: 'Skip the provided gems files' + class_option :skip_action_view, type: :boolean, aliases: '-V', default: false, desc: 'Skip Action View files' @@ -50,9 +53,6 @@ module Rails class_option :skip_spring, type: :boolean, default: false, desc: "Don't install Spring application preloader" - class_option :skip_turbolinks, type: :boolean, default: false, - desc: "Don't install Turbolinks" - class_option :database, type: :string, aliases: '-d', default: 'sqlite3', desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})" @@ -82,7 +82,7 @@ module Rails end def initialize(*args) - @gem_filter = lambda { |gem| true } + @gem_filter = lambda { |gem| !options[:skip_gems].include?(gem.name) } @extra_entries = [] super convert_database_option_for_jruby @@ -290,10 +290,8 @@ module Rails gems << GemfileEntry.version("#{options[:javascript]}-rails", nil, "Use #{options[:javascript]} as the JavaScript library") - unless options[:skip_turbolinks] - gems << GemfileEntry.version("turbolinks", nil, - "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks") - end + gems << GemfileEntry.version("turbolinks", nil, + "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks") gems end end |