Class: Zoom::Profile::Find
Instance Attribute Summary
#exts, #files, #format_flags, #regex, #taggable
Instance Method Summary
collapse
#after, #before, #class_name, #flags, from_json, #grep_like_tags?, #name, #only_exts_and_files, profile_by_name, subclasses, #to_s, #tool
Constructor Details
#initialize(n = nil, t = nil, f = nil, b = nil, a = nil) ⇒ Find
Returns a new instance of Find.
30
31
32
33
34
35
|
# File 'lib/zoom/profile/find.rb', line 30
def initialize(n = nil, t = nil, f = nil, b = nil, a = nil)
a = "-print" if (a.nil? || a.empty?)
f ||= ""
t ||= "find"
super(n, t, f, b, a)
end
|
Instance Method Details
#exe(header) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/zoom/profile/find.rb', line 4
def exe()
cmd = [
before,
tool,
["paths"],
flags,
["translated"],
["args"],
["regex"],
after
].join(" ").strip
if (.has_key?("debug") && ["debug"])
puts(cmd)
return ""
else
return %x(#{cmd})
end
end
|
24
25
26
27
28
|
# File 'lib/zoom/profile/find.rb', line 24
def grep_like_format_flags(all = false)
super
@grep_like_tags = false
@taggable = true
end
|
#preprocess(header) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/zoom/profile/find.rb', line 37
def preprocess()
if (!["args"].empty?)
["args"] += " #{["regex"]}"
["regex"] = ""
end
if (!["regex"].empty?)
["regex"] = [
"-regextype posix-extended",
"-iregex \".*#{["regex"]}.*\""
].join(" ")
end
return
end
|
#translate(from) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/zoom/profile/find.rb', line 56
def translate(from)
to = Array.new
from.each do |flag, value|
case flag
when "follow"
to.push("-L")
when "ignore"
value.each do |v|
to.push("-name \"#{v}\" -prune -o")
end
end
end
return to.join(" ")
end
|