Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e53f5ff7
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,发现更多精彩内容 >>
未验证
提交
e53f5ff7
编写于
8月 04, 2020
作者:
E
Eugene Kenny
提交者:
GitHub
8月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #39851 from piecehealth/engine_skip_mailers
--skip-action-mailer option doesn't work for "rails plugin new"
上级
8de10f9b
1f2d0120
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
1 deletion
+26
-1
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
...ies/lib/rails/generators/rails/plugin/plugin_generator.rb
+5
-1
railties/test/generators/plugin_generator_test.rb
railties/test/generators/plugin_generator_test.rb
+21
-0
未找到文件。
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
浏览文件 @
e53f5ff7
...
...
@@ -25,10 +25,14 @@ def app
directory
"app"
empty_directory_with_keep_file
"app/assets/images/
#{
namespaced_name
}
"
end
remove_dir
"app/mailers"
if
options
[
:skip_action_mailer
]
remove_dir
"app/jobs"
if
options
[
:skip_active_job
]
elsif
full?
empty_directory_with_keep_file
"app/models"
empty_directory_with_keep_file
"app/controllers"
empty_directory_with_keep_file
"app/mailers"
empty_directory_with_keep_file
"app/mailers"
unless
options
[
:skip_action_mailer
]
empty_directory_with_keep_file
"app/jobs"
unless
options
[
:skip_active_job
]
unless
api?
empty_directory_with_keep_file
"app/assets/images/
#{
namespaced_name
}
"
...
...
railties/test/generators/plugin_generator_test.rb
浏览文件 @
e53f5ff7
...
...
@@ -232,6 +232,24 @@ def test_skip_javascript
end
end
def
test_skip_action_mailer_and_skip_active_job_with_mountable
run_generator
[
destination_root
,
"--mountable"
,
"--skip-action-mailer"
,
"--skip-active-job"
]
assert_no_directory
"app/mailers"
assert_no_directory
"app/jobs"
end
def
test_skip_action_mailer_and_skip_active_job_with_api_and_mountable
run_generator
[
destination_root
,
"--api"
,
"--mountable"
,
"--skip-action-mailer"
,
"--skip-active-job"
]
assert_no_directory
"app/mailers"
assert_no_directory
"app/jobs"
end
def
test_skip_action_mailer_and_skip_active_job_with_full
run_generator
[
destination_root
,
"--full"
,
"--skip-action-mailer"
,
"--skip-active-job"
]
assert_no_directory
"app/mailers"
assert_no_directory
"app/jobs"
end
def
test_template_from_dir_pwd
FileUtils
.
cd
(
Rails
.
root
)
assert_match
(
/It works from file!/
,
run_generator
([
destination_root
,
"-m"
,
"lib/template.rb"
]))
...
...
@@ -268,6 +286,7 @@ def test_creating_engine_in_full_mode
assert_file
"app/views"
assert_file
"app/helpers"
assert_file
"app/mailers"
assert_file
"app/jobs"
assert_file
"bin/rails"
,
/\s+require\s+["']rails\/all["']/
assert_file
"config/routes.rb"
,
/Rails.application.routes.draw do/
assert_file
"lib/bukkits/engine.rb"
,
/module Bukkits\n class Engine < ::Rails::Engine\n end\nend/
...
...
@@ -284,6 +303,7 @@ def test_creating_engine_with_hyphenated_name_in_full_mode
assert_file
"hyphenated-name/app/views"
assert_file
"hyphenated-name/app/helpers"
assert_file
"hyphenated-name/app/mailers"
assert_file
"hyphenated-name/app/jobs"
assert_file
"hyphenated-name/bin/rails"
assert_file
"hyphenated-name/config/routes.rb"
,
/Rails.application.routes.draw do/
assert_file
"hyphenated-name/lib/hyphenated/name/engine.rb"
,
/module Hyphenated\n module Name\n class Engine < ::Rails::Engine\n end\n end\nend/
...
...
@@ -301,6 +321,7 @@ def test_creating_engine_with_hyphenated_and_underscored_name_in_full_mode
assert_file
"my_hyphenated-name/app/views"
assert_file
"my_hyphenated-name/app/helpers"
assert_file
"my_hyphenated-name/app/mailers"
assert_file
"my_hyphenated-name/app/jobs"
assert_file
"my_hyphenated-name/bin/rails"
assert_file
"my_hyphenated-name/config/routes.rb"
,
/Rails\.application\.routes\.draw do/
assert_file
"my_hyphenated-name/lib/my_hyphenated/name/engine.rb"
,
/module MyHyphenated\n module Name\n class Engine < ::Rails::Engine\n end\n end\nend/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录