Browse files

Merge branch 'master' of git://github.com/rails/rails

  • Loading branch information...
2 parents 4b05de1 + c125116 commit bf7429041e64ee0f347764a4579c8c1d14d5b391 @rizwanreza rizwanreza committed Jun 14, 2010
Showing with 185 additions and 152 deletions.
  1. +2 −0 actionmailer/CHANGELOG
  2. +4 −4 actionmailer/lib/action_mailer/base.rb
  3. +51 −37 actionmailer/lib/action_mailer/test_case.rb
  4. +2 −8 actionmailer/lib/action_mailer/test_helper.rb
  5. +1 −1 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
  6. +1 −1 actionmailer/test/base_test.rb
  7. +2 −0 actionmailer/test/old_base/mail_service_test.rb
  8. +1 −1 actionpack/actionpack.gemspec
  9. +1 −1 actionpack/lib/action_view/base.rb
  10. +1 −1 actionpack/lib/action_view/render/rendering.rb
  11. +2 −0 actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb
  12. +6 −0 actionpack/test/template/render_test.rb
  13. +9 −9 actionpack/test/template/text_helper_test.rb
  14. +5 −5 activerecord/examples/performance.rb
  15. +0 −13 activerecord/lib/active_record/base.rb
  16. +7 −0 activesupport/CHANGELOG
  17. +1 −0 activesupport/lib/active_support/cache/file_store.rb
  18. +21 −54 activesupport/lib/active_support/callbacks.rb
  19. +0 −1 activesupport/lib/active_support/core_ext/hash/except.rb
  20. +1 −1 activesupport/lib/active_support/json/decoding.rb
  21. +18 −3 activesupport/lib/active_support/ordered_hash.rb
  22. +26 −4 activesupport/test/ordered_hash_test.rb
  23. +2 −2 ci/ci_build.rb
  24. +1 −1 railties/lib/rails/generators.rb
  25. 0 railties/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory
  26. +17 −3 railties/lib/rails/ruby_version_check.rb
  27. +1 −0 railties/test/generators/app_generator_test.rb
  28. +2 −2 railties/test/generators/mailer_generator_test.rb
