Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3101a413
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 搜索 >>
未验证
提交
3101a413
编写于
10月 09, 2018
作者:
E
Eileen M. Uchitelle
提交者:
GitHub
10月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #34071 from y-yagi/skip_webpacker_install
Add `skip-webpack-install` option
上级
168a9728
9195cdb7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
8 deletion
+30
-8
railties/lib/rails/generators/app_base.rb
railties/lib/rails/generators/app_base.rb
+5
-1
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+3
-0
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
...ies/lib/rails/generators/rails/plugin/plugin_generator.rb
+1
-0
railties/lib/rails/generators/testing/behaviour.rb
railties/lib/rails/generators/testing/behaviour.rb
+1
-1
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+16
-2
railties/test/generators/shared_generator_tests.rb
railties/test/generators/shared_generator_tests.rb
+4
-4
未找到文件。
railties/lib/rails/generators/app_base.rb
浏览文件 @
3101a413
...
...
@@ -399,6 +399,10 @@ def spring_install?
!
options
[
:skip_spring
]
&&
!
options
.
dev?
&&
Process
.
respond_to?
(
:fork
)
&&
!
RUBY_PLATFORM
.
include?
(
"cygwin"
)
end
def
webpack_install?
!
(
options
[
:skip_javascript
]
||
options
[
:skip_webpack_install
])
end
def
depends_on_system_test?
!
(
options
[
:skip_system_test
]
||
options
[
:skip_test
]
||
options
[
:api
])
end
...
...
@@ -420,7 +424,7 @@ def run_bundle
end
def
run_webpack
unless
options
[
:skip_javascript
]
if
webpack_install?
rails_command
"webpacker:install"
rails_command
"webpacker:install:
#{
options
[
:webpack
]
}
"
if
options
[
:webpack
]
&&
options
[
:webpack
]
!=
"webpack"
end
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
3101a413
...
...
@@ -261,6 +261,9 @@ class AppGenerator < AppBase # :nodoc:
class_option
:webpack
,
type: :string
,
default:
nil
,
desc:
"Preconfigure Webpack with a particular framework (options:
#{
WEBPACKS
.
join
(
'/'
)
}
)"
class_option
:skip_webpack_install
,
type: :boolean
,
default:
false
,
desc:
"Don't run Webpack install"
def
initialize
(
*
args
)
super
...
...
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
浏览文件 @
3101a413
...
...
@@ -98,6 +98,7 @@ def generate_test_dummy(force = false)
opts
[
:skip_listen
]
=
true
opts
[
:skip_git
]
=
true
opts
[
:skip_turbolinks
]
=
true
opts
[
:skip_webpack_install
]
=
true
opts
[
:dummy_app
]
=
true
invoke
Rails
::
Generators
::
AppGenerator
,
...
...
railties/lib/rails/generators/testing/behaviour.rb
浏览文件 @
3101a413
...
...
@@ -68,7 +68,7 @@ def run_generator(args = default_arguments, config = {})
capture
(
:stdout
)
do
args
+=
[
"--skip-bundle"
]
unless
args
.
include?
"--dev"
args
|=
[
"--skip-bootsnap"
]
unless
args
.
include?
"--no-skip-bootsnap"
args
|=
[
"--skip-
javascript"
]
unless
args
.
include?
"--no-skip-javascript
"
args
|=
[
"--skip-
webpack-install"
]
unless
args
.
include?
"--no-skip-webpack-install
"
generator_class
.
start
(
args
,
config
.
reverse_merge
(
destination_root:
destination_root
))
end
...
...
railties/test/generators/app_generator_test.rb
浏览文件 @
3101a413
...
...
@@ -113,7 +113,7 @@ def test_skip_bundle
end
def
test_assets
run_generator
[
destination_root
,
"--no-skip-javascript"
]
run_generator
assert_file
(
"app/views/layouts/application.html.erb"
,
/stylesheet_link_tag\s+'application', media: 'all', 'data-turbolinks-track': 'reload'/
)
assert_file
(
"app/views/layouts/application.html.erb"
,
/javascript_pack_tag\s+'application', 'data-turbolinks-track': 'reload'/
)
...
...
@@ -825,8 +825,22 @@ def test_webpack_option_with_js_framework
assert_gem
"webpacker"
end
def
test_skip_webpack_install
command_check
=
->
command
do
if
command
==
"webpacker:install"
assert
false
,
"webpacker:install expected not to be called."
end
end
generator
([
destination_root
],
skip_webpack_install:
true
).
stub
(
:rails_command
,
command_check
)
do
quietly
{
generator
.
invoke_all
}
end
assert_gem
"webpacker"
end
def
test_generator_if_skip_turbolinks_is_given
run_generator
[
destination_root
,
"--skip-turbolinks"
,
"--no-skip-javascript"
]
run_generator
[
destination_root
,
"--skip-turbolinks"
]
assert_no_gem
"turbolinks"
assert_file
"app/views/layouts/application.html.erb"
do
|
content
|
...
...
railties/test/generators/shared_generator_tests.rb
浏览文件 @
3101a413
...
...
@@ -27,7 +27,7 @@ def application_path
end
def
test_skeleton_is_created
run_generator
[
destination_root
,
"--no-skip-javascript"
]
run_generator
default_files
.
each
{
|
path
|
assert_file
path
}
end
...
...
@@ -196,7 +196,7 @@ def test_generator_if_skip_active_record_is_given
end
def
test_generator_for_active_storage
run_generator
[
destination_root
,
"--no-skip-javascript"
]
run_generator
unless
generator_class
.
name
==
"Rails::Generators::PluginGenerator"
assert_file
"
#{
application_path
}
/app/javascript/packs/application.js"
do
|
content
|
...
...
@@ -226,7 +226,7 @@ def test_generator_for_active_storage
end
def
test_generator_if_skip_active_storage_is_given
run_generator
[
destination_root
,
"--skip-active-storage"
,
"--no-skip-javascript"
]
run_generator
[
destination_root
,
"--skip-active-storage"
]
assert_file
"
#{
application_path
}
/config/application.rb"
,
/#\s+require\s+["']active_storage\/engine["']/
...
...
@@ -256,7 +256,7 @@ def test_generator_if_skip_active_storage_is_given
end
def
test_generator_does_not_generate_active_storage_contents_if_skip_active_record_is_given
run_generator
[
destination_root
,
"--skip-active-record"
,
"--no-skip-javascript"
]
run_generator
[
destination_root
,
"--skip-active-record"
]
assert_file
"
#{
application_path
}
/config/application.rb"
,
/#\s+require\s+["']active_storage\/engine["']/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录