activesupport 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ *1.3.1* (April 6th, 2005)
2
+
3
+ * Clean paths inside of exception messages and traces. [Nicholas Seckar]
4
+
5
+ * Add Pathname.clean_within for cleaning all the paths inside of a string. [Nicholas Seckar]
6
+
7
+ * provide an empty Dependencies::LoadingModule.load which prints deprecation warnings. Lets 1.0 applications function with .13-style environment.rb.
8
+
9
+
1
10
  *1.3.0* (March 27th, 2005)
2
11
 
3
12
  * When possible, avoid incorrectly obtaining constants from parent modules. Fixes #4221. [Nicholas Seckar]
@@ -1,25 +1,30 @@
1
- class Exception
2
- alias :clean_message :message
1
+ class Exception # :nodoc:
2
+ def clean_message
3
+ Pathname.clean_within message
4
+ end
3
5
 
4
6
  TraceSubstitutions = []
5
- FrameworkRegexp = /generated_code|vendor|dispatch|ruby|script\/\w+/
7
+ FrameworkRegexp = /generated|vendor|dispatch|ruby|script\/\w+/
6
8
 
7
9
  def clean_backtrace
8
10
  backtrace.collect do |line|
9
- TraceSubstitutions.inject(line) do |line, (regexp, sub)|
11
+ Pathname.clean_within(TraceSubstitutions.inject(line) do |line, (regexp, sub)|
10
12
  line.gsub regexp, sub
11
- end
13
+ end)
12
14
  end
13
15
  end
14
16
 
15
17
  def application_backtrace
16
18
  before_application_frame = true
17
19
 
18
- clean_backtrace.reject do |line|
19
- non_app_frame = !! (line =~ FrameworkRegexp)
20
+ trace = clean_backtrace.reject do |line|
21
+ non_app_frame = (line =~ FrameworkRegexp)
20
22
  before_application_frame = false unless non_app_frame
21
23
  non_app_frame && ! before_application_frame
22
24
  end
25
+
26
+ # If we didn't find any application frames, return an empty app trace.
27
+ before_application_frame ? [] : trace
23
28
  end
24
29
 
25
30
  def framework_backtrace
@@ -0,0 +1,28 @@
1
+ ***************
2
+ *** 21,33 ****
3
+ options[:builder].instruct! unless options.delete(:skip_instruct)
4
+
5
+ options[:builder].__send__(options[:root]) do
6
+ - for key in keys
7
+ - value = self[key]
8
+
9
+ - case value.class.to_s # TODO: Figure out why I have to to_s the class to do comparisons in order for tests to run
10
+ - when "Hash"
11
+ value.to_xml(options.merge({ :root => key, :skip_instruct => true }))
12
+ - when "Array"
13
+ value.to_xml(options.merge({ :root => key, :children => key.to_s.singularize, :skip_instruct => true}))
14
+ else
15
+ type_name = XML_TYPE_NAMES[value.class.to_s]
16
+ --- 21,32 ----
17
+ options[:builder].instruct! unless options.delete(:skip_instruct)
18
+
19
+ options[:builder].__send__(options[:root]) do
20
+ + each do |key, value|
21
+
22
+ + case value
23
+ + when ::Hash
24
+ value.to_xml(options.merge({ :root => key, :skip_instruct => true }))
25
+ + when ::Array
26
+ value.to_xml(options.merge({ :root => key, :children => key.to_s.singularize, :skip_instruct => true}))
27
+ else
28
+ type_name = XML_TYPE_NAMES[value.class.to_s]
@@ -76,4 +76,4 @@ module ActiveSupport #:nodoc:
76
76
  end
77
77
  end
78
78
  end
79
- end
79
+ end
@@ -0,0 +1,7 @@
1
+ require 'pathname'
2
+ require File.dirname(__FILE__) + '/pathname/clean_within'
3
+
4
+ class Pathname#:nodoc:
5
+ extend ActiveSupport::CoreExtensions::Pathname::CleanWithin
6
+ end
7
+
@@ -0,0 +1,14 @@
1
+ module ActiveSupport #:nodoc:
2
+ module CoreExtensions #:nodoc:
3
+ module Pathname #:nodoc:
4
+ module CleanWithin
5
+ # Clean the paths contained in the provided string.
6
+ def clean_within(string)
7
+ string.gsub(%r{[\w. ]+(/[\w. ]+)+(\.rb)?(\b|$)}) do |path|
8
+ new(path).cleanpath
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,11 @@
1
- class Symbol #:nodoc:
1
+ class Symbol
2
+ # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples:
3
+ #
4
+ # # The same as people.collect { |p| p.name }
5
+ # people.collect(&:name)
6
+ #
7
+ # # The same as people.select { |p| p.manager? }.collect { |p| p.salary }
8
+ # people.select(&:manager?).collect(&:salary)
2
9
  def to_proc
3
10
  Proc.new { |obj, *args| obj.send(self, *args) }
4
11
  end
@@ -68,6 +68,17 @@ module Dependencies #:nodoc:
68
68
  # Record history *after* loading so first load gets warnings.
69
69
  history << file_name
70
70
  end
71
+
72
+ class LoadingModule
73
+ # Old style environment.rb referenced this method directly. Please note, it doesn't
74
+ # actualy *do* anything any more.
75
+ def self.root(*args)
76
+ if defined?(RAILS_DEFAULT_LOGGER)
77
+ RAILS_DEFAULT_LOGGER.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases."
78
+ RAILS_DEFAULT_LOGGER.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19"
79
+ end
80
+ end
81
+ end
71
82
  end
72
83
 
73
84
  Object.send(:define_method, :require_or_load) { |file_name| Dependencies.require_or_load(file_name) } unless Object.respond_to?(:require_or_load)
@@ -2,7 +2,7 @@ module ActiveSupport
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: activesupport
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.3.0
7
- date: 2006-03-27 00:00:00 -06:00
6
+ version: 1.3.1
7
+ date: 2006-04-06 00:00:00 -05:00
8
8
  summary: Support and utility classes used by the Rails framework.
9
9
  require_paths:
10
10
  - lib
@@ -74,6 +74,8 @@ files:
74
74
  - lib/active_support/core_ext/numeric.rb
75
75
  - lib/active_support/core_ext/object
76
76
  - lib/active_support/core_ext/object.rb
77
+ - lib/active_support/core_ext/pathname
78
+ - lib/active_support/core_ext/pathname.rb
77
79
  - lib/active_support/core_ext/proc.rb
78
80
  - lib/active_support/core_ext/range
79
81
  - lib/active_support/core_ext/range.rb
@@ -89,6 +91,7 @@ files:
89
91
  - lib/active_support/core_ext/class/removal.rb
90
92
  - lib/active_support/core_ext/date/conversions.rb
91
93
  - lib/active_support/core_ext/hash/conversions.rb
94
+ - lib/active_support/core_ext/hash/conversions.rb.rej
92
95
  - lib/active_support/core_ext/hash/diff.rb
93
96
  - lib/active_support/core_ext/hash/indifferent_access.rb
94
97
  - lib/active_support/core_ext/hash/keys.rb
@@ -108,6 +111,7 @@ files:
108
111
  - lib/active_support/core_ext/numeric/time.rb
109
112
  - lib/active_support/core_ext/object/extending.rb
110
113
  - lib/active_support/core_ext/object/misc.rb
114
+ - lib/active_support/core_ext/pathname/clean_within.rb
111
115
  - lib/active_support/core_ext/range/conversions.rb
112
116
  - lib/active_support/core_ext/string/access.rb
113
117
  - lib/active_support/core_ext/string/conversions.rb