Permalink
Browse files

Removed AS core_ext/kernel/requires as it's not used and is bad pract…

…ice.
  • Loading branch information...
1 parent a8b2a89 commit eff5d9aed468e8d6c4ffb103dad8e99b0a65465d @joshk joshk committed May 23, 2011
@@ -1,5 +1,4 @@
require 'active_record/connection_adapters/abstract_adapter'
-require 'active_support/core_ext/kernel/requires'
require 'active_support/core_ext/object/blank'
require 'set'
@@ -1,5 +1,4 @@
require 'active_record/connection_adapters/abstract_adapter'
-require 'active_support/core_ext/kernel/requires'
require 'active_support/core_ext/object/blank'
# Make sure we're using pg high enough for PGResult#values
@@ -1,5 +1,4 @@
require 'active_record/connection_adapters/abstract_adapter'
-require 'active_support/core_ext/kernel/requires'
module ActiveRecord
module ConnectionAdapters #:nodoc:
@@ -1,5 +1,4 @@
require 'active_support/core_ext/kernel/reporting'
require 'active_support/core_ext/kernel/agnostics'
-require 'active_support/core_ext/kernel/requires'
require 'active_support/core_ext/kernel/debugger'
require 'active_support/core_ext/kernel/singleton_class'
@@ -1,26 +0,0 @@
-require 'active_support/core_ext/kernel/reporting'
-
-module Kernel
- # Require a library with fallback to RubyGems. Warnings during library
- # loading are silenced to increase signal/noise for application warnings.
- def require_library_or_gem(library_name)
- silence_warnings do
- begin
- require library_name
- rescue LoadError => cannot_require
- # 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.
- begin
- require 'rubygems'
- rescue LoadError # => rubygems_not_installed
- raise cannot_require
- end
- # 2. Rubygems is installed and loaded. Try to load the library again
- begin
- require library_name
- rescue LoadError # => gem_not_installed
- raise cannot_require
- end
- end
- end
- end
-end
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/kernel/requires'
-
module Rails
module Rack
class Debugger
@@ -8,11 +6,12 @@ def initialize(app)
ARGV.clear # clear ARGV so that rails server options aren't passed to IRB
- require_library_or_gem 'ruby-debug'
+ require 'ruby-debug'
+
::Debugger.start
::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
puts "=> Debugger enabled"
- rescue Exception
+ rescue LoadError
puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'"
exit
end
@@ -3,7 +3,6 @@
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
require 'test/unit'
-require 'active_support/core_ext/kernel/requires'
require 'active_support/test_case'
require 'action_controller/test_case'
require 'action_dispatch/testing/integration'

13 comments on commit eff5d9a

@fxn
Member
fxn commented on eff5d9a May 23, 2011

Hey, there are still references to this method in the project. Could you perform another grep?

@joshk
joshk commented on eff5d9a May 23, 2011

Are there? I'm sorry, I will check into it further, my ack didn't pick anything up.

@fxn
Member
fxn commented on eff5d9a May 23, 2011

You're not the first one to fall there, I promise you :).

Thing is guides are written in Textile, and ack ignores .textile files by default. You need to pass -a to have them ack'ed :).

@joshk
joshk commented on eff5d9a May 23, 2011

ahhhhhhhhh, so require_library_or_gem is referenced in the guides? I am using the textmate ack bundle, not sure how to tell it to include textile, I'll look into it and get this updated.

Thanks for letting me know.

@vijaydev
Member

@fxn I just tried out using ack and it did search through the textile files. @joshk: Check out Active Support Core Extensions Guide! :)

@joshk
joshk commented on eff5d9a May 23, 2011

I have committed the correction to docrails

rails/docrails@09314f2

@joshk
joshk commented on eff5d9a May 23, 2011

@vijaydec i fixed my ackmate textmate plugin to include textile for now on

@fxn
Member
fxn commented on eff5d9a May 23, 2011

@vijaydev could it be the case that you've got a custom ~/.ackrc ?

@vijaydev
Member

@fxn No, I don't have one.

@fxn
Member
fxn commented on eff5d9a May 24, 2011

That's strange. The default types do not include .textile

https://github.com/petdance/ack/blob/master/Ack.pm#L74-128

What does the command

ack --help=types | ack textile

output in your machine?

@vijaydev
Member

Hmm... the command outputs nothing. Meaning textile is not a supported type?!

ack-grep version: 1.92

@fxn
Member
fxn commented on eff5d9a May 24, 2011

That's the expected output. I have 1.94 here, but .textile has never been among the types known by ack by default. Errrr, can't understand why is searching them in your machine.

What about environment variables? For example,

env | ack ACK

@vijaydev
Member

Nothing in env either!

Please sign in to comment.