turbo-rails 0.5.3 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -1
  3. data/app/assets/javascripts/turbo.js +243 -129
  4. data/app/helpers/turbo/includes_helper.rb +2 -0
  5. data/app/helpers/turbo/streams_helper.rb +2 -2
  6. data/app/models/concerns/turbo/broadcastable.rb +8 -3
  7. data/lib/install/turbo_with_asset_pipeline.rb +19 -3
  8. data/lib/install/turbo_with_webpacker.rb +1 -2
  9. data/lib/turbo/engine.rb +1 -1
  10. data/lib/turbo/version.rb +1 -1
  11. metadata +7 -173
  12. data/.github/workflows/ci.yml +0 -30
  13. data/.gitignore +0 -2
  14. data/Gemfile +0 -6
  15. data/Gemfile.lock +0 -147
  16. data/package.json +0 -47
  17. data/rollup.config.js +0 -23
  18. data/test/drive/drive_helper_test.rb +0 -8
  19. data/test/dummy/.babelrc +0 -18
  20. data/test/dummy/.gitignore +0 -3
  21. data/test/dummy/.postcssrc.yml +0 -3
  22. data/test/dummy/Rakefile +0 -6
  23. data/test/dummy/app/assets/config/manifest.js +0 -2
  24. data/test/dummy/app/assets/images/.keep +0 -0
  25. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  26. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -80
  27. data/test/dummy/app/channels/application_cable/channel.rb +0 -4
  28. data/test/dummy/app/channels/application_cable/connection.rb +0 -4
  29. data/test/dummy/app/controllers/application_controller.rb +0 -2
  30. data/test/dummy/app/controllers/concerns/.keep +0 -0
  31. data/test/dummy/app/controllers/messages_controller.rb +0 -12
  32. data/test/dummy/app/controllers/trays_controller.rb +0 -17
  33. data/test/dummy/app/helpers/application_helper.rb +0 -2
  34. data/test/dummy/app/javascript/packs/application.js +0 -0
  35. data/test/dummy/app/jobs/application_job.rb +0 -2
  36. data/test/dummy/app/mailboxes/application_mailbox.rb +0 -2
  37. data/test/dummy/app/mailboxes/messages_mailbox.rb +0 -4
  38. data/test/dummy/app/mailers/application_mailer.rb +0 -4
  39. data/test/dummy/app/models/application_record.rb +0 -3
  40. data/test/dummy/app/models/concerns/.keep +0 -0
  41. data/test/dummy/app/models/message.rb +0 -29
  42. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  43. data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
  44. data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
  45. data/test/dummy/app/views/messages/_message.html.erb +0 -1
  46. data/test/dummy/app/views/messages/_message.turbo_stream.erb +0 -1
  47. data/test/dummy/app/views/messages/show.turbo_stream.erb +0 -9
  48. data/test/dummy/app/views/trays/index.html.erb +0 -3
  49. data/test/dummy/app/views/trays/show.html.erb +0 -3
  50. data/test/dummy/bin/bundle +0 -3
  51. data/test/dummy/bin/rails +0 -4
  52. data/test/dummy/bin/rake +0 -4
  53. data/test/dummy/bin/setup +0 -36
  54. data/test/dummy/bin/update +0 -31
  55. data/test/dummy/bin/yarn +0 -11
  56. data/test/dummy/config.ru +0 -5
  57. data/test/dummy/config/application.rb +0 -22
  58. data/test/dummy/config/boot.rb +0 -5
  59. data/test/dummy/config/cable.yml +0 -10
  60. data/test/dummy/config/environment.rb +0 -5
  61. data/test/dummy/config/environments/development.rb +0 -34
  62. data/test/dummy/config/environments/production.rb +0 -96
  63. data/test/dummy/config/environments/test.rb +0 -38
  64. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
  65. data/test/dummy/config/initializers/assets.rb +0 -14
  66. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  67. data/test/dummy/config/initializers/content_security_policy.rb +0 -22
  68. data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
  69. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  70. data/test/dummy/config/initializers/inflections.rb +0 -16
  71. data/test/dummy/config/initializers/mime_types.rb +0 -4
  72. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  73. data/test/dummy/config/locales/en.yml +0 -33
  74. data/test/dummy/config/puma.rb +0 -34
  75. data/test/dummy/config/routes.rb +0 -4
  76. data/test/dummy/config/spring.rb +0 -6
  77. data/test/dummy/config/webpack/development.js +0 -3
  78. data/test/dummy/config/webpack/environment.js +0 -3
  79. data/test/dummy/config/webpack/production.js +0 -3
  80. data/test/dummy/config/webpack/test.js +0 -3
  81. data/test/dummy/config/webpacker.yml +0 -65
  82. data/test/dummy/lib/assets/.keep +0 -0
  83. data/test/dummy/log/.keep +0 -0
  84. data/test/dummy/public/404.html +0 -67
  85. data/test/dummy/public/422.html +0 -67
  86. data/test/dummy/public/500.html +0 -66
  87. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  88. data/test/dummy/public/apple-touch-icon.png +0 -0
  89. data/test/dummy/public/favicon.ico +0 -0
  90. data/test/frames/frame_request_controller_test.rb +0 -21
  91. data/test/frames/frames_helper_test.rb +0 -21
  92. data/test/native/navigation_controller_test.rb +0 -42
  93. data/test/streams/broadcastable_test.rb +0 -80
  94. data/test/streams/streams_channel_test.rb +0 -111
  95. data/test/streams/streams_controller_test.rb +0 -29
  96. data/test/turbo_test.rb +0 -10
  97. data/turbo-rails.gemspec +0 -17
  98. data/yarn.lock +0 -283
