Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
385d31d2
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,发现更多精彩内容 >>
提交
385d31d2
编写于
1月 16, 2019
作者:
J
Javan Makhmali
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minimize boilerplate setup code for JavaScript libraries
上级
90536ebf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
14 addition
and
23 deletion
+14
-23
actionview/app/assets/javascripts/README.md
actionview/app/assets/javascripts/README.md
+1
-2
activestorage/README.md
activestorage/README.md
+1
-2
guides/source/action_cable_overview.md
guides/source/action_cable_overview.md
+2
-2
guides/source/active_storage_overview.md
guides/source/active_storage_overview.md
+1
-2
railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js
...s/rails/app/templates/app/javascript/channels/consumer.js
+2
-2
railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt
...ails/app/templates/app/javascript/packs/application.js.tt
+4
-10
railties/test/application/rake_test.rb
railties/test/application/rake_test.rb
+1
-1
railties/test/generators/shared_generator_tests.rb
railties/test/generators/shared_generator_tests.rb
+2
-2
未找到文件。
actionview/app/assets/javascripts/README.md
浏览文件 @
385d31d2
...
@@ -40,8 +40,7 @@ In a conventional Rails application that uses the asset pipeline, require `rails
...
@@ -40,8 +40,7 @@ In a conventional Rails application that uses the asset pipeline, require `rails
If you're using the Webpacker gem or some other JavaScript bundler, add the following to your main JS file:
If you're using the Webpacker gem or some other JavaScript bundler, add the following to your main JS file:
```
javascript
```
javascript
import
Rails
from
"
@rails/ujs
"
require
(
"
@rails/ujs
"
).
start
()
Rails
.
start
()
```
```
## How to run tests
## How to run tests
...
...
activestorage/README.md
浏览文件 @
385d31d2
...
@@ -118,8 +118,7 @@ Active Storage, with its included JavaScript library, supports uploading directl
...
@@ -118,8 +118,7 @@ Active Storage, with its included JavaScript library, supports uploading directl
```
```
Using the npm package:
Using the npm package:
```js
```js
import * as ActiveStorage from "@rails/activestorage"
require("@rails/activestorage").start()
ActiveStorage.start()
```
```
2.
Annotate file inputs with the direct upload URL.
2.
Annotate file inputs with the direct upload URL.
...
...
guides/source/action_cable_overview.md
浏览文件 @
385d31d2
...
@@ -181,9 +181,9 @@ established using the following JavaScript, which is generated by default by Rai
...
@@ -181,9 +181,9 @@ established using the following JavaScript, which is generated by default by Rai
// Action Cable provides the framework to deal with WebSockets in Rails.
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
import
ActionCable
from
"
@rails/actioncable
"
import
{
createConsumer
}
from
"
@rails/actioncable
"
export
default
ActionCable
.
createConsumer
()
export
default
createConsumer
()
```
```
This will ready a consumer that'll connect against
`/cable`
on your server by default.
This will ready a consumer that'll connect against
`/cable`
on your server by default.
...
...
guides/source/active_storage_overview.md
浏览文件 @
385d31d2
...
@@ -489,8 +489,7 @@ directly from the client to the cloud.
...
@@ -489,8 +489,7 @@ directly from the client to the cloud.
Using the npm package:
Using the npm package:
```js
```js
import * as ActiveStorage from "@rails/activestorage"
require("@rails/activestorage").start()
ActiveStorage.start()
```
```
2.
Annotate file inputs with the direct upload URL.
2.
Annotate file inputs with the direct upload URL.
...
...
railties/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js
浏览文件 @
385d31d2
// Action Cable provides the framework to deal with WebSockets in Rails.
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
import
ActionCable
from
"
@rails/actioncable
"
import
{
createConsumer
}
from
"
@rails/actioncable
"
export
default
ActionCable
.
createConsumer
()
export
default
createConsumer
()
railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt
浏览文件 @
385d31d2
...
@@ -3,19 +3,13 @@
...
@@ -3,19 +3,13 @@
// a relevant structure within app/javascript and only use these pack files to reference
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
// that code so it'll be compiled.
import Rails from "@rails/ujs"
require("@rails/ujs").start()
Rails.start()
<%- unless options[:skip_turbolinks] -%>
<%- unless options[:skip_turbolinks] -%>
require("turbolinks").start()
import Turbolinks from "turbolinks"
Turbolinks.start()
<%- end -%>
<%- end -%>
<%- unless skip_active_storage? -%>
<%- unless skip_active_storage? -%>
require("@rails/activestorage").start()
import * as ActiveStorage from "@rails/activestorage"
ActiveStorage.start()
<%- end -%>
<%- end -%>
<%- unless options[:skip_action_cable] -%>
<%- unless options[:skip_action_cable] -%>
require("channels")
import "channels"
<%- end -%>
<%- end -%>
railties/test/application/rake_test.rb
浏览文件 @
385d31d2
...
@@ -118,7 +118,7 @@ def test_should_not_eager_load_model_for_rake
...
@@ -118,7 +118,7 @@ def test_should_not_eager_load_model_for_rake
end
end
def
test_code_statistics_sanity
def
test_code_statistics_sanity
assert_match
"Code LOC:
32
Test LOC: 0 Code to Test Ratio: 1:0.0"
,
assert_match
"Code LOC:
29
Test LOC: 0 Code to Test Ratio: 1:0.0"
,
rails
(
"stats"
)
rails
(
"stats"
)
end
end
...
...
railties/test/generators/shared_generator_tests.rb
浏览文件 @
385d31d2
...
@@ -206,7 +206,7 @@ def test_generator_for_active_storage
...
@@ -206,7 +206,7 @@ def test_generator_for_active_storage
unless
generator_class
.
name
==
"Rails::Generators::PluginGenerator"
unless
generator_class
.
name
==
"Rails::Generators::PluginGenerator"
assert_file
"
#{
application_path
}
/app/javascript/packs/application.js"
do
|
content
|
assert_file
"
#{
application_path
}
/app/javascript/packs/application.js"
do
|
content
|
assert_match
(
/^
import \* as ActiveStorage from "@rails\/activestorage"\nActiveStorage
.start\(\)/
,
content
)
assert_match
(
/^
require\("@rails\/activestorage"\)\
.start\(\)/
,
content
)
end
end
end
end
...
@@ -267,7 +267,7 @@ def test_generator_does_not_generate_active_storage_contents_if_skip_active_reco
...
@@ -267,7 +267,7 @@ def test_generator_does_not_generate_active_storage_contents_if_skip_active_reco
assert_file
"
#{
application_path
}
/config/application.rb"
,
/#\s+require\s+["']active_storage\/engine["']/
assert_file
"
#{
application_path
}
/config/application.rb"
,
/#\s+require\s+["']active_storage\/engine["']/
assert_file
"
#{
application_path
}
/app/javascript/packs/application.js"
do
|
content
|
assert_file
"
#{
application_path
}
/app/javascript/packs/application.js"
do
|
content
|
assert_no_match
(
/^
import * as ActiveStorage from "@rails\/activestorage"\nActiveStorage
.start\(\)/
,
content
)
assert_no_match
(
/^
require\("@rails\/activestorage"\)\
.start\(\)/
,
content
)
end
end
assert_file
"
#{
application_path
}
/config/environments/development.rb"
do
|
content
|
assert_file
"
#{
application_path
}
/config/environments/development.rb"
do
|
content
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录