Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
fa791fb8
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
fa791fb8
编写于
1月 16, 2019
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated `server` argument from the rails server command
上级
553b86fc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
25 deletion
+6
-25
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/commands/server/server_command.rb
railties/lib/rails/commands/server/server_command.rb
+2
-21
railties/test/commands/server_test.rb
railties/test/commands/server_test.rb
+0
-4
未找到文件。
railties/CHANGELOG.md
浏览文件 @
fa791fb8
*
Remove deprecated
`server`
argument from the rails server command.
*Rafael Mendonça França*
*
Remove deprecated support to old
`config.ru`
that use the application class as argument of
`run`
.
*Rafael Mendonça França*
...
...
railties/lib/rails/commands/server/server_command.rb
浏览文件 @
fa791fb8
...
...
@@ -98,8 +98,6 @@ class ServerCommand < Base # :nodoc:
DEFAULT_PORT
=
3000
DEFAULT_PID_PATH
=
"tmp/pids/server.pid"
argument
:using
,
optional:
true
class_option
:port
,
aliases:
"-p"
,
type: :numeric
,
desc:
"Runs Rails on the specified port - defaults to 3000."
,
banner: :port
class_option
:binding
,
aliases:
"-b"
,
type: :string
,
...
...
@@ -126,7 +124,6 @@ def initialize(args, local_options, *)
super
@original_options
=
local_options
-
%w( --restart )
deprecate_positional_rack_server_and_rewrite_to_option
(
@original_options
)
end
def
perform
...
...
@@ -144,7 +141,7 @@ def perform
after_stop_callback
=
->
{
say
"Exiting"
unless
options
[
:daemon
]
}
server
.
start
(
after_stop_callback
)
else
say
rack_server_suggestion
(
using
)
say
rack_server_suggestion
(
options
[
:using
]
)
end
end
end
...
...
@@ -153,7 +150,7 @@ def perform
def
server_options
{
user_supplied_options:
user_supplied_options
,
server:
using
,
server:
options
[
:using
]
,
log_stdout:
log_to_stdout?
,
Port
:
port
,
Host
:
host
,
...
...
@@ -262,22 +259,6 @@ def prepare_restart
FileUtils
.
rm_f
(
options
[
:pid
])
if
options
[
:restart
]
end
def
deprecate_positional_rack_server_and_rewrite_to_option
(
original_options
)
if
using
ActiveSupport
::
Deprecation
.
warn
(
<<~
MSG
)
Passing the Rack server name as a regular argument is deprecated
and will be removed in the next Rails version. Please, use the -u
option instead.
MSG
original_options
.
concat
[
"-u"
,
using
]
else
# Use positional internally to get around Thor's immutable options.
# TODO: Replace `using` occurrences with `options[:using]` after deprecation removal.
@using
=
options
[
:using
]
end
end
def
rack_server_suggestion
(
server
)
if
server
.
in?
(
RACK_SERVERS
)
<<~
MSG
...
...
railties/test/commands/server_test.rb
浏览文件 @
fa791fb8
...
...
@@ -38,10 +38,6 @@ def test_using_server_mistype_without_suggestion
assert_no_match
(
/Maybe you meant/
,
output
)
end
def
test_using_positional_argument_deprecation
assert_match
(
/DEPRECATION WARNING/
,
run_command
(
"tin"
))
end
def
test_using_known_server_that_isnt_in_the_gemfile
assert_match
(
/Could not load server "unicorn". Maybe you need to the add it to the Gemfile/
,
run_command
(
"-u"
,
"unicorn"
))
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录