stimulus-rails 0.3.9 → 1.0.2
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/README.md +20 -31
- data/app/assets/javascripts/stimulus-autoloader.js +2 -0
- data/app/assets/javascripts/stimulus-importmap-autoloader.js +18 -12
- data/app/assets/javascripts/stimulus-loading.js +81 -0
- data/app/assets/javascripts/stimulus.js +1948 -1
- data/app/assets/javascripts/stimulus.min.js +5 -0
- data/app/assets/javascripts/stimulus.min.js.map +1 -0
- data/lib/generators/stimulus/USAGE +15 -0
- data/lib/generators/stimulus/stimulus_generator.rb +20 -0
- data/lib/generators/stimulus/templates/controller.js.tt +7 -0
- data/lib/install/app/javascript/controllers/application.js +9 -0
- data/lib/install/app/javascript/controllers/index_for_importmap.js +11 -0
- data/lib/install/app/javascript/controllers/index_for_node.js +8 -0
- data/lib/install/stimulus_with_importmap.rb +19 -0
- data/lib/install/stimulus_with_node.rb +18 -0
- data/lib/stimulus/engine.rb +1 -1
- data/lib/stimulus/manifest.rb +28 -0
- data/lib/stimulus/version.rb +1 -1
- data/lib/tasks/stimulus_tasks.rake +33 -11
- metadata +16 -8
- data/app/assets/javascripts/stimulus@2.js +0 -1699
- data/lib/install/app/javascript/controllers/index.js +0 -9
- data/lib/install/stimulus_with_asset_pipeline.rb +0 -27
- data/lib/install/stimulus_with_webpacker.rb +0 -11
@@ -1,26 +1,48 @@
|
|
1
|
+
require "stimulus/manifest"
|
2
|
+
|
1
3
|
def run_stimulus_install_template(path) system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/#{path}.rb", __dir__)}" end
|
2
4
|
|
3
5
|
namespace :stimulus do
|
4
6
|
desc "Install Stimulus into the app"
|
5
7
|
task :install do
|
6
|
-
if
|
7
|
-
Rake::Task["stimulus:install:
|
8
|
-
elsif
|
9
|
-
Rake::Task["stimulus:install:
|
8
|
+
if Rails.root.join("config/importmap.rb").exist?
|
9
|
+
Rake::Task["stimulus:install:importmap"].invoke
|
10
|
+
elsif Rails.root.join("package.json").exist?
|
11
|
+
Rake::Task["stimulus:install:node"].invoke
|
10
12
|
else
|
11
|
-
puts "You must either be running
|
13
|
+
puts "You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem."
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
namespace :install do
|
16
|
-
desc "Install Stimulus on
|
17
|
-
task :
|
18
|
-
run_stimulus_install_template "
|
18
|
+
desc "Install Stimulus on an app running importmap-rails"
|
19
|
+
task :importmap do
|
20
|
+
run_stimulus_install_template "stimulus_with_importmap"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Install Stimulus on an app running node"
|
24
|
+
task :node do
|
25
|
+
run_stimulus_install_template "stimulus_with_node"
|
19
26
|
end
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
task :display do
|
31
|
+
puts Stimulus::Manifest.generate_from(Rails.root.join("app/javascript/controllers"))
|
32
|
+
end
|
33
|
+
|
34
|
+
task :update do
|
35
|
+
manifest =
|
36
|
+
Stimulus::Manifest.generate_from(Rails.root.join("app/javascript/controllers"))
|
20
37
|
|
21
|
-
|
22
|
-
|
23
|
-
|
38
|
+
File.open(Rails.root.join("app/javascript/controllers/index.js"), "w+") do |index|
|
39
|
+
index.puts "// This file is auto-generated by ./bin/rails stimulus:manifest:update"
|
40
|
+
index.puts "// Run that command whenever you add a new controller or create them with"
|
41
|
+
index.puts "// ./bin/rails generate stimulus controllerName"
|
42
|
+
index.puts
|
43
|
+
index.puts %(import { application } from "./application")
|
44
|
+
index.puts manifest
|
45
|
+
end
|
24
46
|
end
|
25
47
|
end
|
26
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,10 +10,10 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: railties
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
@@ -37,14 +37,22 @@ files:
|
|
37
37
|
- Rakefile
|
38
38
|
- app/assets/javascripts/stimulus-autoloader.js
|
39
39
|
- app/assets/javascripts/stimulus-importmap-autoloader.js
|
40
|
+
- app/assets/javascripts/stimulus-loading.js
|
40
41
|
- app/assets/javascripts/stimulus.js
|
41
|
-
- app/assets/javascripts/stimulus
|
42
|
+
- app/assets/javascripts/stimulus.min.js
|
43
|
+
- app/assets/javascripts/stimulus.min.js.map
|
44
|
+
- lib/generators/stimulus/USAGE
|
45
|
+
- lib/generators/stimulus/stimulus_generator.rb
|
46
|
+
- lib/generators/stimulus/templates/controller.js.tt
|
47
|
+
- lib/install/app/javascript/controllers/application.js
|
42
48
|
- lib/install/app/javascript/controllers/hello_controller.js
|
43
|
-
- lib/install/app/javascript/controllers/
|
44
|
-
- lib/install/
|
45
|
-
- lib/install/
|
49
|
+
- lib/install/app/javascript/controllers/index_for_importmap.js
|
50
|
+
- lib/install/app/javascript/controllers/index_for_node.js
|
51
|
+
- lib/install/stimulus_with_importmap.rb
|
52
|
+
- lib/install/stimulus_with_node.rb
|
46
53
|
- lib/stimulus-rails.rb
|
47
54
|
- lib/stimulus/engine.rb
|
55
|
+
- lib/stimulus/manifest.rb
|
48
56
|
- lib/stimulus/version.rb
|
49
57
|
- lib/tasks/stimulus_tasks.rake
|
50
58
|
homepage: https://stimulus.hotwired.dev
|
@@ -68,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
76
|
- !ruby/object:Gem::Version
|
69
77
|
version: '0'
|
70
78
|
requirements: []
|
71
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.2.32
|
72
80
|
signing_key:
|
73
81
|
specification_version: 4
|
74
82
|
summary: A modest JavaScript framework for the HTML you already have.
|