Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
2dfe8f1f
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,发现更多精彩内容 >>
提交
2dfe8f1f
编写于
3月 20, 2017
作者:
R
Rafael França
提交者:
GitHub
3月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28486 from y-yagi/add_app_update_for_rails_engine
Add `app:update` task to engines
上级
30fd30e7
a42351ac
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
1 deletion
+51
-1
railties/CHANGELOG.md
railties/CHANGELOG.md
+4
-0
railties/lib/rails/engine/updater.rb
railties/lib/rails/engine/updater.rb
+19
-0
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
...ies/lib/rails/generators/rails/plugin/plugin_generator.rb
+1
-1
railties/lib/rails/tasks/engine.rake
railties/lib/rails/tasks/engine.rake
+11
-0
railties/test/generators/plugin_generator_test.rb
railties/test/generators/plugin_generator_test.rb
+16
-0
未找到文件。
railties/CHANGELOG.md
浏览文件 @
2dfe8f1f
*
Add
`app:update`
task to engines.
*Yuji Yaginuma*
*
Avoid running system tests by default with the
`bin/rails test`
and
`bin/rake test`
commands since they may be expensive.
...
...
railties/lib/rails/engine/updater.rb
0 → 100644
浏览文件 @
2dfe8f1f
require
"rails/generators"
require
"rails/generators/rails/plugin/plugin_generator"
module
Rails
class
Engine
class
Updater
class
<<
self
def
generator
@generator
||=
Rails
::
Generators
::
PluginGenerator
.
new
[
"plugin"
],
{
engine:
true
},
destination_root:
ENGINE_ROOT
end
def
run
(
action
)
generator
.
send
(
action
)
end
end
end
end
end
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
浏览文件 @
2dfe8f1f
...
...
@@ -301,7 +301,7 @@ def create_dummy_app(path = nil)
end
def
engine?
full?
||
mountable?
full?
||
mountable?
||
options
[
:engine
]
end
def
full?
...
...
railties/lib/rails/tasks/engine.rake
浏览文件 @
2dfe8f1f
task
"load_app"
do
namespace
:app
do
load
APP_RAKEFILE
desc
"Update some initially generated files"
task
update:
[
"update:bin"
]
namespace
:update
do
require
"rails/engine/updater"
# desc "Adds new executables to the engine bin/ directory"
task
:bin
do
Rails
::
Engine
::
Updater
.
run
(
:create_bin_files
)
end
end
end
task
environment:
"app:environment"
...
...
railties/test/generators/plugin_generator_test.rb
浏览文件 @
2dfe8f1f
require
"generators/generators_test_helper"
require
"rails/generators/rails/plugin/plugin_generator"
require
"generators/shared_generator_tests"
require
"rails/engine/updater"
DEFAULT_PLUGIN_FILES
=
%w(
.gitignore
...
...
@@ -731,6 +732,21 @@ def test_generate_application_job_when_does_not_exist_in_mountable_engine
end
end
def
test_app_update_generates_bin_file
run_generator
[
destination_root
,
"--mountable"
]
Object
.
const_set
(
"ENGINE_ROOT"
,
destination_root
)
FileUtils
.
rm
(
"
#{
destination_root
}
/bin/rails"
)
quietly
{
Rails
::
Engine
::
Updater
.
run
(
:create_bin_files
)
}
assert_file
"
#{
destination_root
}
/bin/rails"
do
|
content
|
assert_match
(
%r|APP_PATH = File
\.
expand_path
\(
'
\.\.
/
\.\.
/test/dummy/config/application', __FILE__
\)
|
,
content
)
end
ensure
Object
.
send
(
:remove_const
,
"ENGINE_ROOT"
)
end
private
def
action
(
*
args
,
&
block
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录