ordit 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5ebf59e6ecec8bf7ff9c2e8f90923426694c8b9a0fb50ed0ac969e5e881fe5c
4
- data.tar.gz: 6fdbb94c19ea9cfec2596571b04f6e58993af1dd83b5194023b2bcb435bce6b2
3
+ metadata.gz: 85359a41eabc4eca9dd38bf08749860a980e7eb3a4f31c4e1550243a141fa14a
4
+ data.tar.gz: c2fb171d7a685aa3180c00fa3aee02af58d265f53e35d7d1eca7ca66bd33a3a3
5
5
  SHA512:
6
- metadata.gz: e1815e1b1fe8e70814d121d485785b5dcc21a435e9d70cccb75156e914508cc2d7f8cc03c991f0dbe47136745e7f26e955b4384f8c4d74234598c4945485bcb1
7
- data.tar.gz: b22613d4aaa8f7f405bcf3249ac24ab43c80be89847dd6d1709dd92d9cb840309e223ccfa31edf6075faee7e4d8d7c95bb62a2a69223e6a8f35097b37ba86862
6
+ metadata.gz: 8366966cf1d4fed14fe17580e926d01e0f2f2450f4499b7fd724cda766cdf774cd0edd4203a418c9f7fc6445082366604cd32284372af70324988c24a91eefe8
7
+ data.tar.gz: 1d9af5057943c712b64116749d069cd8a737ae0a0338e32e8a7e11037b1b35a5701afc40a530fe82b768c22cc77196e21557cb44b312e8a16dc1948622843ab3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.4] - 2024-16-12
4
+
5
+ - remove scan, your editor does this already
6
+
3
7
  ## [0.1.3] - 2024-16-12
4
8
 
5
9
  - more refactor, clean up, make more logical
data/README.md CHANGED
@@ -17,7 +17,7 @@ bundle install
17
17
 
18
18
  ## Usage
19
19
 
20
- ### Audit All Controllers
20
+ ### Audit Stimulus Controllers
21
21
 
22
22
  Run an audit to see all defined and used controllers in your application:
23
23
 
@@ -45,26 +45,6 @@ Example output:
45
45
 
46
46
  ```
47
47
 
48
- ### Scan for Specific Controller Usage
49
-
50
- Find all uses of a specific controller:
51
-
52
- ```bash
53
- rails ordit:scan[toggle]
54
- rails ordit:scan[users--name] # For namespaced controllers
55
- ```
56
-
57
- Example output:
58
-
59
- ```
60
- Searching for stimulus controller: 'toggle'
61
-
62
- 📁 app/views/admin/new.html.erb
63
- 📁 app/views/posts/edit.html.erb
64
- 📁 app/views/products/show.html.erb
65
- 📁 app/views/users/edit.html.erb
66
- ```
67
-
68
48
  ### Configuration
69
49
 
70
50
  You can customize the paths that are scanned in an initializer (`config/initializers/ordit.rb`):
@@ -98,6 +78,9 @@ end
98
78
 
99
79
  # Hash rocket syntax
100
80
  <%= f.submit 'Save', data: { :controller => 'products' } %>
81
+
82
+ # Hash rocket string syntax
83
+ <%= f.submit 'Save', 'data' => { 'controller' => 'products' } %>
101
84
  ```
102
85
  - Scans ERB, HTML, and HAML files
103
86
  - Works with both JavaScript and TypeScript controller files
@@ -6,21 +6,18 @@ module Ordit
6
6
  class ConsoleOutput
7
7
  extend Forwardable
8
8
 
9
- def self.run(name = nil)
10
- new(name).run
9
+ def self.run
10
+ new.run
11
11
  end
12
12
 
13
13
  def_delegators :@results,
14
14
  :files, :active_controllers, :undefined_controllers, :unused_controllers
15
15
 
16
- def initialize(name = nil)
17
- @name = name
18
- @results = Results.new(name)
16
+ def initialize
17
+ @results = Results.new
19
18
  end
20
19
 
21
20
  def run
22
- return print_find if @name
23
-
24
21
  print_audit
25
22
  end
26
23
 
@@ -51,18 +48,5 @@ module Ordit
51
48
  puts " Unused controllers: #{unused_controllers.size}"
52
49
  puts " Undefined controllers: #{undefined_controllers.size}"
53
50
  end
54
-
55
- def print_find
56
- puts "\nSearching for stimulus controller: '#{@name}'\n\n"
57
-
58
- if files.empty?
59
- puts "No matches found."
60
- return
61
- end
62
-
63
- files.each do |file|
64
- puts "📁 #{file}"
65
- end
66
- end
67
51
  end
68
52
  end
@@ -19,19 +19,5 @@ module Ordit
19
19
  end
20
20
  end
21
21
  end
22
-
23
- def self.find(name)
24
- Ordit.configuration.view_paths.flat_map do |path|
25
- results = Dir.glob(path.to_s).reject do |file|
26
- content = File.read(file)
27
- matches = DefinitionMatcher.run(content)
28
- matches.empty?
29
- end
30
-
31
- results.flat_map do |result|
32
- Pathname.new(result).relative_path_from(Pathname.new(Ordit.root)).to_s
33
- end
34
- end
35
- end
36
22
  end
37
23
  end
data/lib/ordit/results.rb CHANGED
@@ -2,13 +2,10 @@
2
2
 
3
3
  module Ordit
4
4
  class Results
5
- def initialize(name = nil)
6
- @name = name
5
+ def initialize
7
6
  end
8
7
 
9
8
  def files
10
- return Definitions.find(@name) if @name
11
-
12
9
  Files.all
13
10
  end
14
11
 
data/lib/ordit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ordit
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/tasks/ordit.rake CHANGED
@@ -5,16 +5,4 @@ namespace :ordit do
5
5
  task stimulus: :environment do
6
6
  Ordit::ConsoleOutput.run
7
7
  end
8
-
9
- desc "Scan files for stimulus controller usage (e.g., rake audit:scan[products])"
10
- task :scan, [:controller] => :environment do |_, args|
11
- controller = args[:controller]
12
-
13
- if controller.nil? || controller.empty?
14
- puts "Please provide a controller name: rake ordit:scan[controller_name]"
15
- next
16
- end
17
-
18
- Ordit::ConsoleOutput.run(controller)
19
- end
20
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake