aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-02-04 13:14:44 +0000
committerPratik Naik <pratiknaik@gmail.com>2010-02-04 13:14:44 +0000
commit8260f0b40f8954f1822a0f856f7c0706afbba0bd (patch)
tree1ec6fe65274eeb87c2030ba2daa3e230a375e846 /activesupport
parent6241d4e5535190b817e546130cfe179b641da1ba (diff)
parent6d6e6105c074eb9f266619e77a0873635af94124 (diff)
downloadrails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.tar.gz
rails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.tar.bz2
rails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.zip
Merge remote branch 'mainstream/master'
Conflicts: railties/guides/source/3_0_release_notes.textile
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/activesupport.gemspec30
-rw-r--r--activesupport/lib/active_support/notifications.rb2
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb4
-rw-r--r--activesupport/lib/active_support/notifications/instrumenter.rb9
-rw-r--r--activesupport/lib/active_support/version.rb2
-rw-r--r--activesupport/test/multibyte_chars_test.rb22
-rw-r--r--activesupport/test/notifications_test.rb18
7 files changed, 30 insertions, 57 deletions
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index 19cdbaa41a..c366ccfa8e 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -1,22 +1,22 @@
Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = "activesupport"
- s.version = "3.0.pre"
- s.date = "2009-09-01"
- s.summary = "Support and utility classes used by the Rails framework."
- s.description = %q{Utility library which carries commonly used classes and goodies from the Rails framework}
+ s.platform = Gem::Platform::RUBY
+ s.name = 'activesupport'
+ s.version = '3.0.0.beta'
+ s.summary = 'Support and utility classes used by the Rails framework.'
+ s.description = 'Support and utility classes used by the Rails framework.'
- s.add_dependency('i18n', '~> 0.3.0')
- s.add_dependency('tzinfo', '~> 0.3.16')
- s.add_dependency('builder', '~> 2.1.2')
- s.add_dependency('memcache-client', '~> 1.7.5')
+ s.author = 'David Heinemeier Hansson'
+ s.email = 'david@loudthinking.com'
+ s.homepage = 'http://www.rubyonrails.org'
+ s.rubyforge_project = 'activesupport'
- s.files = Dir['CHANGELOG', 'README', 'lib/**/*']
+ s.files = Dir['CHANGELOG', 'README', 'lib/**/*']
s.require_path = 'lib'
+
s.has_rdoc = true
- s.author = "David Heinemeier Hansson"
- s.email = "david@loudthinking.com"
- s.homepage = "http://www.rubyonrails.org"
- s.rubyforge_project = "activesupport"
+ s.add_dependency('i18n', '~> 0.3.0')
+ s.add_dependency('tzinfo', '~> 0.3.16')
+ s.add_dependency('builder', '~> 2.1.2')
+ s.add_dependency('memcache-client', '~> 1.7.5')
end
diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb
index a1383bb478..3e96decb8c 100644
--- a/activesupport/lib/active_support/notifications.rb
+++ b/activesupport/lib/active_support/notifications.rb
@@ -45,7 +45,7 @@ module ActiveSupport
class << self
attr_writer :notifier
delegate :publish, :subscribe, :to => :notifier
- delegate :instrument, :instrument!, :to => :instrumenter
+ delegate :instrument, :to => :instrumenter
def notifier
@notifier ||= Notifier.new
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index ac482a2ec8..0ec23da073 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -1,5 +1,3 @@
-require 'thread'
-
module ActiveSupport
module Notifications
# This is a default queue implementation that ships with Notifications. It
@@ -21,8 +19,8 @@ module ActiveSupport
@subscribers.each { |s| s.publish(*args) }
end
+ # This is a sync queue, so there is not waiting.
def wait
- sleep(0.05) until @subscribers.all?(&:drained?)
end
# Used for internal implementation only.
diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb
index 7c5b118ee3..f3d877efe7 100644
--- a/activesupport/lib/active_support/notifications/instrumenter.rb
+++ b/activesupport/lib/active_support/notifications/instrumenter.rb
@@ -20,15 +20,6 @@ module ActiveSupport
result
end
- # The same as instrument, but sends the notification even if the yielded
- # block raises an error.
- def instrument!(name, payload={})
- time = Time.now
- yield(payload) if block_given?
- ensure
- @notifier.publish(name, time, Time.now, @id, payload)
- end
-
private
def unique_id
SecureRandom.hex(10)
diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb
index 3ae6150f2d..b92e469a08 100644
--- a/activesupport/lib/active_support/version.rb
+++ b/activesupport/lib/active_support/version.rb
@@ -2,7 +2,7 @@ module ActiveSupport
module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
- TINY = "pre"
+ TINY = "0.beta"
STRING = [MAJOR, MINOR, TINY].join('.')
end
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index 0f68dcfe23..0e489c10e1 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -301,10 +301,10 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
assert_equal " #{UNICODE_STRING}", @chars.rjust(5)
assert_equal " #{UNICODE_STRING}", @chars.rjust(7)
assert_equal "---#{UNICODE_STRING}", @chars.rjust(7, '-')
- assert_equal "αα#{UNICODE_STRING}", @chars.rjust(7, 'α')
+ assert_equal "ααα#{UNICODE_STRING}", @chars.rjust(7, 'α')
assert_equal "aba#{UNICODE_STRING}", @chars.rjust(7, 'ab')
assert_equal "αηα#{UNICODE_STRING}", @chars.rjust(7, 'αη')
- assert_equal "αη#{UNICODE_STRING}", @chars.rjust(8, 'αη')
+ assert_equal "αηαη#{UNICODE_STRING}", @chars.rjust(8, 'αη')
end
def test_ljust_should_raise_argument_errors_on_bad_arguments
@@ -319,10 +319,10 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
assert_equal "#{UNICODE_STRING} ", @chars.ljust(5)
assert_equal "#{UNICODE_STRING} ", @chars.ljust(7)
assert_equal "#{UNICODE_STRING}---", @chars.ljust(7, '-')
- assert_equal "#{UNICODE_STRING}αα", @chars.ljust(7, 'α')
+ assert_equal "#{UNICODE_STRING}ααα", @chars.ljust(7, 'α')
assert_equal "#{UNICODE_STRING}aba", @chars.ljust(7, 'ab')
assert_equal "#{UNICODE_STRING}αηα", @chars.ljust(7, 'αη')
- assert_equal "#{UNICODE_STRING}αη", @chars.ljust(8, 'αη')
+ assert_equal "#{UNICODE_STRING}αηαη", @chars.ljust(8, 'αη')
end
def test_center_should_raise_argument_errors_on_bad_arguments
@@ -339,13 +339,13 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
assert_equal " #{UNICODE_STRING} ", @chars.center(7)
assert_equal "--#{UNICODE_STRING}--", @chars.center(8, '-')
assert_equal "--#{UNICODE_STRING}---", @chars.center(9, '-')
- assert_equal "α#{UNICODE_STRING}α", @chars.center(8, 'α')
- assert_equal "α#{UNICODE_STRING}αα", @chars.center(9, 'α')
- assert_equal "a#{UNICODE_STRING}", @chars.center(7, 'ab')
- assert_equal UNICODE_STRING, @chars.center(8, 'ab')
- assert_equal "ab#{UNICODE_STRING}ab", @chars.center(12, 'ab')
- assert_equal "α#{UNICODE_STRING}", @chars.center(7, 'αη')
- assert_equal UNICODE_STRING, @chars.center(8, 'αη')
+ assert_equal "αα#{UNICODE_STRING}αα", @chars.center(8, 'α')
+ assert_equal "αα#{UNICODE_STRING}ααα", @chars.center(9, 'α')
+ assert_equal "a#{UNICODE_STRING}ab", @chars.center(7, 'ab')
+ assert_equal "ab#{UNICODE_STRING}ab", @chars.center(8, 'ab')
+ assert_equal "abab#{UNICODE_STRING}abab", @chars.center(12, 'ab')
+ assert_equal "α#{UNICODE_STRING}αη", @chars.center(7, 'αη')
+ assert_equal "αη#{UNICODE_STRING}αη", @chars.center(8, 'αη')
end
def test_lstrip_strips_whitespace_from_the_left_of_the_string
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index 0b78b53c73..545811a376 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -67,29 +67,13 @@ module Notifications
end
class InstrumentationTest < TestCase
- delegate :instrument, :instrument!, :to => ActiveSupport::Notifications
+ delegate :instrument, :to => ActiveSupport::Notifications
def test_instrument_returns_block_result
assert_equal 2, instrument(:awesome) { 1 + 1 }
drain
end
- def test_instrument_with_bang_returns_result_even_on_failure
- begin
- instrument!(:awesome, :payload => "notifications") do
- raise "FAIL"
- end
- flunk
- rescue
- end
-
- drain
-
- assert_equal 1, @events.size
- assert_equal :awesome, @events.last.name
- assert_equal Hash[:payload => "notifications"], @events.last.payload
- end
-
def test_instrument_yields_the_paylod_for_further_modification
assert_equal 2, instrument(:awesome) { |p| p[:result] = 1 + 1 }
drain