diff options
Diffstat (limited to 'railties/lib')
8 files changed, 39 insertions, 25 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index cc53009e80..2281b9686c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -175,7 +175,7 @@ module Rails # These parameters will be used by middlewares and engines to configure themselves. # def env_config - @env_config ||= super.merge({ + @app_env_config ||= super.merge({ "action_dispatch.parameter_filter" => config.filter_parameters, "action_dispatch.secret_token" => config.secret_token, "action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions, diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/rails/generators/rails/app/templates/README index 7c36f2356e..3e1c15c81d 100644 --- a/railties/lib/rails/generators/rails/app/templates/README +++ b/railties/lib/rails/generators/rails/app/templates/README @@ -157,9 +157,9 @@ The default directory structure of a generated Ruby on Rails application: |-- app | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets + | | |-- images + | | |-- javascripts + | | `-- stylesheets | |-- controllers | |-- helpers | |-- mailers @@ -173,6 +173,7 @@ The default directory structure of a generated Ruby on Rails application: |-- db |-- doc |-- lib + | |-- assets | `-- tasks |-- log |-- public @@ -184,13 +185,12 @@ The default directory structure of a generated Ruby on Rails application: | |-- performance | `-- unit |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets + | `-- cache + | `-- assets `-- vendor |-- assets - `-- stylesheets + | |-- javascripts + | `-- stylesheets `-- plugins app diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index 6c53d8bebb..1b7f5dee2a 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -214,6 +214,18 @@ task :default => :test public_task :apply_rails_template, :run_bundle + def name + @name ||= begin + # same as ActiveSupport::Inflector#underscore except not replacing '-' + underscored = original_name.dup + underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') + underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2') + underscored.downcase! + + underscored + end + end + protected def app_templates_dir @@ -254,18 +266,6 @@ task :default => :test @original_name ||= File.basename(destination_root) end - def name - @name ||= begin - # same as ActiveSupport::Inflector#underscore except not replacing '-' - underscored = original_name.dup - underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') - underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2') - underscored.downcase! - - underscored - end - end - def camelized @camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize end diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile b/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile index f4efd3af74..8f8ebbbc1d 100644 --- a/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile +++ b/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile @@ -1,4 +1,4 @@ -source "http://rubygems.org" +source "https://rubygems.org" # Declare your gem's dependencies in <%= name %>.gemspec. # Bundler will treat runtime dependencies like base dependencies, and diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index 03a61a035e..353ebe93ed 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -8,6 +8,8 @@ module Rails class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets" class_option :stylesheet_engine, :desc => "Engine for Stylesheets" + class_option :assets, :type => :boolean + class_option :resource_route, :type => :boolean hook_for :scaffold_controller, :required => true diff --git a/railties/lib/rails/generators/test_unit/model/model_generator.rb b/railties/lib/rails/generators/test_unit/model/model_generator.rb index c1dd535dd3..9749a6b133 100644 --- a/railties/lib/rails/generators/test_unit/model/model_generator.rb +++ b/railties/lib/rails/generators/test_unit/model/model_generator.rb @@ -3,6 +3,9 @@ require 'rails/generators/test_unit' module TestUnit module Generators class ModelGenerator < Base + + RESERVED_YAML_KEYWORDS = %w(y yes n no true false on off null) + argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" class_option :fixture, :type => :boolean @@ -19,6 +22,15 @@ module TestUnit template 'fixtures.yml', File.join('test/fixtures', class_path, "#{plural_file_name}.yml") end end + + private + def yaml_key_value(key, value) + if RESERVED_YAML_KEYWORDS.include?(key.downcase) + "'#{key}': #{value}" + else + "#{key}: #{value}" + end + end end end end diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml index 5c8780aa64..2c33766418 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml @@ -3,12 +3,12 @@ <% unless attributes.empty? -%> one: <% attributes.each do |attribute| -%> - <%= attribute.name %>: <%= attribute.default %> + <%= yaml_key_value(attribute.name, attribute.default) %> <% end -%> two: <% attributes.each do |attribute| -%> - <%= attribute.name %>: <%= attribute.default %> + <%= yaml_key_value(attribute.name, attribute.default) %> <% end -%> <% else -%> # This model initially had no columns defined. If you add columns to the diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb index a7fe32b920..0145879c87 100644 --- a/railties/lib/rails/version.rb +++ b/railties/lib/rails/version.rb @@ -2,7 +2,7 @@ module Rails module VERSION #:nodoc: MAJOR = 3 MINOR = 2 - TINY = 9 + TINY = 13 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.') |