diff options
Diffstat (limited to 'railties/lib/rails/generators')
6 files changed, 25 insertions, 22 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 998957f313..e8709b2ddd 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -117,15 +117,15 @@ module Rails end def database_gemfile_entry - entry = options[:skip_active_record] ? "" : "gem '#{gem_for_database}'" - if options[:database] == 'mysql' - if options.dev? || options.edge? - entry += ", :git => 'git://github.com/brianmario/mysql2.git'" - else - entry += "\n# gem 'mysql2', :git => 'git://github.com/brianmario/mysql2.git'" - end - end - entry + "\n" + options[:skip_active_record] ? "" : "gem '#{gem_for_database}'\n" + end + + def include_all_railties? + !options[:skip_active_record] && !options[:skip_test_unit] + end + + def comment_if(value) + options[value] ? '#' : '' end def rails_gemfile_entry diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 36bc9e055c..cf317eb21f 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/module/introspection' require 'rails/generators/base' require 'rails/generators/generated_attribute' diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index b046edd5b7..a69efdf29d 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -4,6 +4,7 @@ source 'http://rubygems.org' <%= database_gemfile_entry -%> +<%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) && JRUBY_VERSION < "1.6" -%> # Asset template engines <%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%> gem 'sass' diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/rails/generators/rails/app/templates/README index 9f0f1d0e38..7c36f2356e 100644 --- a/railties/lib/rails/generators/rails/app/templates/README +++ b/railties/lib/rails/generators/rails/app/templates/README @@ -156,6 +156,10 @@ PostgreSQL and SQLite 3. The default directory structure of a generated Ruby on Rails application: |-- app + | |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets | |-- controllers | |-- helpers | |-- mailers @@ -172,9 +176,6 @@ The default directory structure of a generated Ruby on Rails application: | `-- tasks |-- log |-- public - | |-- images - | |-- javascripts - | `-- stylesheets |-- script |-- test | |-- fixtures @@ -188,11 +189,16 @@ The default directory structure of a generated Ruby on Rails application: | |-- sessions | `-- sockets `-- vendor + |-- assets + `-- stylesheets `-- plugins app Holds all the code that's specific to this particular application. +app/assets + Contains subdirectories for images, stylesheets, and JavaScript files. + app/controllers Holds controllers that should be named like weblogs_controller.rb for automated URL mapping. All controllers should descend from @@ -237,8 +243,7 @@ lib the load path. public - The directory available for the web server. Contains subdirectories for - images, stylesheets, and javascripts. Also contains the dispatchers and the + The directory available for the web server. Also contains the dispatchers and the default HTML files. This should be set as the DOCUMENT_ROOT of your web server. 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 3723addf2b..e1946807b0 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -1,14 +1,14 @@ require File.expand_path('../boot', __FILE__) -<% unless options[:skip_active_record] -%> +<% if include_all_railties? -%> require 'rails/all' <% else -%> # Pick the frameworks you want: -# require "active_record/railtie" +<%= comment_if :skip_active_record %> require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" -require "rails/test_unit/railtie" +<%= comment_if :skip_test_unit %> require "rails/test_unit/railtie" <% end -%> # If you have a Gemfile, require the gems listed there, including any gems @@ -50,10 +50,6 @@ module <%= app_const_base %> # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs) <% end -%> -<% if options[:skip_test_unit] -%> - config.generators.test_framework = false -<% end -%> - # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt index 60137ed2bb..32ffbee7a1 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt @@ -3,7 +3,7 @@ # This file contains the settings for ActionController::ParametersWrapper # which will be enabled by default in the upcoming version of Ruby on Rails. -# Enable parameter wrapping for JSON. You can disable this by set :format to empty array. +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActionController::Base.wrap_parameters :format => [:json] # Disable root element in JSON by default. |