ruby-zoom 4.5.5 → 4.5.6
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/zoom.rb +8 -11
- data/lib/zoom/cache.rb +4 -0
- data/lib/zoom/profile.rb +17 -6
- data/lib/zoom/profile/unsafe_java.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13309634343d322e2a7a1f337ca36ccdd9364a71
|
4
|
+
data.tar.gz: 7a92ddabed36807f0431c5b5038afd26c5448a3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab81d532780f4d669ce66432d524244258f0a5700d2ed0c00a4e6ae4dae568683bfd8b92cb26c0b1fa8fa04813c3160850033ddc270fd9121c02ad319eaccbe
|
7
|
+
data.tar.gz: c172029ce54ab7be4faae52d4c37672060be79203a11fd17c1dde06ba99ad6fe9fdc01261d3bc61dc28bb46c536d26dd44b108aab2a805b4c2ab2c25b15c870e
|
data/lib/zoom.rb
CHANGED
@@ -30,14 +30,15 @@ class Zoom
|
|
30
30
|
|
31
31
|
def repeat(shortcut = true)
|
32
32
|
return if (@cache.empty?)
|
33
|
-
run(@cache.header, shortcut)
|
33
|
+
run(@cache.header, shortcut, true)
|
34
34
|
end
|
35
35
|
|
36
|
-
def run(header, shortcut = true)
|
36
|
+
def run(header, shortcut = true, repeat = false)
|
37
37
|
# Ensure header has no nil
|
38
|
-
["args", "
|
38
|
+
["args", "pattern", "profile_name"].each do |key|
|
39
39
|
header[key] ||= ""
|
40
40
|
end
|
41
|
+
header["paths"] ||= "."
|
41
42
|
header["pwd"] = Dir.pwd
|
42
43
|
header["translate"] ||= Array.new
|
43
44
|
|
@@ -52,21 +53,17 @@ class Zoom
|
|
52
53
|
end
|
53
54
|
|
54
55
|
profile = @config.get_profile(profile_name)
|
55
|
-
if (!profile.pattern.empty?)
|
56
|
-
header["pattern"] = profile.pattern
|
57
|
-
end
|
58
|
-
|
59
56
|
begin
|
57
|
+
# This will translate and/or append args such that the
|
58
|
+
# output will be something Zoom can process
|
59
|
+
header = profile.preprocess(header) if (!repeat)
|
60
|
+
|
60
61
|
# Clear cache
|
61
62
|
@cache.clear
|
62
63
|
|
63
64
|
# Store needed details
|
64
65
|
@cache.header(header)
|
65
66
|
|
66
|
-
# This will translate and/or append args such that the
|
67
|
-
# output will be something Zoom can process
|
68
|
-
header = profile.preprocess(header)
|
69
|
-
|
70
67
|
# Execute profile
|
71
68
|
@cache.write(profile.exe(header))
|
72
69
|
|
data/lib/zoom/cache.rb
CHANGED
@@ -62,6 +62,10 @@ class Zoom::Cache
|
|
62
62
|
return nil if (header.nil? && empty?)
|
63
63
|
return @header if (header.nil?)
|
64
64
|
|
65
|
+
# This causes the cache to be "empty" so don't do it! Leaving
|
66
|
+
# this here so I don't forget.
|
67
|
+
# @header = header
|
68
|
+
|
65
69
|
File.open(@cache_file, "a") do |f|
|
66
70
|
f.write("ZOOM_HEADER=#{JSON.generate(header)}\n")
|
67
71
|
end
|
data/lib/zoom/profile.rb
CHANGED
@@ -53,7 +53,7 @@ class Zoom::Profile < Hash
|
|
53
53
|
@format_flags,
|
54
54
|
flags,
|
55
55
|
header["args"],
|
56
|
-
header["pattern"],
|
56
|
+
header["pattern"].shellescape,
|
57
57
|
header["paths"],
|
58
58
|
after
|
59
59
|
].join(" ").strip
|
@@ -165,18 +165,29 @@ class Zoom::Profile < Hash
|
|
165
165
|
|
166
166
|
def preprocess(header)
|
167
167
|
# Use hard-coded pattern if defined
|
168
|
-
|
169
|
-
|
170
|
-
|
168
|
+
if (
|
169
|
+
@pattern &&
|
170
|
+
!@pattern.empty? &&
|
171
|
+
(header["pattern"] != @pattern)
|
172
|
+
)
|
173
|
+
header["args"] += " #{header["pattern"]}"
|
171
174
|
header["pattern"] = @pattern
|
172
175
|
end
|
173
176
|
|
174
177
|
case operator.split("/")[-1]
|
175
178
|
when /^ack(-grep)?$/, "ag", "grep", "pt"
|
176
|
-
|
179
|
+
paths = header["paths"].split(" ")
|
180
|
+
if (header["pattern"].empty? && !paths.empty?)
|
181
|
+
header["pattern"] = paths.delete_at(0)
|
182
|
+
header["paths"] = paths.join(" ").strip
|
183
|
+
header["paths"] = "." if (header["paths"].empty?)
|
184
|
+
end
|
185
|
+
|
186
|
+
# This isn't done here anymore as it'll break hilighting
|
187
|
+
# header["pattern"] = header["pattern"].shellescape
|
177
188
|
when "find"
|
178
189
|
# If additional args are passed, then assume pattern is
|
179
|
-
# actually
|
190
|
+
# actually an arg
|
180
191
|
if (header["args"] && !header["args"].empty?)
|
181
192
|
header["args"] += " #{header["pattern"]}"
|
182
193
|
header["pattern"] = ""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-zoom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|