Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
a5fb1c61
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5fb1c61
编写于
5月 23, 2011
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1231 from joshk/ruby-debugger
Ruby debugger corrections
上级
5c3f3f10
2514d65c
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
47 addition
and
45 deletion
+47
-45
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
...rd/lib/active_record/connection_adapters/mysql_adapter.rb
+0
-1
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
...b/active_record/connection_adapters/postgresql_adapter.rb
+0
-1
activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
...d/lib/active_record/connection_adapters/sqlite_adapter.rb
+0
-1
activesupport/lib/active_support/core_ext/kernel.rb
activesupport/lib/active_support/core_ext/kernel.rb
+0
-1
activesupport/lib/active_support/core_ext/kernel/debugger.rb
activesupport/lib/active_support/core_ext/kernel/debugger.rb
+1
-7
activesupport/lib/active_support/core_ext/kernel/requires.rb
activesupport/lib/active_support/core_ext/kernel/requires.rb
+0
-26
activesupport/test/core_ext/kernel_test.rb
activesupport/test/core_ext/kernel_test.rb
+43
-3
railties/lib/rails/rack/debugger.rb
railties/lib/rails/rack/debugger.rb
+3
-4
railties/lib/rails/test_help.rb
railties/lib/rails/test_help.rb
+0
-1
未找到文件。
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
浏览文件 @
a5fb1c61
require
'active_record/connection_adapters/abstract_adapter'
require
'active_support/core_ext/kernel/requires'
require
'active_support/core_ext/object/blank'
require
'set'
...
...
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
浏览文件 @
a5fb1c61
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
...
...
activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
浏览文件 @
a5fb1c61
require
'active_record/connection_adapters/abstract_adapter'
require
'active_support/core_ext/kernel/requires'
module
ActiveRecord
module
ConnectionAdapters
#:nodoc:
...
...
activesupport/lib/active_support/core_ext/kernel.rb
浏览文件 @
a5fb1c61
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'
activesupport/lib/active_support/core_ext/kernel/debugger.rb
浏览文件 @
a5fb1c61
...
...
@@ -5,12 +5,6 @@ def debugger
message
=
"
\n
***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
\n
"
defined?
(
Rails
)
?
Rails
.
logger
.
info
(
message
)
:
$stderr
.
puts
(
message
)
end
end
undef
:breakpoint
if
respond_to?
(
:breakpoint
)
def
breakpoint
message
=
"
\n
***** The 'breakpoint' command has been renamed 'debugger' -- please change *****
\n
"
defined?
(
Rails
)
?
Rails
.
logger
.
info
(
message
)
:
$stderr
.
puts
(
message
)
debugger
alias
breakpoint
debugger
unless
respond_to?
(
:breakpoint
)
end
end
activesupport/lib/active_support/core_ext/kernel/requires.rb
已删除
100644 → 0
浏览文件 @
5c3f3f10
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
activesupport/test/core_ext/kernel_test.rb
浏览文件 @
a5fb1c61
...
...
@@ -54,8 +54,8 @@ class << o; @x = 1; end
end
def
test_capture
assert_equal
'STDERR'
,
capture
(
:stderr
)
{
$stderr
.
print
'STDERR'
}
assert_equal
'STDOUT'
,
capture
(
:stdout
)
{
print
'STDOUT'
}
assert_equal
'STDERR'
,
capture
(
:stderr
)
{
$stderr
.
print
'STDERR'
}
assert_equal
'STDOUT'
,
capture
(
:stdout
)
{
print
'STDOUT'
}
end
end
...
...
@@ -73,3 +73,43 @@ def test_suppression
suppress
(
LoadError
,
ArgumentError
)
{
raise
ArgumentError
}
end
end
class
MockStdErr
attr_reader
:output
def
puts
(
message
)
@output
||=
[]
@output
<<
message
end
def
info
(
message
)
puts
(
message
)
end
def
write
(
message
)
puts
(
message
)
end
end
class
KernelDebuggerTest
<
Test
::
Unit
::
TestCase
def
test_debugger_not_available_message_to_stderr
old_stderr
=
$stderr
$stderr
=
MockStdErr
.
new
debugger
assert_match
(
/Debugger requested/
,
$stderr
.
output
.
first
)
ensure
$stderr
=
old_stderr
end
def
test_debugger_not_available_message_to_rails_logger
rails
=
Class
.
new
do
def
self
.
logger
@logger
||=
MockStdErr
.
new
end
end
Object
.
const_set
(
"Rails"
,
rails
)
debugger
assert_match
(
/Debugger requested/
,
rails
.
logger
.
output
.
first
)
ensure
Object
.
send
(
:remove_const
,
"Rails"
)
end
end
\ No newline at end of file
railties/lib/rails/rack/debugger.rb
浏览文件 @
a5fb1c61
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
...
...
railties/lib/rails/test_help.rb
浏览文件 @
a5fb1c61
...
...
@@ -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'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录