stimulus-audit 0.1.0 → 0.1.1

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: d97ee4d76118febf8f6d72f4434bdcef35e925dd5871bbc624bfb221e0cd0fd3
4
- data.tar.gz: a54d0519141cced0080073a8713ae0d923e0452b0203817543cc1b99ed95c44d
3
+ metadata.gz: 44aec4de9edc55269fa1f50a6c6320d53a5f4f829c842664f34abe0deca73f9a
4
+ data.tar.gz: f1a8807907157c4d7fe597868d89d784747f7c3ee17f1e9ee7d8163137aa6518
5
5
  SHA512:
6
- metadata.gz: '0458a1420dfd0419ceefe18b4a70e8ba676690c99e700b21a594cedf7d397f41ac884555233fb6bf6dccf9e13bfc48f7f7f54b3dcd5cb30badb71ce387f42b89'
7
- data.tar.gz: 67e254902d28bdf8abfa7d268cc6f603ffe6893420c7fab4652d9eed3b2cac0c5cd8899cf0387da938b25fb007db7fff8068f70215b7a4164da4d1108222a459
6
+ metadata.gz: 7a23584890601a2c8cef266804f0e1e78d49433a98acb9af9ea6d60a8ae08fb0649c4d2c15462cc54e06abff550ffc488cf216be46d996baec6dde7a7f5fe2f7
7
+ data.tar.gz: ce44e110b93cc136fc0827e11c759be1f30df8da008136956273a840664129528bd3bd9c3ef9ab7fca57027303b49024a6018336489df58bd51d6fcf0da2bb62
@@ -34,8 +34,8 @@ module StimulusAudit
34
34
  controller_path = full_path.each_filename.to_a[(controllers_dir + 1)..]
35
35
  # Remove _controller.js from the last component
36
36
  controller_path[-1] = controller_path[-1].sub(/_controller\.(js|ts)$/, "")
37
- # Join with -- for namespacing
38
- name = controller_path.join("--")
37
+ # Join with -- for namespacing and convert underscores to hyphens
38
+ name = controller_path.join("--").gsub("_", "-")
39
39
  controllers << name
40
40
  end
41
41
  end
@@ -54,8 +54,10 @@ module StimulusAudit
54
54
  content = File.read(file)
55
55
  patterns.each do |pattern|
56
56
  content.scan(pattern) do |match|
57
- # Split in case of multiple controllers: "users--name list toggle"
57
+ # Split in case of multiple controllers
58
58
  match[0].split(/\s+/).each do |controller|
59
+ # Store controller names exactly as they appear in the view
60
+ # (they should already have hyphens as per Stimulus conventions)
59
61
  controllers << controller
60
62
  end
61
63
  end
@@ -12,13 +12,13 @@ module StimulusAudit
12
12
  base_path = StimulusAudit.root
13
13
 
14
14
  @view_paths = [
15
- base_path.join('app/views/**/*.{html,erb,haml}').to_s,
16
- base_path.join('app/javascript/**/*.{js,jsx}').to_s,
17
- base_path.join('app/components/**/*.{html,erb,haml,rb}').to_s
15
+ base_path.join("app/views/**/*.{html,erb,haml}").to_s,
16
+ base_path.join("app/javascript/**/*.{js,jsx}").to_s,
17
+ base_path.join("app/components/**/*.{html,erb,haml,rb}").to_s
18
18
  ]
19
19
 
20
20
  @controller_paths = [
21
- base_path.join('app/javascript/controllers/**/*.{js,ts}').to_s
21
+ base_path.join("app/javascript/controllers/**/*.{js,ts}").to_s
22
22
  ]
23
23
  end
24
24
  end
@@ -5,5 +5,9 @@ module StimulusAudit
5
5
  rake_tasks do
6
6
  load "tasks/stimulus_audit.rake"
7
7
  end
8
+
9
+ initializer "stimulus-audit.setup" do
10
+ require "stimulus_audit"
11
+ end
8
12
  end
9
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusAudit
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'set'
4
- require 'pathname'
3
+ require "set"
4
+ require "pathname"
5
5
  require "stimulus_audit/version"
6
6
  require "stimulus_audit/configuration"
7
7
  require "stimulus_audit/auditor"
@@ -9,7 +9,7 @@ require "stimulus_audit/scanner"
9
9
 
10
10
  if defined?(Rails)
11
11
  require "rails"
12
- require "stimulus_audit/railtie"
12
+ require "stimulus_audit/railtie"
13
13
  end
14
14
 
15
15
  module StimulusAudit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby