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: 0fa354a81d7e2305ae1f6e333ca31844b04f1bce376b9df1b502574c73725728
4
- data.tar.gz: 3192954bcd22ebb74c854751646b7089092ed1066a35e778a50bb2384bc0ce30
3
+ metadata.gz: 36db05dc612c8667658d3890d285dd464a134aff6cfaf2170154a9d029ab9202
4
+ data.tar.gz: cd111c34efb2614658a7cb076378ab7517b81ac21ceca7bec9e54b51525e148b
5
5
  SHA512:
6
- metadata.gz: abde8638a567a585f5ec33a9a194da0e28c3263cabb03ca7a42e6628c91fb636a8ef9218bf82856c30acc502cfbae18d59164758254601275cbe40379be83b1c
7
- data.tar.gz: 0cd6800704eea7cfaf913b02b460475b2e6e8b3e20ec28c0db28cf3e10effd9d8f60fec42442a5b28d1e91f2966e59a6cd14bed5c0f3a279a5cc0a6ef22897ca
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(name)
8
- template "controller.js", "app/javascript/controllers/#{name}_controller.js"
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 stimulus_attribute_value(name)
14
- name.gsub(/\//, "--").gsub("_", "-")
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
 
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "0.7.3"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -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.7.3
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-11-24 00:00:00.000000000 Z
13
+ date: 2021-12-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rails
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.22
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.