rails-stimulus-generator 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fdf575acaeb091d15dea269d2480b84f1f7818902d727e0e54e86a61fb71f442
4
+ data.tar.gz: e7566101a7c5e8511495eb98248dc05730fa96d2540511bd421a77df561eea30
5
+ SHA512:
6
+ metadata.gz: fab4d81f0b72bd2f6cecf830bd3f335b4d2894c9f1e037171d7b6d01a73b6ffacad4e2649e40c4e81642e67c7b36b26ee8d19c6220a0ca2c72ddc1c01ecb9844
7
+ data.tar.gz: a7fbad7fb59d3db7146908dae2f5cb007ee7e6f45bc18d6d3b4bb76a5b6f48a22e8723c86a80c24b39095c0873e93a170441ab0ffcf7bb9df655fbd8494fb5b6
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+
3
+ class Rails::Generators::StimulusGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ check_class_collision suffix: "Controller"
7
+
8
+ def create_controller_directory
9
+ empty_directory("app/javascript/controllers") unless File.directory?("app/javascript/controllers")
10
+ end
11
+
12
+ def create_controller
13
+ template('controller.js', File.join("app/javascript/controllers/#{file_name}_controller.js"))
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ import { Controller } from 'stimulus'
2
+
3
+ export default class extends Controller {
4
+ static targets = []
5
+
6
+ initialize() {
7
+ // Called once, when the controller is first instantiated
8
+ }
9
+
10
+ connect() {
11
+ // Called any time the controller is connected to the DOM
12
+ }
13
+
14
+ disconnect() {
15
+ // Called any time the controller is disconnected from the DOM
16
+ }
17
+ }
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-stimulus-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Colby
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: david@colby.so
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/generators/rails/stimulus_generator.rb
20
+ - lib/generators/rails/templates/controller.js
21
+ homepage: https://github.com/DavidColby/rails-stimulus-generator
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.1.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A simple Rails generator to create new Stimulus controllers
44
+ test_files: []