Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…ice.
  • Loading branch information...
commit eff5d9aed468e8d6c4ffb103dad8e99b0a65465d 1 parent a8b2a89
Josh Kalderimis joshk authored
1  activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
View
@@ -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  activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
View
@@ -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  activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
View
@@ -1,5 +1,4 @@
require 'active_record/connection_adapters/abstract_adapter'
-require 'active_support/core_ext/kernel/requires'
module ActiveRecord
module ConnectionAdapters #:nodoc:
1  activesupport/lib/active_support/core_ext/kernel.rb
View
@@ -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'
26 activesupport/lib/active_support/core_ext/kernel/requires.rb
View
@@ -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
7 railties/lib/rails/rack/debugger.rb
View
@@ -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
1  railties/lib/rails/test_help.rb
View
@@ -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

Xavier Noria
Owner

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

Josh Kalderimis

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

Xavier Noria
Owner

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 :).

Josh Kalderimis

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.

Vijay Dev
Collaborator

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

Josh Kalderimis

I have committed the correction to docrails

rails/docrails@09314f2

Josh Kalderimis

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

Xavier Noria
Owner

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

Vijay Dev
Collaborator

@fxn No, I don't have one.

Xavier Noria
Owner

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?

Vijay Dev
Collaborator

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

ack-grep version: 1.92

Xavier Noria
Owner

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

Vijay Dev
Collaborator

Nothing in env either!

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