Skip to content
This repository
Browse code

Eliminate warnings for AM on 1.8

  • Loading branch information...
commit cd9ffd11e13ef6e62eba2cbd5c3760ff04132820 1 parent c738812
Yehuda Katz authored March 16, 2010
3  actionmailer/lib/action_mailer/old_api.rb
@@ -31,9 +31,6 @@ module OldApi #:nodoc:
31 31
       # replies to this message.
32 32
       adv_attr_accessor :reply_to
33 33
 
34  
-      # Specify additional headers to be added to the message.
35  
-      adv_attr_accessor :headers
36  
-
37 34
       # Specify the order in which parts should be sorted, based on content-type.
38 35
       # This defaults to the value for the +default_implicit_parts_order+.
39 36
       adv_attr_accessor :implicit_parts_order
21  actionmailer/test/abstract_unit.rb
... ...
@@ -1,4 +1,23 @@
1  
-require File.expand_path('../../../load_paths', __FILE__)
  1
+# Pathname has a warning, so require it first while silencing
  2
+# warnings to shut it up.
  3
+#
  4
+# Also, in 1.9, Bundler creates warnings due to overriding
  5
+# Rubygems methods
  6
+begin
  7
+  old, $VERBOSE = $VERBOSE, nil
  8
+  require 'pathname'
  9
+  require File.expand_path('../../../load_paths', __FILE__)
  10
+ensure
  11
+  $VERBOSE = old
  12
+end
  13
+
  14
+
  15
+require 'active_support/core_ext/kernel/reporting'
  16
+silence_warnings do
  17
+  # These external dependencies have warnings :/
  18
+  require 'text/format'
  19
+  require 'mail'
  20
+end
2 21
 
3 22
 lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
4 23
 $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
2  actionmailer/test/old_base/url_test.rb
@@ -31,6 +31,8 @@ class <<self
31 31
     attr_accessor :received_body
32 32
   end
33 33
 
  34
+  remove_method :receive
  35
+
34 36
   def receive(mail)
35 37
     self.class.received_body = mail.body
36 38
   end
4  actionpack/lib/abstract_controller/layouts.rb
... ...
@@ -1,3 +1,5 @@
  1
+require "active_support/core_ext/module/remove_method"
  2
+
1 3
 module AbstractController
2 4
   # Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
3 5
   # repeated setups. The inclusion pattern has pages that look like this:
@@ -237,6 +239,8 @@ def _implied_layout_name
237 239
       # name, return that string. Otherwise, use the superclass'
238 240
       # layout (which might also be implied)
239 241
       def _write_layout_method
  242
+        remove_possible_method(:_layout)
  243
+
240 244
         case defined?(@_layout) ? @_layout : nil
241 245
         when String
242 246
           self.class_eval %{def _layout; #{@_layout.inspect} end}
6  actionpack/lib/action_controller/metal.rb
@@ -34,7 +34,7 @@ def controller_name
34 34
     # and response object available. You might wish to control the
35 35
     # environment and response manually for performance reasons.
36 36
 
37  
-    attr_internal :status, :headers, :content_type, :response, :request
  37
+    attr_internal :headers, :response, :request
38 38
     delegate :session, :to => "@_request"
39 39
 
40 40
     def initialize(*)
@@ -62,6 +62,10 @@ def location=(url)
62 62
       headers["Location"] = url
63 63
     end
64 64
 
  65
+    def status
  66
+      @_status
  67
+    end
  68
+
65 69
     def status=(status)
66 70
       @_status = Rack::Utils.status_code(status)
67 71
     end
6  actionpack/lib/action_controller/metal/rack_delegation.rb
@@ -5,10 +5,8 @@ module ActionController
5 5
   module RackDelegation
6 6
     extend ActiveSupport::Concern
7 7
 
8  
-    included do
9  
-      delegate :headers, :status=, :location=, :content_type=,
10  
-               :status, :location, :content_type, :to => "@_response"
11  
-    end
  8
+    delegate :headers, :status=, :location=, :content_type=,
  9
+             :status, :location, :content_type, :to => "@_response"
12 10
 
13 11
     def dispatch(action, request)
14 12
       @_response = ActionDispatch::Response.new
1  actionpack/lib/action_dispatch/http/filter_parameters.rb
@@ -25,7 +25,6 @@ module Http
25 25
     module FilterParameters
26 26
       extend ActiveSupport::Concern
27 27
 
28  
-      mattr_reader :compiled_parameter_filter_for
29 28
       @@compiled_parameter_filter_for = {}
30 29
 
31 30
       # Return a hash of parameters with all sensitive data replaced.
2  actionpack/lib/action_view/helpers/capture_helper.rb
@@ -32,7 +32,7 @@ module CaptureHelper
32 32
       #
33 33
       def capture(*args)
34 34
         value = nil
35  
-        buffer = with_output_buffer { value = yield *args }
  35
+        buffer = with_output_buffer { value = yield(*args) }
36 36
         if string = buffer.presence || value and string.is_a?(String)
37 37
           NonConcattingString.new(string)
38 38
         end
3  activesupport/lib/active_support/core_ext/module.rb
@@ -7,4 +7,5 @@
7 7
 require 'active_support/core_ext/module/attr_accessor_with_default'
8 8
 require 'active_support/core_ext/module/delegation'
9 9
 require 'active_support/core_ext/module/synchronization'
10  
-require 'active_support/core_ext/module/deprecation'
  10
+require 'active_support/core_ext/module/deprecation'
  11
+require 'active_support/core_ext/module/remove_method'
6  activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -34,7 +34,7 @@ class Module
34 34
   #   class Foo
35 35
   #     CONSTANT_ARRAY = [0,1,2,3]
36 36
   #     @@class_array  = [4,5,6,7]
37  
-  #     
  37
+  #
38 38
   #     def initialize
39 39
   #       @instance_array = [8,9,10,11]
40 40
   #     end
@@ -120,6 +120,10 @@ def delegate(*methods)
120 120
         end
121 121
 
122 122
       module_eval(<<-EOS, file, line)
  123
+        if instance_methods(false).map(&:to_s).include?("#{prefix}#{method}")
  124
+          remove_method("#{prefix}#{method}")
  125
+        end
  126
+
123 127
         def #{prefix}#{method}(*args, &block)               # def customer_name(*args, &block)
124 128
           #{to}.__send__(#{method.inspect}, *args, &block)  #   client.__send__(:name, *args, &block)
125 129
         rescue NoMethodError                                # rescue NoMethodError
6  activesupport/lib/active_support/core_ext/module/remove_method.rb
... ...
@@ -0,0 +1,6 @@
  1
+class Module
  2
+  def remove_possible_method(method)
  3
+    remove_method(method)
  4
+  rescue NameError
  5
+  end
  6
+end

0 notes on commit cd9ffd1

Please sign in to comment.
Something went wrong with that request. Please try again.