hotwired_component 0.1.0 → 0.2.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: 53fe46ef3fafbc1eeb3ea15eaf5122a88e9ce66792292f9aa03b284f1ae9bb1e
4
- data.tar.gz: 037be62c8b4f47abb5992b8a59698a30e74f1277a20b6ee95a3770a4932749f8
3
+ metadata.gz: e54c39d514ec1c512a060a3260142f8ceb8847055bc071c1a83a44a90da3e507
4
+ data.tar.gz: dadfb497f35a9ed01ffbf236e4727cf529fcc2e7291c067a8c7df5f2cb71f7dc
5
5
  SHA512:
6
- metadata.gz: 5a41c571d89f15a08a31fbb8348247da1999cf510e3af226d673f38abf215ce8642695840b4670a91280823cc51c1df6298060278d290d55879472a5ef53c179
7
- data.tar.gz: df2271c1b826c3c0d1d02aac3255b98814a92bba3d4c262a16dd94a2180659e4114e7a73dd5ad9c26c4fb489736fa530f3e6ae1eb8f09344c04732010690ec9a
6
+ metadata.gz: 6684a70a745b802a9b3096ed0b2ee38eba5534bc93c42998f654103ec473a44ac4b203ce25d1403a071e0aa902f9d311643ad3a78a502147cbaad1dd0a09d316
7
+ data.tar.gz: '0822e71d8d76dcae04f099754ce20668235ba76ee52f52eb6445e1814476c7a1b6c6357f20f2c44c00a7b01f72e6a36337dec4b724a57066655df54fa3abd7f4'
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ bin/rails generate install Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,35 @@
1
+ module HotwiredComponent
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates', __dir__)
4
+
5
+ def install_hotwired_rails
6
+ run "rails hotwire:install"
7
+ end
8
+
9
+ def add_component_controllers
10
+ append_to_file "app/javascript/packs/application.js" do
11
+ <<~JAVASCRIPT
12
+ const component_stylesheets = require.context(
13
+ "../../components/",
14
+ true,
15
+ /\.scss$/
16
+ );
17
+
18
+ component_stylesheets.keys().map(component_stylesheets);
19
+ JAVASCRIPT
20
+
21
+ end
22
+ append_to_file "app/javascript/controllers/index.js" do
23
+ <<~JAVASCRIPT
24
+ context = require.context("components", true, /_controller\.js$/)
25
+ application.load(definitionsFromContext(context))
26
+ JAVASCRIPT
27
+ end
28
+ end
29
+
30
+ def update_webpacker_config
31
+ gsub_file "config/webpacker.yml", "additional_paths: [",
32
+ "additional_paths: [\"app/components\""
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,5 @@
1
+ require "hotwire-rails"
2
+
1
3
  require "hotwired_component/version"
2
4
  require "hotwired_component/engine"
3
5
 
@@ -1,3 +1,3 @@
1
1
  module HotwiredComponent
2
- VERSION = '0.1.0'
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotwired_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fugufish
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 6.1.3.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: hotwire-rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.1'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.1'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: view_component
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -62,6 +76,8 @@ files:
62
76
  - lib/generators/hotwired_component/component/templates/component.scss.erb
63
77
  - lib/generators/hotwired_component/component/templates/component_controller.js.erb
64
78
  - lib/generators/hotwired_component/component/templates/component_spec.rb.erb
79
+ - lib/generators/hotwired_component/install/USAGE
80
+ - lib/generators/hotwired_component/install/install_generator.rb
65
81
  - lib/hotwired_component.rb
66
82
  - lib/hotwired_component/engine.rb
67
83
  - lib/hotwired_component/version.rb