turbo-rails 0.7.10 → 0.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/install/turbo_with_importmap.rb +5 -0
- data/lib/install/turbo_with_node.rb +9 -0
- data/lib/tasks/turbo_tasks.rake +9 -7
- data/lib/turbo/version.rb +1 -1
- metadata +4 -4
- data/lib/install/turbo_with_asset_pipeline.rb +0 -18
- data/lib/install/turbo_with_webpacker.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fe3ad5cd094491982825ff80d21c619aab81bbcbe7e07168e467beeb3daa493
|
4
|
+
data.tar.gz: 757f2faa9d39389014fc277ef75d3c806c9864b1deb87f6efae5118c604cf89b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38bd507e3eaeeccd3e8e570e3341cdc8ae27074ba03d3e509605a13f3df4188bd54250bbbb8f6161e3d3e261e5ae6edd928d3fb2aac7fd8d9ede9e7c1810717
|
7
|
+
data.tar.gz: 77f0a351ce8ab0cca1bc69413a508d6d8b790f61e18623ae16aad7d929536baa4f8c75b6407e6752d5301d022f0b49472c4376506181d1ffd31ed91b033459a2
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ The JavaScript for Turbo can either be run through the asset pipeline, which is
|
|
50
50
|
|
51
51
|
Running `turbo:install` will install through NPM if Webpacker is installed in the application. Otherwise the asset pipeline version is used. To use the asset pipeline version, you must have `importmap-rails` installed first and listed higher in the Gemfile.
|
52
52
|
|
53
|
-
If you're using
|
53
|
+
If you're using node and need to use the cable consumer, you can import [`cable`](https://github.com/hotwired/turbo-rails/blob/main/app/javascript/turbo/cable.js) (`import { cable } from "@hotwired/turbo-rails"`), but ensure that your application actually *uses* the members it `import`s when using this style (see [turbo-rails#48](https://github.com/hotwired/turbo-rails/issues/48)).
|
54
54
|
|
55
55
|
The `Turbo` instance is automatically assigned to `window.Turbo` upon import:
|
56
56
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
if (js_entrypoint_path = Rails.root.join("app/javascript/application.js")).exist?
|
2
|
+
say "Import Turbo"
|
3
|
+
append_to_file "app/javascript/application.js", %(import "@hotwired/turbo-rails"\n)
|
4
|
+
else
|
5
|
+
say "You must import @hotwired/turbo-rails in your JavaScript entrypoint file", :red
|
6
|
+
end
|
7
|
+
|
8
|
+
say "Install Turbo"
|
9
|
+
run "yarn add @hotwired/turbo-rails"
|
data/lib/tasks/turbo_tasks.rake
CHANGED
@@ -17,23 +17,25 @@ end
|
|
17
17
|
namespace :turbo do
|
18
18
|
desc "Install Turbo into the app"
|
19
19
|
task :install do
|
20
|
-
if
|
21
|
-
Rake::Task["turbo:install:
|
20
|
+
if Rails.root.join("config/importmap.rb").exist?
|
21
|
+
Rake::Task["turbo:install:importmap"].invoke
|
22
|
+
elsif Rails.root.join("package.json").exist?
|
23
|
+
Rake::Task["turbo:install:node"].invoke
|
22
24
|
else
|
23
|
-
|
25
|
+
puts "You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem."
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
namespace :install do
|
28
30
|
desc "Install Turbo into the app with asset pipeline"
|
29
|
-
task :
|
30
|
-
run_turbo_install_template "
|
31
|
+
task :importmap do
|
32
|
+
run_turbo_install_template "turbo_with_importmap"
|
31
33
|
switch_on_redis_if_available
|
32
34
|
end
|
33
35
|
|
34
36
|
desc "Install Turbo into the app with webpacker"
|
35
|
-
task :
|
36
|
-
run_turbo_install_template "
|
37
|
+
task :node do
|
38
|
+
run_turbo_install_template "turbo_with_node"
|
37
39
|
switch_on_redis_if_available
|
38
40
|
end
|
39
41
|
|
data/lib/turbo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-09-
|
13
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -57,8 +57,8 @@ files:
|
|
57
57
|
- app/models/turbo/streams/tag_builder.rb
|
58
58
|
- config/routes.rb
|
59
59
|
- lib/install/turbo_needs_redis.rb
|
60
|
-
- lib/install/
|
61
|
-
- lib/install/
|
60
|
+
- lib/install/turbo_with_importmap.rb
|
61
|
+
- lib/install/turbo_with_node.rb
|
62
62
|
- lib/tasks/turbo_tasks.rake
|
63
63
|
- lib/turbo-rails.rb
|
64
64
|
- lib/turbo/engine.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
if (app_js_path = Rails.root.join("app/javascript/application.js")).exist?
|
2
|
-
say "Import turbo-rails in existing app/javascript/application.js"
|
3
|
-
append_to_file app_js_path, %(import "@hotwired/turbo-rails"\n)
|
4
|
-
else
|
5
|
-
say <<~INSTRUCTIONS, :red
|
6
|
-
You must import @hotwired/turbo-rails in your application.js.
|
7
|
-
INSTRUCTIONS
|
8
|
-
end
|
9
|
-
|
10
|
-
if (importmap_path = Rails.root.join("config/importmap.rb")).exist?
|
11
|
-
say "Pin @hotwired/turbo-rails in config/importmap.rb"
|
12
|
-
append_to_file importmap_path.to_s, %(pin "@hotwired/turbo-rails", to: "turbo.js"\n)
|
13
|
-
else
|
14
|
-
say <<~INSTRUCTIONS, :red
|
15
|
-
You must add @hotwired/turbo-rails to your importmap to reference them via ESM.
|
16
|
-
Example: pin "@hotwired/turbo-rails", to: "turbo.js"
|
17
|
-
INSTRUCTIONS
|
18
|
-
end
|