stimulus-rails 0.7.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36db05dc612c8667658d3890d285dd464a134aff6cfaf2170154a9d029ab9202
|
4
|
+
data.tar.gz: cd111c34efb2614658a7cb076378ab7517b81ac21ceca7bec9e54b51525e148b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21a6c69a253e569e1ddf6eed89c265ce66e01910e7536474204aa25d1568b5606b5d6c4d565348f78978f4b9898bfae7d5a9289dd5dd94e18c6d0bc54221c6b3
|
7
|
+
data.tar.gz: 9a33a50c99c607915049c85cfa74f1ea2864456d685be780e867c127d4c24de13dc1f9ba44d194086cf683adb6df589aee284fd7f7fa4b377fd91d9a5bc535a1
|
data/README.md
CHANGED
@@ -7,6 +7,8 @@ Stimulus for Rails makes it easy to use this modest framework with both import-m
|
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
+
This gem is automatically configured for applications made with Rails 7+ (unless `--skip-hotwire` is passed to the generator). But if you're on Rails 6, you can install it manually with:
|
11
|
+
|
10
12
|
1. Add the `stimulus-rails` gem to your Gemfile: `gem 'stimulus-rails'`
|
11
13
|
2. Run `./bin/bundle install`.
|
12
14
|
3. Run `./bin/rails stimulus:install`
|
@@ -4,13 +4,17 @@ class StimulusGenerator < Rails::Generators::NamedBase # :nodoc:
|
|
4
4
|
source_root File.expand_path("templates", __dir__)
|
5
5
|
|
6
6
|
def copy_view_files
|
7
|
-
@attribute = stimulus_attribute_value(
|
8
|
-
template "controller.js", "app/javascript/controllers/#{
|
7
|
+
@attribute = stimulus_attribute_value(controller_name)
|
8
|
+
template "controller.js", "app/javascript/controllers/#{controller_name}_controller.js"
|
9
9
|
rails_command "stimulus:manifest:update" if Rails.root.join("package.json").exist?
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
|
-
def
|
14
|
-
name.
|
13
|
+
def controller_name
|
14
|
+
name.underscore.gsub(/_controller$/, "")
|
15
|
+
end
|
16
|
+
|
17
|
+
def stimulus_attribute_value(controller_name)
|
18
|
+
controller_name.gsub(/\//, "--").gsub("_", "-")
|
15
19
|
end
|
16
20
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
2
|
-
// Run that command whenever you add a new controller
|
2
|
+
// Run that command whenever you add a new controller or create them with
|
3
|
+
// ./bin/rails generate stimulus controllerName
|
3
4
|
|
4
5
|
import { application } from "./application"
|
5
6
|
|
data/lib/stimulus/version.rb
CHANGED
@@ -37,7 +37,8 @@ namespace :stimulus do
|
|
37
37
|
|
38
38
|
File.open(Rails.root.join("app/javascript/controllers/index.js"), "w+") do |index|
|
39
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"
|
40
|
+
index.puts "// Run that command whenever you add a new controller or create them with"
|
41
|
+
index.puts "// ./bin/rails generate stimulus controllerName"
|
41
42
|
index.puts
|
42
43
|
index.puts %(import { application } from "./application")
|
43
44
|
index.puts manifest
|
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.0
|
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-14 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
|
- - ">="
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.2.
|
79
|
+
rubygems_version: 3.2.32
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: A modest JavaScript framework for the HTML you already have.
|