View
2 actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*Rails 3.0.0 [beta 4] (June 8th, 2010)*
+* subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(".subject") [JK]
+
* Changed encoding behaviour of mail, so updated tests in actionmailer and bumped mail version to 2.2.1 [ML]
* Added ability to pass Proc objects to the defaults hash [ML]
View
8 actionmailer/lib/action_mailer/base.rb
@@ -60,21 +60,21 @@ module ActionMailer #:nodoc:
#
# If you want to explicitly render only certain templates, pass a block:
#
- # mail(:to => user.emai) do |format|
+ # mail(:to => user.email) do |format|
# format.text
# format.html
# end
#
# The block syntax is useful if also need to specify information specific to a part:
#
- # mail(:to => user.emai) do |format|
+ # mail(:to => user.email) do |format|
# format.text(:content_transfer_encoding => "base64")
# format.html
# end
#
# Or even to render a special view:
#
- # mail(:to => user.emai) do |format|
+ # mail(:to => user.email) do |format|
# format.text
# format.html { render "some_other_template" }
# end
@@ -657,7 +657,7 @@ def set_content_type(m, user_content_type, class_default)
def default_i18n_subject #:nodoc:
mailer_scope = self.class.mailer_name.gsub('/', '.')
- I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize)
+ I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
end
def collect_responses_and_parts_order(headers) #:nodoc:
View
88 actionmailer/lib/action_mailer/test_case.rb
@@ -8,55 +8,69 @@ def initialize(name)
end
class TestCase < ActiveSupport::TestCase
- include TestHelper
+ module Behavior
+ extend ActiveSupport::Concern
- setup :initialize_test_deliveries
- setup :set_expected_mail
+ include TestHelper
- class << self
- def tests(mailer)
- write_inheritable_attribute(:mailer_class, mailer)
- end
+ module ClassMethods
+ def tests(mailer)
+ write_inheritable_attribute(:mailer_class, mailer)
+ end
- def mailer_class
- if mailer = read_inheritable_attribute(:mailer_class)
- mailer
- else
- tests determine_default_mailer(name)
+ def mailer_class
+ if mailer = read_inheritable_attribute(:mailer_class)
+ mailer
+ else
+ tests determine_default_mailer(name)
+ end
end
- end
- def determine_default_mailer(name)
- name.sub(/Test$/, '').constantize
- rescue NameError => e
- raise NonInferrableMailerError.new(name)
+ def determine_default_mailer(name)
+ name.sub(/Test$/, '').constantize
+ rescue NameError => e
+ raise NonInferrableMailerError.new(name)
+ end
end
- end
- protected
- def initialize_test_deliveries
- ActionMailer::Base.delivery_method = :test
- ActionMailer::Base.perform_deliveries = true
- ActionMailer::Base.deliveries.clear
- end
+ module InstanceMethods
- def set_expected_mail
- @expected = Mail.new
- @expected.content_type ["text", "plain", { "charset" => charset }]
- @expected.mime_version = '1.0'
- end
+ protected
- private
- def charset
- "UTF-8"
- end
+ def initialize_test_deliveries
+ ActionMailer::Base.delivery_method = :test
+ ActionMailer::Base.perform_deliveries = true
+ ActionMailer::Base.deliveries.clear
+ end
+
+ def set_expected_mail
+ @expected = Mail.new
+ @expected.content_type ["text", "plain", { "charset" => charset }]
+ @expected.mime_version = '1.0'
+ end
+
+ private
+
+ def charset
+ "UTF-8"
+ end
+
+ def encode(subject)
+ Mail::Encodings.q_value_encode(subject, charset)
+ end
- def encode(subject)
- Mail::Encodings.q_value_encode(subject, charset)
+ def read_fixture(action)
+ IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
+ end
end
- def read_fixture(action)
- IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
+ included do
+ setup :initialize_test_deliveries
+ setup :set_expected_mail
end
+ end
+
+ include Behavior
+
end
end
View
10 actionmailer/lib/action_mailer/test_helper.rb
@@ -1,5 +1,7 @@
module ActionMailer
module TestHelper
+ extend ActiveSupport::Concern
+
# Asserts that the number of emails sent matches the given number.
#
# def test_emails
@@ -57,11 +59,3 @@ def assert_no_emails(&block)
end
end
end
-
-module Test
- module Unit
- class TestCase
- include ActionMailer::TestHelper
- end
- end
-end
View
2 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
@@ -5,7 +5,7 @@ class <%= class_name %> < ActionMailer::Base
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
- # en.actionmailer.<%= file_name %>.<%= action %>.subject
+ # en.<%= file_name %>.<%= action %>.subject
#
def <%= action %>
@greeting = "Hi"
View
2 actionmailer/test/base_test.rb
@@ -325,7 +325,7 @@ def give_a_greeting
email = BaseMailer.welcome(:subject => nil)
assert_equal "Welcome", email.subject
- I18n.backend.store_translations('en', :actionmailer => {:base_mailer => {:welcome => {:subject => "New Subject!"}}})
+ I18n.backend.store_translations('en', :base_mailer => {:welcome => {:subject => "New Subject!"}})
email = BaseMailer.welcome(:subject => nil)
assert_equal "New Subject!", email.subject
end
View
2 actionmailer/test/old_base/mail_service_test.rb
@@ -1113,6 +1113,8 @@ def test_attr
end
class MethodNamingTest < ActiveSupport::TestCase
+ include ActionMailer::TestHelper
+
class TestMailer < ActionMailer::Base
def send
body 'foo'
View
2 actionpack/actionpack.gemspec
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
s.add_dependency('i18n', '~> 0.4.1')
s.add_dependency('rack', '~> 1.1.0')
s.add_dependency('rack-test', '~> 0.5.4')
- s.add_dependency('rack-mount', '~> 0.6.3')
+ s.add_dependency('rack-mount', '~> 0.6.4')
s.add_dependency('tzinfo', '~> 0.3.16')
s.add_dependency('erubis', '~> 2.6.5')
end
View
2 actionpack/lib/action_view/base.rb
@@ -2,7 +2,7 @@
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/class/attribute'
require 'active_support/core_ext/array/wrap'
-require 'active_support/ordered_options.rb'
+require 'active_support/ordered_options'
module ActionView #:nodoc:
class NonConcattingString < ActiveSupport::SafeBuffer
View
2 actionpack/lib/action_view/render/rendering.rb
@@ -56,7 +56,7 @@ def _render_template(template, layout = nil, options = {}) #:nodoc:
:identifier => template.identifier, :layout => layout.try(:virtual_path)) do
content = template.render(self, locals) { |*name| _layout_for(*name) }
- @_content_for[:layout] = content
+ @_content_for[:layout] = content if layout
content = _render_layout(layout, locals) if layout
content
View
2 actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb
@@ -0,0 +1,2 @@
+<%= render :inline => 'welcome' %>
+<%= yield %>
View
6 actionpack/test/template/render_test.rb
@@ -229,6 +229,12 @@ def test_render_with_layout
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield")
end
+ def test_render_with_layout_which_has_render_inline
+ assert_equal %(welcome\nHello world!\n),
+ @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield_with_render_inline_inside")
+ end
+
+
# TODO: Move to deprecated_tests.rb
def test_render_with_nested_layout_deprecated
assert_deprecated do
View
18 actionpack/test/template/text_helper_test.rb
@@ -40,15 +40,15 @@ def test_simple_format_should_be_html_safe
assert simple_format("<b> test with html tags </b>").html_safe?
end
- def test_simple_format_should_sanitize_unsafe_input
+ def test_simple_format_should_escape_unsafe_input
assert_equal "<p>&lt;b&gt; test with unsafe string &lt;/b&gt;&lt;script&gt;code!&lt;/script&gt;</p>", simple_format("<b> test with unsafe string </b><script>code!</script>")
end
- def test_simple_format_should_not_sanitize_input_if_safe_option
+ def test_simple_format_should_not_escape_input_if_safe_option
assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>", {}, :safe => true)
end
- def test_simple_format_should_not_sanitize_safe_input
+ def test_simple_format_should_not_escape_safe_input
assert_equal "<p><b> test with safe string </b></p>", simple_format("<b> test with safe string </b>".html_safe)
end
@@ -61,16 +61,16 @@ def test_truncate
assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12)
end
- def test_truncate_should_sanitize_unsafe_input
+ def test_truncate_should_escape_unsafe_input
assert_equal "Hello &lt...", truncate("Hello <script>code!</script>World!!", :length => 12)
end
- def test_truncate_should_not_sanitize_input_if_safe_option
+ def test_truncate_should_not_escape_input_if_safe_option
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!", :length => 12, :safe => true)
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!", :length => 12, :safe => true)
end
- def test_truncate_should_not_sanitize_safe_input
+ def test_truncate_should_not_escape_safe_input
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!".html_safe, :length => 12)
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!".html_safe, :length => 12)
end
@@ -138,21 +138,21 @@ def test_highlight
assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
end
- def test_highlight_should_sanitize_unsafe_input
+ def test_highlight_should_escape_unsafe_input
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning&lt;script&gt;code!&lt;/script&gt;",
highlight("This is a beautiful morning<script>code!</script>", "beautiful")
)
end
- def test_highlight_should_not_sanitize_input_if_safe_option
+ def test_highlight_should_not_escape_input_if_safe_option
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
highlight("This is a beautiful morning<script>code!</script>", "beautiful", :safe => true)
)
end
- def test_highlight_should_not_sanitize_safe_input
+ def test_highlight_should_not_escape_safe_input
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
highlight("This is a beautiful morning<script>code!</script>".html_safe, "beautiful")
View
10 activerecord/examples/performance.rb
@@ -1,18 +1,18 @@
#!/usr/bin/env ruby -KU
TIMES = (ENV['N'] || 10000).to_i
-
require 'rubygems'
+
gem 'addressable', '~>2.0'
gem 'faker', '~>0.3.1'
gem 'rbench', '~>0.2.3'
+
require 'addressable/uri'
require 'faker'
require 'rbench'
-__DIR__ = File.dirname(__FILE__)
-$:.unshift "#{__DIR__}/../lib"
-require 'active_record'
+require File.expand_path("../../../load_paths", __FILE__)
+require "active_record"
conn = { :adapter => 'mysql',
:database => 'activerecord_unittest',
@@ -55,7 +55,7 @@ def self.look(exhibits) exhibits.each { |e| e.look } end
def self.feel(exhibits) exhibits.each { |e| e.feel } end
end
-sqlfile = "#{__DIR__}/performance.sql"
+sqlfile = File.expand_path("../performance.sql", __FILE__)
if File.exists?(sqlfile)
mysql_bin = %w[mysql mysql5].select { |bin| `which #{bin}`.length > 0 }
View
13 activerecord/lib/active_record/base.rb
@@ -1068,19 +1068,6 @@ def all_attributes_exists?(attribute_names)
attribute_names.all? { |name| column_methods_hash.include?(name.to_sym) }
end
- def attribute_condition(quoted_column_name, argument)
- case argument
- when nil then "#{quoted_column_name} IS ?"
- when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope then "#{quoted_column_name} IN (?)"
- when Range then if argument.exclude_end?
- "#{quoted_column_name} >= ? AND #{quoted_column_name} < ?"
- else
- "#{quoted_column_name} BETWEEN ? AND ?"
- end
- else "#{quoted_column_name} = ?"
- end
- end
-
protected
# Scope parameters to method calls within the block. Takes a hash of method_name => parameters hash.
# method_name may be <tt>:find</tt> or <tt>:create</tt>. <tt>:find</tt> parameter is <tt>Relation</tt> while
View
7 activesupport/CHANGELOG
@@ -1,3 +1,10 @@
+*Rails 3.0.0 [Release Candidate] (unreleased)*
+
+* ActiveSupport::OrderedHash#merge and #merge! accept a block. #4838 [Paul Mucur, fxn]
+
+* Date#since, #ago, #beginning_of_day, #end_of_day, and #xmlschema honor now the user time zone if set. [Geoff Buesing]
+
+
*Rails 3.0.0 [beta 4] (June 8th, 2010)*
* Extracted String#truncate from TextHelper#truncate [DHH]
View
1 activesupport/lib/active_support/cache/file_store.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/file/atomic'
+require 'active_support/core_ext/string/conversions'
module ActiveSupport
module Cache
View
75 activesupport/lib/active_support/callbacks.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/class/subclasses'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/kernel/singleton_class'
@@ -383,21 +384,12 @@ module ClassMethods
# key. See #define_callbacks for more information.
#
def __define_runner(symbol) #:nodoc:
- send("_update_#{symbol}_superclass_callbacks")
body = send("_#{symbol}_callbacks").compile(nil)
silence_warnings do
undef_method "_run_#{symbol}_callbacks" if method_defined?("_run_#{symbol}_callbacks")
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def _run_#{symbol}_callbacks(key = nil, &blk)
- @_initialized_#{symbol}_callbacks ||= begin
- if self.class.send("_update_#{symbol}_superclass_callbacks")
- self.class.__define_runner(#{symbol.inspect})
- return _run_#{symbol}_callbacks(key, &blk)
- end
- true
- end
-
if key
name = "_run__\#{self.class.name.hash.abs}__#{symbol}__\#{key.hash.abs}__callbacks"
@@ -432,16 +424,15 @@ def __create_keyed_callback(name, kind, object, &blk) #:nodoc:
# CallbackChain.
#
def __update_callbacks(name, filters = [], block = nil) #:nodoc:
- send("_update_#{name}_superclass_callbacks")
-
type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
options = filters.last.is_a?(Hash) ? filters.pop : {}
filters.unshift(block) if block
- chain = send("_#{name}_callbacks")
- yield chain, type, filters, options if block_given?
-
- __define_runner(name)
+ ([self] + self.descendents).each do |target|
+ chain = target.send("_#{name}_callbacks")
+ yield chain, type, filters, options
+ target.__define_runner(name)
+ end
end
# Set callbacks for a previously defined callback.
@@ -471,14 +462,18 @@ def __update_callbacks(name, filters = [], block = nil) #:nodoc:
# is a speed improvement for ActionPack.
#
def set_callback(name, *filter_list, &block)
+ mapped = nil
+
__update_callbacks(name, filter_list, block) do |chain, type, filters, options|
- filters.map! do |filter|
- removed = chain.delete_if {|c| c.matches?(type, filter) }
- send("_removed_#{name}_callbacks").push(*removed)
+ mapped ||= filters.map do |filter|
Callback.new(chain, filter, type, options.dup, self)
end
- options[:prepend] ? chain.unshift(*filters) : chain.push(*filters)
+ filters.each do |filter|
+ chain.delete_if {|c| c.matches?(type, filter) }
+ end
+
+ options[:prepend] ? chain.unshift(*mapped) : chain.push(*mapped)
end
end
@@ -496,7 +491,6 @@ def skip_callback(name, *filter_list, &block)
end
chain.delete(filter)
- send("_removed_#{name}_callbacks") << filter
end
end
end
@@ -505,8 +499,14 @@ def skip_callback(name, *filter_list, &block)
#
def reset_callbacks(symbol)
callbacks = send("_#{symbol}_callbacks")
+
+ self.descendents.each do |target|
+ chain = target.send("_#{symbol}_callbacks")
+ callbacks.each { |c| chain.delete(c) }
+ target.__define_runner(symbol)
+ end
+
callbacks.clear
- send("_removed_#{symbol}_callbacks").concat(callbacks)
__define_runner(symbol)
end
@@ -559,39 +559,6 @@ def define_callbacks(*callbacks)
extlib_inheritable_reader("_#{callback}_callbacks") do
CallbackChain.new(callback, config)
end
-
- extlib_inheritable_reader("_removed_#{callback}_callbacks") do
- []
- end
-
- class_eval <<-METHOD, __FILE__, __LINE__ + 1
- def self._#{callback}_superclass_callbacks
- if superclass.respond_to?(:_#{callback}_callbacks)
- superclass._#{callback}_callbacks + superclass._#{callback}_superclass_callbacks
- else
- []
- end
- end
-
- def self._update_#{callback}_superclass_callbacks
- changed, index = false, 0
-
- callbacks = (_#{callback}_superclass_callbacks -
- _#{callback}_callbacks) - _removed_#{callback}_callbacks
-
- callbacks.each do |callback|
- if new_index = _#{callback}_callbacks.index(callback)
- index = new_index + 1
- else
- changed = true
- _#{callback}_callbacks.insert(index, callback)
- index = index + 1
- end
- end
- changed
- end
- METHOD
-
__define_runner(callback)
end
end
View
1 activesupport/lib/active_support/core_ext/hash/except.rb
@@ -17,7 +17,6 @@ def except(*keys)
# Replaces the hash without the given keys.
def except!(*keys)
- keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
keys.each { |key| delete(key) }
self
end
View
2 activesupport/lib/active_support/json/decoding.rb
@@ -22,7 +22,7 @@ def backend=(name)
if name.is_a?(Module)
@backend = name
else
- require "active_support/json/backends/#{name.to_s.downcase}.rb"
+ require "active_support/json/backends/#{name.to_s.downcase}"
@backend = ActiveSupport::JSON::Backends::const_get(name)
end
@parse_error = @backend::ParseError
View
21 activesupport/lib/active_support/ordered_hash.rb
@@ -23,6 +23,17 @@ def to_yaml(opts = {})
# Hash is ordered in Ruby 1.9!
if RUBY_VERSION < '1.9'
+
+ # In MRI the Hash class is core and written in C. In particular, methods are
+ # programmed with explicit C function calls and polymorphism is not honored.
+ #
+ # For example, []= is crucial in this implementation to maintain the @keys
+ # array but hash.c invokes rb_hash_aset() originally. This prevents method
+ # reuse through inheritance and forces us to reimplement stuff.
+ #
+ # For instance, we cannot use the inherited #merge! because albeit the algorithm
+ # itself would work, our []= is not being called at all by the C code.
+
def initialize(*args, &block)
super
@keys = []
@@ -130,12 +141,16 @@ def shift
end
def merge!(other_hash)
- other_hash.each {|k,v| self[k] = v }
+ if block_given?
+ other_hash.each { |k, v| self[k] = key?(k) ? yield(k, self[k], v) : v }
+ else
+ other_hash.each { |k, v| self[k] = v }
+ end
self
end
- def merge(other_hash)
- dup.merge!(other_hash)
+ def merge(other_hash, &block)
+ dup.merge!(other_hash, &block)
end
# When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
View
30 activesupport/test/ordered_hash_test.rb
@@ -141,18 +141,40 @@ def test_merge
merged = @ordered_hash.merge other_hash
assert_equal merged.length, @ordered_hash.length + other_hash.length
assert_equal @keys + ['purple', 'violet'], merged.keys
+ end
+
+ def test_merge_with_block
+ hash = ActiveSupport::OrderedHash.new
+ hash[:a] = 0
+ hash[:b] = 0
+ merged = hash.merge(:b => 2, :c => 7) do |key, old_value, new_value|
+ new_value + 1
+ end
+
+ assert_equal 0, merged[:a]
+ assert_equal 3, merged[:b]
+ assert_equal 7, merged[:c]
+ end
+
+ def test_merge_bang_with_block
+ hash = ActiveSupport::OrderedHash.new
+ hash[:a] = 0
+ hash[:b] = 0
+ hash.merge!(:a => 1, :c => 7) do |key, old_value, new_value|
+ new_value + 3
+ end
- @ordered_hash.merge! other_hash
- assert_equal @ordered_hash, merged
- assert_equal @ordered_hash.keys, merged.keys
+ assert_equal 4, hash[:a]
+ assert_equal 0, hash[:b]
+ assert_equal 7, hash[:c]
end
def test_shift
pair = @ordered_hash.shift
assert_equal [@keys.first, @values.first], pair
assert !@ordered_hash.keys.include?(pair.first)
end
-
+
def test_keys
original = @ordered_hash.keys.dup
@ordered_hash.keys.pop
View
4 ci/ci_build.rb
@@ -19,15 +19,15 @@ def rake(*tasks)
build_results = {}
# Install required version of bundler.
-bundler_install_cmd = "sudo gem install bundler --no-ri --no-rdoc"
+bundler_install_cmd = "gem install bundler --no-ri --no-rdoc"
puts "Running command: #{bundler_install_cmd}"
build_results[:install_bundler] = system bundler_install_cmd
cd root_dir do
puts
puts "[CruiseControl] Bundling RubyGems"
puts
- build_results[:bundle] = system 'sudo rm -rf ~/.bundle; env CI=1 bundle install'
+ build_results[:bundle] = system 'rm -rf ~/.bundle; env CI=1 bundle install'
end
cd "#{root_dir}/activesupport" do
View
2 railties/lib/rails/generators.rb
@@ -327,7 +327,7 @@ def self.namespaces_to_paths(namespaces) #:nodoc:
paths = []
namespaces.each do |namespace|
pieces = namespace.split(":")
- paths << pieces.dup.push(pieces.last).join("/") unless pieces.uniq.size == 1
+ paths << pieces.dup.push(pieces.last).join("/")
paths << pieces.join("/")
end
paths.uniq!
View
0 railties/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory
No changes.
View
20 railties/lib/rails/ruby_version_check.rb
@@ -1,10 +1,24 @@
-ruby_release = "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
-if ruby_release < '1.8.7' || (ruby_release > '1.8' && ruby_release < '1.9.2')
+if RUBY_VERSION < '1.8.7'
+ desc = defined?(RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
abort <<-end_message
Rails 3 requires Ruby 1.8.7 or 1.9.2.
- You're running #{ruby_release}; please upgrade to continue.
+ You're running
+ #{desc}
+
+ Please upgrade to continue.
+
+ end_message
+elsif RUBY_VERSION > '1.9' and RUBY_VERSION < '1.9.2'
+ $stderr.puts <<-end_message
+
+ Rails 3 doesn't officially support Ruby 1.9.1 since recent stable
+ releases have segfaulted the test suite. Please upgrade to Ruby 1.9.2
+ before Rails 3 is released!
+
+ You're running
+ #{RUBY_DESCRIPTION}
end_message
end
View
1 railties/test/generators/app_generator_test.rb
@@ -9,6 +9,7 @@
config.ru
app/controllers
app/helpers
+ app/mailers
app/models
app/views/layouts
config/environments
View
4 railties/test/generators/mailer_generator_test.rb
@@ -17,8 +17,8 @@ def test_mailer_skeleton_is_created
def test_mailer_with_i18n_helper
run_generator
assert_file "app/mailers/notifier.rb" do |mailer|
- assert_match /en\.actionmailer\.notifier\.foo\.subject/, mailer
- assert_match /en\.actionmailer\.notifier\.bar\.subject/, mailer
+ assert_match /en\.notifier\.foo\.subject/, mailer
+ assert_match /en\.notifier\.bar\.subject/, mailer
end
end

0 comments on commit bf74290

Please sign in to comment.