vinter 0.6.0 → 0.6.2
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 +4 -4
- data/lib/vinter/cli.rb +54 -6
- data/lib/vinter.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e47fb1e67cb9cf9a42ef421129fc7002bcc1471c39e4e62ff3ff78a480498fe6
|
|
4
|
+
data.tar.gz: d6b42a562879298291c5e613ef76a6af680f9aaf794152c4ced90aebe37f51a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62cb9236451e5a58a36115d307b5a98bbd8e0759cb0212b97a53908168b74d4ee04a375798f6b34e3e79625aa1bf22be7cfb3b4c66b9b10fe41cc9bf969d0cea
|
|
7
|
+
data.tar.gz: ed8cf7eaccb6e1fc46080b41f66502c375cca18762ea8c38369f71ede1a850c2b843cc9afa1ff32575ec056c2fa38397adee0a6c8f473727fe1a3ec266221e48
|
data/lib/vinter/cli.rb
CHANGED
|
@@ -6,21 +6,45 @@ module Vinter
|
|
|
6
6
|
|
|
7
7
|
def run(args)
|
|
8
8
|
if args.empty?
|
|
9
|
-
puts "Usage: vinter [file.vim|directory]"
|
|
9
|
+
puts "Usage: vinter [file.vim|directory] [--exclude=dir1,dir2]"
|
|
10
10
|
return 1
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# Parse args: first non-option argument is the target path.
|
|
14
|
+
exclude_value = nil
|
|
15
|
+
target_path = nil
|
|
16
|
+
|
|
17
|
+
args.each_with_index do |a, i|
|
|
18
|
+
if a.start_with?("--exclude=")
|
|
19
|
+
exclude_value = a.split("=", 2)[1]
|
|
20
|
+
elsif a == "--exclude"
|
|
21
|
+
exclude_value = args[i + 1]
|
|
22
|
+
elsif !a.start_with?('-') && target_path.nil?
|
|
23
|
+
target_path = a
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if target_path.nil?
|
|
28
|
+
puts "Usage: vinter [file.vim|directory] [--exclude=dir1,dir2]"
|
|
29
|
+
return 1
|
|
30
|
+
end
|
|
14
31
|
|
|
15
32
|
unless File.exist?(target_path)
|
|
16
33
|
puts "Error: File or directory not found: #{target_path}"
|
|
17
34
|
return 1
|
|
18
35
|
end
|
|
19
36
|
|
|
37
|
+
excludes = Array(exclude_value).flat_map { |v| v.to_s.split(',') }.map(&:strip).reject(&:empty?)
|
|
38
|
+
|
|
20
39
|
vim_files = if File.directory?(target_path)
|
|
21
|
-
find_vim_files(target_path)
|
|
40
|
+
find_vim_files(target_path, excludes)
|
|
22
41
|
else
|
|
23
|
-
|
|
42
|
+
# Check if single file is inside an excluded directory
|
|
43
|
+
if excluded_file?(target_path, excludes, File.dirname(target_path))
|
|
44
|
+
[]
|
|
45
|
+
else
|
|
46
|
+
[target_path]
|
|
47
|
+
end
|
|
24
48
|
end
|
|
25
49
|
|
|
26
50
|
if vim_files.empty?
|
|
@@ -68,8 +92,32 @@ module Vinter
|
|
|
68
92
|
|
|
69
93
|
private
|
|
70
94
|
|
|
71
|
-
def find_vim_files(directory)
|
|
72
|
-
Dir.glob(File.join(directory, "**", "*.vim")).sort
|
|
95
|
+
def find_vim_files(directory, excludes = [])
|
|
96
|
+
files = Dir.glob(File.join(directory, "**", "*.vim")).sort
|
|
97
|
+
|
|
98
|
+
return files if excludes.empty?
|
|
99
|
+
|
|
100
|
+
# Normalize exclude directories to absolute paths (relative to the target directory)
|
|
101
|
+
normalized = excludes.map { |e| File.expand_path(e, directory) }
|
|
102
|
+
|
|
103
|
+
files.reject do |f|
|
|
104
|
+
normalized.any? do |ex|
|
|
105
|
+
ex_with_slash = ex.end_with?(File::SEPARATOR) ? ex : ex + File::SEPARATOR
|
|
106
|
+
f.start_with?(ex_with_slash) || File.expand_path(f).start_with?(ex_with_slash)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def excluded_file?(file_path, excludes, base_dir)
|
|
112
|
+
return false if excludes.empty?
|
|
113
|
+
|
|
114
|
+
normalized = excludes.map { |e| File.expand_path(e, base_dir) }
|
|
115
|
+
file_abs = File.expand_path(file_path)
|
|
116
|
+
|
|
117
|
+
normalized.any? do |ex|
|
|
118
|
+
ex_with_slash = ex.end_with?(File::SEPARATOR) ? ex : ex + File::SEPARATOR
|
|
119
|
+
file_abs.start_with?(ex_with_slash)
|
|
120
|
+
end
|
|
73
121
|
end
|
|
74
122
|
end
|
|
75
123
|
end
|
data/lib/vinter.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vinter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Bradbury
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-11-30 00:00:00.000000000 Z
|
|
11
12
|
dependencies: []
|
|
12
|
-
description: A linter for
|
|
13
|
-
enforce best practices
|
|
13
|
+
description: A linter for vim9script
|
|
14
14
|
email: dan.luckydaisy@gmail.com
|
|
15
15
|
executables:
|
|
16
16
|
- vinter
|
|
@@ -30,6 +30,7 @@ homepage: https://github.com/DanBradbury/vinter
|
|
|
30
30
|
licenses:
|
|
31
31
|
- MIT
|
|
32
32
|
metadata: {}
|
|
33
|
+
post_install_message:
|
|
33
34
|
rdoc_options: []
|
|
34
35
|
require_paths:
|
|
35
36
|
- lib
|
|
@@ -44,7 +45,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
44
45
|
- !ruby/object:Gem::Version
|
|
45
46
|
version: '0'
|
|
46
47
|
requirements: []
|
|
47
|
-
rubygems_version: 3.
|
|
48
|
+
rubygems_version: 3.5.11
|
|
49
|
+
signing_key:
|
|
48
50
|
specification_version: 4
|
|
49
|
-
summary: A linter
|
|
51
|
+
summary: A vim9script linter
|
|
50
52
|
test_files: []
|