@@ -1,47 +0,0 @@
1
- {
2
- "name": "@hotwired/turbo-rails",
3
- "version": "7.0.0-beta.3",
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
- "prerelease": "yarn build && git --no-pager diff && echo && npm pack --dry-run && echo && read -n 1 -p \"Look OK? Press any key to publish and commit v$npm_package_version\" && echo",
13
- "release": "npm publish && git commit -am \"$npm_package_name v$npm_package_version\" && git push"
14
- },
15
- "dependencies": {
16
- "@hotwired/turbo": "^7.0.0-beta.2",
17
- "@rails/actioncable": "^6.1.0"
18
- },
19
- "devDependencies": {
20
- "@rollup/plugin-node-resolve": "^11.0.1",
21
- "rollup": "^2.35.1",
22
- "rollup-plugin-terser": "^7.0.2"
23
- },
24
- "license": "MIT",
25
- "author": "Basecamp, LLC",
26
- "contributors": [
27
- "David Heinemeier Hansson <david@basecamp.com>",
28
- "Javan Makhmali <javan@javan.us>",
29
- "Sam Stephenson <sstephenson@gmail.com>"
30
- ],
31
- "keywords": [
32
- "hotwire",
33
- "turbo",
34
- "rails"
35
- ],
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/hotwired/turbo-rails.git"
39
- },
40
- "bugs": {
41
- "url": "https://github.com/hotwired/turbo-rails/issues"
42
- },
43
- "homepage": "https://github.com/hotwired/turbo-rails",
44
- "publishConfig": {
45
- "access": "public"
46
- }
47
- }
@@ -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
- }
@@ -1,8 +0,0 @@
1
- require "turbo_test"
2
-
3
- class Turbo::DriveHelperTest < ActionDispatch::IntegrationTest
4
- test "opting out of the default cache" do
5
- get trays_path
6
- assert_select "meta", name: "turbo-cache-control", content: "no-cache"
7
- end
8
- end
@@ -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
- }
@@ -1,3 +0,0 @@
1
- *.log
2
- *.sqlite3
3
- tmp/*
@@ -1,3 +0,0 @@
1
- plugins:
2
- postcss-import: {}
3
- postcss-cssnext: {}
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require_relative 'config/application'
5
-
6
- Rails.application.load_tasks
@@ -1,2 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../stylesheets .css
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
- }
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Channel < ActionCable::Channel::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module ApplicationCable
2
- class Connection < ActionCable::Connection::Base
3
- end
4
- end
@@ -1,2 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- end
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
@@ -1,17 +0,0 @@
1
- class TraysController < ApplicationController
2
- def show
3
- end
4
-
5
- def create
6
- case params[:return_to]
7
- when "recede_or_redirect" then recede_or_redirect_to tray_url(id: 1)
8
- when "resume_or_redirect" then resume_or_redirect_to tray_url(id: 1)
9
- when "refresh_or_redirect" then refresh_or_redirect_to tray_url(id: 1)
10
- when "recede_or_redirect_back" then recede_or_redirect_back_or_to tray_url(id: 5)
11
- when "resume_or_redirect_back" then resume_or_redirect_back_or_to tray_url(id: 5)
12
- when "refresh_or_redirect_back" then refresh_or_redirect_back_or_to tray_url(id: 5)
13
- else
14
- raise "Supply return_to to direct response"
15
- end
16
- end
17
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationMailbox < ActionMailbox::Base
2
- end
@@ -1,4 +0,0 @@
1
- class MessagesMailbox < ApplicationMailbox
2
- def process
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- class ApplicationMailer < ActionMailer::Base
2
- default from: 'from@example.com'
3
- layout 'mailer'
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
File without changes
@@ -1,29 +0,0 @@
1
- class Message
2
- include Turbo::Broadcastable
3
-
4
- attr_reader :record_id, :content
5
-
6
- def initialize(record_id:, content:)
7
- @record_id, @content = record_id, content
8
- end
9
-
10
- def to_key
11
- [ record_id ]
12
- end
13
-
14
- def to_param
15
- "message:#{record_id}"
16
- end
17
-
18
- def to_partial_path
19
- "messages/message"
20
- end
21
-
22
- def to_s
23
- content
24
- end
25
-
26
- def model_name
27
- ActiveModel::Name.new(self.class)
28
- end
29
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= csrf_meta_tags %>
6
-
7
- <%= stylesheet_link_tag 'application', media: 'all' %>
8
- <%= yield :head %>
9
- </head>
10
-
11
- <body>
12
- <%= yield %>
13
- </body>
14
- </html>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <style>
6
- /* Email styles need to be inline */
7
- </style>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
@@ -1 +0,0 @@
1
- <%= yield %>
@@ -1 +0,0 @@
1
- <p><%= message %></p>
@@ -1 +0,0 @@
1
- <%= turbo_stream.replace "message_1" do %>Goodbye!<% end %>
@@ -1,9 +0,0 @@
1
- <%= turbo_stream.remove @message %>
2
- <%= turbo_stream.replace @message %>
3
- <%= turbo_stream.replace @message, "Something else" %>
4
- <%= turbo_stream.replace "message_5", "Something fifth" %>
5
- <%= turbo_stream.replace "message_5", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
6
- <%= turbo_stream.append "messages", @message %>
7
- <%= turbo_stream.append "messages", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
8
- <%= turbo_stream.prepend "messages", @message %>
9
- <%= turbo_stream.prepend "messages", partial: "messages/message", locals: { message: Message.new(record_id: 5, content: "OLLA!") } %>
@@ -1,3 +0,0 @@
1
- <% turbo_exempts_page_from_cache %>
2
-
3
- <p>Not in the cache!</p>
@@ -1,3 +0,0 @@
1
- <turbo-frame id="tray">
2
- <div>This is a tray!</div>
3
- </turbo-frame>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'fileutils'
3
- include FileUtils
4
-
5
- # path to your application root.
6
- APP_ROOT = File.expand_path('..', __dir__)
7
-
8
- def system!(*args)
9
- system(*args) || abort("\n== Command #{args} failed ==")
10
- end
11
-
12
- chdir APP_ROOT do
13
- # This script is a starting point to setup your application.
14
- # Add necessary setup steps to this file.
15
-
16
- puts '== Installing dependencies =='
17
- system! 'gem install bundler --conservative'
18
- system('bundle check') || system!('bundle install')
19
-
20
- # Install JavaScript dependencies if using Yarn
21
- # system('bin/yarn')
22
-
23
- # puts "\n== Copying sample files =="
24
- # unless File.exist?('config/database.yml')
25
- # cp 'config/database.yml.sample', 'config/database.yml'
26
- # end
27
-
28
- puts "\n== Preparing database =="
29
- system! 'bin/rails db:setup'
30
-
31
- puts "\n== Removing old logs and tempfiles =="
32
- system! 'bin/rails log:clear tmp:clear'
33
-
34
- puts "\n== Restarting application server =="
35
- system! 'bin/rails restart'
36
- end