turbo-rails 0.5.0 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -10
- data/app/assets/javascripts/turbo.js +272 -145
- data/app/helpers/turbo/frames_helper.rb +11 -6
- data/app/helpers/turbo/includes_helper.rb +2 -0
- data/app/helpers/turbo/streams/action_helper.rb +3 -3
- data/app/helpers/turbo/streams_helper.rb +25 -2
- data/app/javascript/turbo/cable_stream_source_element.js +1 -1
- data/app/javascript/turbo/index.js +6 -2
- data/app/models/concerns/turbo/broadcastable.rb +15 -11
- data/app/models/turbo/streams/tag_builder.rb +2 -2
- data/lib/install/turbo_with_asset_pipeline.rb +30 -0
- data/lib/install/turbo_with_webpacker.rb +23 -0
- data/lib/tasks/turbo_tasks.rake +19 -1
- data/lib/turbo/engine.rb +13 -2
- data/lib/turbo/version.rb +1 -1
- metadata +10 -175
- data/.github/workflows/ci.yml +0 -24
- data/.gitignore +0 -2
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -147
- data/lib/install/turbo.rb +0 -11
- data/package.json +0 -42
- data/rollup.config.js +0 -23
- data/test/drive/drive_helper_test.rb +0 -8
- data/test/dummy/.babelrc +0 -18
- data/test/dummy/.gitignore +0 -3
- data/test/dummy/.postcssrc.yml +0 -3
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/config/manifest.js +0 -2
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -80
- data/test/dummy/app/channels/application_cable/channel.rb +0 -4
- data/test/dummy/app/channels/application_cable/connection.rb +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -2
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/messages_controller.rb +0 -12
- data/test/dummy/app/controllers/trays_controller.rb +0 -17
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/javascript/packs/application.js +0 -0
- data/test/dummy/app/jobs/application_job.rb +0 -2
- data/test/dummy/app/mailboxes/application_mailbox.rb +0 -2
- data/test/dummy/app/mailboxes/messages_mailbox.rb +0 -4
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/message.rb +0 -29
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/app/views/messages/_message.html.erb +0 -1
- data/test/dummy/app/views/messages/_message.turbo_stream.erb +0 -1
- data/test/dummy/app/views/messages/show.turbo_stream.erb +0 -9
- data/test/dummy/app/views/trays/index.html.erb +0 -3
- data/test/dummy/app/views/trays/show.html.erb +0 -3
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -36
- data/test/dummy/bin/update +0 -31
- data/test/dummy/bin/yarn +0 -11
- data/test/dummy/config.ru +0 -5
- data/test/dummy/config/application.rb +0 -22
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/cable.yml +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -34
- data/test/dummy/config/environments/production.rb +0 -96
- data/test/dummy/config/environments/test.rb +0 -38
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/test/dummy/config/initializers/assets.rb +0 -14
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/content_security_policy.rb +0 -22
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -33
- data/test/dummy/config/puma.rb +0 -34
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/spring.rb +0 -6
- data/test/dummy/config/webpack/development.js +0 -3
- data/test/dummy/config/webpack/environment.js +0 -3
- data/test/dummy/config/webpack/production.js +0 -3
- data/test/dummy/config/webpack/test.js +0 -3
- data/test/dummy/config/webpacker.yml +0 -65
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/frames/frame_request_controller_test.rb +0 -21
- data/test/frames/frames_helper_test.rb +0 -15
- data/test/native/navigation_controller_test.rb +0 -42
- data/test/streams/broadcastable_test.rb +0 -80
- data/test/streams/streams_channel_test.rb +0 -105
- data/test/streams/streams_controller_test.rb +0 -29
- data/test/turbo_test.rb +0 -10
- data/turbo-rails.gemspec +0 -16
- data/yarn.lock +0 -282
data/.github/workflows/ci.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
on: [push, pull_request]
|
3
|
-
jobs:
|
4
|
-
tests:
|
5
|
-
strategy:
|
6
|
-
matrix:
|
7
|
-
ruby-version:
|
8
|
-
- "2.7"
|
9
|
-
- head
|
10
|
-
|
11
|
-
name: ${{ format('Tests (Ruby {0})', matrix.ruby-version) }}
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
|
14
|
-
steps:
|
15
|
-
- uses: actions/checkout@v1
|
16
|
-
|
17
|
-
- name: Install Ruby
|
18
|
-
uses: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: ${{ matrix.ruby-version }}
|
21
|
-
bundler-cache: true
|
22
|
-
|
23
|
-
- name: Run tests
|
24
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
turbo-rails (0.5.0)
|
5
|
-
rails (>= 6.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (6.1.0)
|
11
|
-
actionpack (= 6.1.0)
|
12
|
-
activesupport (= 6.1.0)
|
13
|
-
nio4r (~> 2.0)
|
14
|
-
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.1.0)
|
16
|
-
actionpack (= 6.1.0)
|
17
|
-
activejob (= 6.1.0)
|
18
|
-
activerecord (= 6.1.0)
|
19
|
-
activestorage (= 6.1.0)
|
20
|
-
activesupport (= 6.1.0)
|
21
|
-
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.1.0)
|
23
|
-
actionpack (= 6.1.0)
|
24
|
-
actionview (= 6.1.0)
|
25
|
-
activejob (= 6.1.0)
|
26
|
-
activesupport (= 6.1.0)
|
27
|
-
mail (~> 2.5, >= 2.5.4)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.1.0)
|
30
|
-
actionview (= 6.1.0)
|
31
|
-
activesupport (= 6.1.0)
|
32
|
-
rack (~> 2.0, >= 2.0.9)
|
33
|
-
rack-test (>= 0.6.3)
|
34
|
-
rails-dom-testing (~> 2.0)
|
35
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.1.0)
|
37
|
-
actionpack (= 6.1.0)
|
38
|
-
activerecord (= 6.1.0)
|
39
|
-
activestorage (= 6.1.0)
|
40
|
-
activesupport (= 6.1.0)
|
41
|
-
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.1.0)
|
43
|
-
activesupport (= 6.1.0)
|
44
|
-
builder (~> 3.1)
|
45
|
-
erubi (~> 1.4)
|
46
|
-
rails-dom-testing (~> 2.0)
|
47
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
activejob (6.1.0)
|
49
|
-
activesupport (= 6.1.0)
|
50
|
-
globalid (>= 0.3.6)
|
51
|
-
activemodel (6.1.0)
|
52
|
-
activesupport (= 6.1.0)
|
53
|
-
activerecord (6.1.0)
|
54
|
-
activemodel (= 6.1.0)
|
55
|
-
activesupport (= 6.1.0)
|
56
|
-
activestorage (6.1.0)
|
57
|
-
actionpack (= 6.1.0)
|
58
|
-
activejob (= 6.1.0)
|
59
|
-
activerecord (= 6.1.0)
|
60
|
-
activesupport (= 6.1.0)
|
61
|
-
marcel (~> 0.3.1)
|
62
|
-
mimemagic (~> 0.3.2)
|
63
|
-
activesupport (6.1.0)
|
64
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
-
i18n (>= 1.6, < 2)
|
66
|
-
minitest (>= 5.1)
|
67
|
-
tzinfo (~> 2.0)
|
68
|
-
zeitwerk (~> 2.3)
|
69
|
-
builder (3.2.4)
|
70
|
-
byebug (11.0.1)
|
71
|
-
concurrent-ruby (1.1.7)
|
72
|
-
crass (1.0.6)
|
73
|
-
erubi (1.10.0)
|
74
|
-
globalid (0.4.2)
|
75
|
-
activesupport (>= 4.2.0)
|
76
|
-
i18n (1.8.5)
|
77
|
-
concurrent-ruby (~> 1.0)
|
78
|
-
loofah (2.8.0)
|
79
|
-
crass (~> 1.0.2)
|
80
|
-
nokogiri (>= 1.5.9)
|
81
|
-
mail (2.7.1)
|
82
|
-
mini_mime (>= 0.1.1)
|
83
|
-
marcel (0.3.3)
|
84
|
-
mimemagic (~> 0.3.2)
|
85
|
-
method_source (1.0.0)
|
86
|
-
mimemagic (0.3.5)
|
87
|
-
mini_mime (1.0.2)
|
88
|
-
mini_portile2 (2.4.0)
|
89
|
-
minitest (5.14.2)
|
90
|
-
nio4r (2.5.4)
|
91
|
-
nokogiri (1.10.10)
|
92
|
-
mini_portile2 (~> 2.4.0)
|
93
|
-
rack (2.2.3)
|
94
|
-
rack-test (1.1.0)
|
95
|
-
rack (>= 1.0, < 3)
|
96
|
-
rails (6.1.0)
|
97
|
-
actioncable (= 6.1.0)
|
98
|
-
actionmailbox (= 6.1.0)
|
99
|
-
actionmailer (= 6.1.0)
|
100
|
-
actionpack (= 6.1.0)
|
101
|
-
actiontext (= 6.1.0)
|
102
|
-
actionview (= 6.1.0)
|
103
|
-
activejob (= 6.1.0)
|
104
|
-
activemodel (= 6.1.0)
|
105
|
-
activerecord (= 6.1.0)
|
106
|
-
activestorage (= 6.1.0)
|
107
|
-
activesupport (= 6.1.0)
|
108
|
-
bundler (>= 1.15.0)
|
109
|
-
railties (= 6.1.0)
|
110
|
-
sprockets-rails (>= 2.0.0)
|
111
|
-
rails-dom-testing (2.0.3)
|
112
|
-
activesupport (>= 4.2.0)
|
113
|
-
nokogiri (>= 1.6)
|
114
|
-
rails-html-sanitizer (1.3.0)
|
115
|
-
loofah (~> 2.3)
|
116
|
-
railties (6.1.0)
|
117
|
-
actionpack (= 6.1.0)
|
118
|
-
activesupport (= 6.1.0)
|
119
|
-
method_source
|
120
|
-
rake (>= 0.8.7)
|
121
|
-
thor (~> 1.0)
|
122
|
-
rake (13.0.0)
|
123
|
-
sprockets (4.0.2)
|
124
|
-
concurrent-ruby (~> 1.0)
|
125
|
-
rack (> 1, < 3)
|
126
|
-
sprockets-rails (3.2.2)
|
127
|
-
actionpack (>= 4.0)
|
128
|
-
activesupport (>= 4.0)
|
129
|
-
sprockets (>= 3.0.0)
|
130
|
-
thor (1.0.1)
|
131
|
-
tzinfo (2.0.4)
|
132
|
-
concurrent-ruby (~> 1.0)
|
133
|
-
websocket-driver (0.7.3)
|
134
|
-
websocket-extensions (>= 0.1.0)
|
135
|
-
websocket-extensions (0.1.5)
|
136
|
-
zeitwerk (2.4.2)
|
137
|
-
|
138
|
-
PLATFORMS
|
139
|
-
ruby
|
140
|
-
|
141
|
-
DEPENDENCIES
|
142
|
-
byebug
|
143
|
-
rake
|
144
|
-
turbo-rails!
|
145
|
-
|
146
|
-
BUNDLED WITH
|
147
|
-
2.1.4
|
data/lib/install/turbo.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
say "Yield head in application layout for cache helper"
|
2
|
-
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, "\n <%= yield :head %>", before: /\s*<\/head>/
|
3
|
-
|
4
|
-
say "Add Turbo include tags in application layout"
|
5
|
-
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, "\n <%= turbo_include_tags %>", before: /\s*<\/head>/
|
6
|
-
|
7
|
-
say "Enable redis in bundle"
|
8
|
-
uncomment_lines "Gemfile", %(gem 'redis')
|
9
|
-
|
10
|
-
say "Switch development cable to use redis"
|
11
|
-
gsub_file "config/cable.yml", /development:\n\s+adapter: async/, "development:\n adapter: redis\n url: redis://localhost:6379/1"
|
data/package.json
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@hotwired/turbo-rails",
|
3
|
-
"version": "7.0.0-beta.1",
|
4
|
-
"description": "The speed of a single-page web application without having to write any JavaScript",
|
5
|
-
"module": "app/javascript/turbo/index.js",
|
6
|
-
"main": "app/assets/javascripts/turbo.js",
|
7
|
-
"files": [
|
8
|
-
"app/javascript/turbo"
|
9
|
-
],
|
10
|
-
"scripts": {
|
11
|
-
"build": "rollup -c"
|
12
|
-
},
|
13
|
-
"dependencies": {
|
14
|
-
"@hotwired/turbo": "^7.0.0-beta.1",
|
15
|
-
"@rails/actioncable": "^6.1.0"
|
16
|
-
},
|
17
|
-
"devDependencies": {
|
18
|
-
"@rollup/plugin-node-resolve": "^11.0.1",
|
19
|
-
"rollup": "^2.35.1",
|
20
|
-
"rollup-plugin-terser": "^7.0.2"
|
21
|
-
},
|
22
|
-
"license": "MIT",
|
23
|
-
"author": "Basecamp, LLC",
|
24
|
-
"contributors": [
|
25
|
-
"David Heinemeier Hansson <david@basecamp.com>",
|
26
|
-
"Javan Makhmali <javan@javan.us>",
|
27
|
-
"Sam Stephenson <sstephenson@gmail.com>"
|
28
|
-
],
|
29
|
-
"keywords": [
|
30
|
-
"hotwire",
|
31
|
-
"turbo",
|
32
|
-
"rails"
|
33
|
-
],
|
34
|
-
"repository": {
|
35
|
-
"type": "git",
|
36
|
-
"url": "git+https://github.com/hotwired/turbo-rails.git"
|
37
|
-
},
|
38
|
-
"bugs": {
|
39
|
-
"url": "https://github.com/hotwired/turbo-rails/issues"
|
40
|
-
},
|
41
|
-
"homepage": "https://github.com/hotwired/turbo-rails"
|
42
|
-
}
|
data/rollup.config.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve"
|
2
|
-
import { terser } from "rollup-plugin-terser"
|
3
|
-
import pkg from "./package.json"
|
4
|
-
|
5
|
-
export default {
|
6
|
-
input: pkg.module,
|
7
|
-
output: {
|
8
|
-
file: pkg.main,
|
9
|
-
format: "es",
|
10
|
-
inlineDynamicImports: true
|
11
|
-
},
|
12
|
-
plugins: [
|
13
|
-
resolve(),
|
14
|
-
terser({
|
15
|
-
mangle: false,
|
16
|
-
compress: false,
|
17
|
-
format: {
|
18
|
-
beautify: true,
|
19
|
-
indent_level: 2
|
20
|
-
}
|
21
|
-
})
|
22
|
-
]
|
23
|
-
}
|
data/test/dummy/.babelrc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"presets": [
|
3
|
-
["env", {
|
4
|
-
"modules": false,
|
5
|
-
"targets": {
|
6
|
-
"browsers": "> 1%",
|
7
|
-
"uglify": true
|
8
|
-
},
|
9
|
-
"useBuiltIns": true
|
10
|
-
}]
|
11
|
-
],
|
12
|
-
|
13
|
-
"plugins": [
|
14
|
-
"syntax-dynamic-import",
|
15
|
-
"transform-object-rest-spread",
|
16
|
-
["transform-class-properties", { "spec": true }]
|
17
|
-
]
|
18
|
-
}
|
data/test/dummy/.gitignore
DELETED
data/test/dummy/.postcssrc.yml
DELETED
data/test/dummy/Rakefile
DELETED
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,80 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
margin: 33px;
|
5
|
-
}
|
6
|
-
|
7
|
-
body, p, ol, ul, td {
|
8
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
-
font-size: 13px;
|
10
|
-
line-height: 18px;
|
11
|
-
}
|
12
|
-
|
13
|
-
pre {
|
14
|
-
background-color: #eee;
|
15
|
-
padding: 10px;
|
16
|
-
font-size: 11px;
|
17
|
-
}
|
18
|
-
|
19
|
-
a {
|
20
|
-
color: #000;
|
21
|
-
}
|
22
|
-
|
23
|
-
a:visited {
|
24
|
-
color: #666;
|
25
|
-
}
|
26
|
-
|
27
|
-
a:hover {
|
28
|
-
color: #fff;
|
29
|
-
background-color: #000;
|
30
|
-
}
|
31
|
-
|
32
|
-
th {
|
33
|
-
padding-bottom: 5px;
|
34
|
-
}
|
35
|
-
|
36
|
-
td {
|
37
|
-
padding: 0 5px 7px;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.field,
|
41
|
-
div.actions {
|
42
|
-
margin-bottom: 10px;
|
43
|
-
}
|
44
|
-
|
45
|
-
#notice {
|
46
|
-
color: green;
|
47
|
-
}
|
48
|
-
|
49
|
-
.field_with_errors {
|
50
|
-
padding: 2px;
|
51
|
-
background-color: red;
|
52
|
-
display: table;
|
53
|
-
}
|
54
|
-
|
55
|
-
#error_explanation {
|
56
|
-
width: 450px;
|
57
|
-
border: 2px solid red;
|
58
|
-
padding: 7px 7px 0;
|
59
|
-
margin-bottom: 20px;
|
60
|
-
background-color: #f0f0f0;
|
61
|
-
}
|
62
|
-
|
63
|
-
#error_explanation h2 {
|
64
|
-
text-align: left;
|
65
|
-
font-weight: bold;
|
66
|
-
padding: 5px 5px 5px 15px;
|
67
|
-
font-size: 12px;
|
68
|
-
margin: -7px -7px 0;
|
69
|
-
background-color: #c00;
|
70
|
-
color: #fff;
|
71
|
-
}
|
72
|
-
|
73
|
-
#error_explanation ul li {
|
74
|
-
font-size: 12px;
|
75
|
-
list-style: square;
|
76
|
-
}
|
77
|
-
|
78
|
-
label {
|
79
|
-
display: block;
|
80
|
-
}
|
File without changes
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class MessagesController < ApplicationController
|
2
|
-
def show
|
3
|
-
@message = Message.new(record_id: 1, content: "My message")
|
4
|
-
end
|
5
|
-
|
6
|
-
def create
|
7
|
-
respond_to do |format|
|
8
|
-
format.html { redirect_to message_url(id: 1) }
|
9
|
-
format.turbo_stream { render turbo_stream: turbo_stream.append(:messages, "message_1") }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|