From abfc4dad3ebb17eccd32d1f1eb8a3e9c0f6e6e4e Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Mon, 30 Nov 2009 15:58:38 -0800 Subject: Remove global Rails initializers --- railties/lib/rails/initializable.rb | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'railties/lib/rails/initializable.rb') diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 3866b856b2..96234739cf 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -106,26 +106,4 @@ module Rails end end end - - include Initializable - - # Check for valid Ruby version (1.8.2 or 1.8.4 or higher). This is done in an - # external file, so we can use it from the `rails` program as well without duplication. - initializer :check_ruby_version, :global => true do - require 'rails/ruby_version_check' - end - - # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the - # multibyte safe operations. Plugin authors supporting other encodings - # should override this behaviour and set the relevant +default_charset+ - # on ActionController::Base. - # - # For Ruby 1.9, UTF-8 is the default internal and external encoding. - initializer :initialize_encoding, :global => true do - if RUBY_VERSION < '1.9' - $KCODE='u' - else - Encoding.default_external = Encoding::UTF_8 - end - end end \ No newline at end of file -- cgit v1.2.3 From f70079efb10f6af1187dc55dfbecc87136dc4738 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 14 Dec 2009 15:42:48 -0600 Subject: Fix warnings in railties configuration and initializeable --- railties/lib/rails/initializable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/initializable.rb') diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index 96234739cf..add10bd207 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -5,7 +5,7 @@ module Rails end class Initializer - attr_reader :name, :before, :after, :global, :block + attr_reader :name, :block def initialize(name, context, options, &block) @name, @context, @options, @block = name, context, options, block @@ -62,7 +62,7 @@ module Rails end def run_initializers(*args) - return if @ran + return if instance_variable_defined?(:@ran) initializers.each do |initializer| initializer.run(*args) end -- cgit v1.2.3 From fa8dfc7d014f6768599077b79a874894e13d317f Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Wed, 23 Dec 2009 13:45:55 -0800 Subject: Raise an exception if an initializer is defined without a block --- railties/lib/rails/initializable.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/rails/initializable.rb') diff --git a/railties/lib/rails/initializable.rb b/railties/lib/rails/initializable.rb index add10bd207..8fcb254590 100644 --- a/railties/lib/rails/initializable.rb +++ b/railties/lib/rails/initializable.rb @@ -93,6 +93,7 @@ module Rails end def initializer(name, opts = {}, &blk) + raise ArgumentError, "A block must be passed when defining an initializer" unless blk @initializers ||= [] @initializers << Initializer.new(name, nil, opts, &blk) end -- cgit v1.2.3