turbo-rails 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/install/turbo_with_asset_pipeline.rb +22 -3
- data/lib/install/turbo_with_webpacker.rb +3 -13
- data/lib/turbo/engine.rb +0 -6
- data/lib/turbo/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2608402a944433e82b78b6aed5ac64e54579566e23a5a3b1a6837a695c7031ff
|
4
|
+
data.tar.gz: b342da8a4a13bc4b9fbbec5ee1a06afff0db881e3ab4103adba4c47188dd351a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9183cb91a6ce9b2bc0b401ec35b7a3ff835b30d2732c96c6ab8db6ef23a3276e80e08ade5648ceb118c00a8cb5b2b07bb87e6ac8451224bf72885d12fcde2204
|
7
|
+
data.tar.gz: 0665d67d6cb734a670c12412588e23359a63204a72d92fce01a940e19b34e3e8a4217acf42e88b61d60b0700b6bc36ed2fba3e533140ea69503a7a047597fea0
|
@@ -1,8 +1,27 @@
|
|
1
|
-
|
1
|
+
APP_JS_PATH = Rails.root.join("app/javascript/application.js")
|
2
2
|
CABLE_CONFIG_PATH = Rails.root.join("config/cable.yml")
|
3
|
+
IMPORTMAP_PATH = Rails.root.join("config/importmap.rb")
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
if APP_JS_PATH.exist?
|
6
|
+
say "Import turbo-rails in existing app/javascript/application.js"
|
7
|
+
append_to_file APP_JS_PATH, %(import "@hotwired/turbo-rails"\n)
|
8
|
+
else
|
9
|
+
say <<~INSTRUCTIONS, :red
|
10
|
+
You must import @hotwire/turbo-rails in your application.js.
|
11
|
+
INSTRUCTIONS
|
12
|
+
end
|
13
|
+
|
14
|
+
if IMPORTMAP_PATH.exist?
|
15
|
+
say "Pin @hotwired/turbo-rails in config/importmap.rb"
|
16
|
+
insert_into_file \
|
17
|
+
IMPORTMAP_PATH.to_s,
|
18
|
+
%( pin "@hotwired/turbo-rails", to: "turbo.js"\n\n),
|
19
|
+
after: "Rails.application.config.importmap.draw do\n"
|
20
|
+
else
|
21
|
+
say <<~INSTRUCTIONS, :red
|
22
|
+
You must add @hotwire/turbo-rails to your importmap to reference them via ESM.
|
23
|
+
INSTRUCTIONS
|
24
|
+
end
|
6
25
|
|
7
26
|
if CABLE_CONFIG_PATH.exist?
|
8
27
|
say "Enable redis in bundle"
|
@@ -1,20 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
ACTIVE_STORAGE_REGEX = /(import.*ActiveStorage|require.*@rails\/activestorage.*)/.freeze
|
4
|
-
CABLE_CONFIG_PATH = Rails.root.join("config/cable.yml")
|
5
|
-
|
6
|
-
abort "❌ Webpacker not found. Exiting." unless defined?(Webpacker::Engine)
|
1
|
+
say "Appending Turbo setup code to #{Webpacker.config.source_entry_path}/application.js"
|
2
|
+
append_to_file "#{Webpacker.config.source_entry_path}/application.js", %(\nimport "@hotwired/turbo-rails"\n)
|
7
3
|
|
8
4
|
say "Install Turbo"
|
9
5
|
run "yarn add @hotwired/turbo-rails"
|
10
|
-
insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "import \"@hotwired/turbo-rails\"\n", before: ACTIVE_STORAGE_REGEX
|
11
6
|
|
12
|
-
|
13
|
-
run "#{RbConfig.ruby} bin/bundle remove turbolinks"
|
14
|
-
run "#{RbConfig.ruby} bin/bundle", capture: true
|
15
|
-
run "#{RbConfig.ruby} bin/yarn remove turbolinks"
|
16
|
-
gsub_file "#{Webpacker.config.source_entry_path}/application.js", TURBOLINKS_REGEX, ''
|
17
|
-
gsub_file "#{Webpacker.config.source_entry_path}/application.js", /Turbolinks.start.*\n/, ''
|
7
|
+
CABLE_CONFIG_PATH = Rails.root.join("config/cable.yml")
|
18
8
|
|
19
9
|
if CABLE_CONFIG_PATH.exist?
|
20
10
|
say "Enable redis in bundle"
|
data/lib/turbo/engine.rb
CHANGED
@@ -26,12 +26,6 @@ module Turbo
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
initializer "turbo.importmap" do
|
30
|
-
if Rails.application.config.respond_to?(:importmap)
|
31
|
-
Rails.application.config.importmap.pin "@hotwired/turbo-rails", to: "turbo.js"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
29
|
initializer "turbo.helpers", before: :load_config_initializers do
|
36
30
|
ActiveSupport.on_load(:action_controller_base) do
|
37
31
|
include Turbo::Streams::TurboStreamsTagBuilder, Turbo::Frames::FrameRequest, Turbo::Native::Navigation
|
data/lib/turbo/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
8
8
|
- Javan Mahkmali
|
9
9
|
- David Heinemeier Hansson
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-08-
|
13
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 6.0.0
|
29
|
-
description:
|
29
|
+
description:
|
30
30
|
email: david@loudthinking.com
|
31
31
|
executables: []
|
32
32
|
extensions: []
|
@@ -67,7 +67,7 @@ homepage: https://github.com/hotwired/turbo-rails
|
|
67
67
|
licenses:
|
68
68
|
- MIT
|
69
69
|
metadata: {}
|
70
|
-
post_install_message:
|
70
|
+
post_install_message:
|
71
71
|
rdoc_options: []
|
72
72
|
require_paths:
|
73
73
|
- lib
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubygems_version: 3.1.4
|
86
|
-
signing_key:
|
86
|
+
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: The speed of a single-page web application without having to write any JavaScript.
|
89
89
|
test_files: []
|