22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/packer.rb', line 22
def get_pack_list(verbose=true)
list = {}
= {}
for pattern in @patterns
@singular = pattern.singularize
@plural = singular.pluralize
puts "processing #{@plural} ..." if verbose
for option in @parser.options
config = @config[option]
paths = config["paths"]
key = config["plural"] ? @plural : @singular
suffix = config["suffix"]
dir = config["dir"]
inside = config["inside"]
= config["extract"]
begin_p = config["begin_pattern"]
end_p = config["end_pattern"]
list[option] ||= []
for path in paths
file = File.expand_path("#{@basedir}/#{path}#{inside ? '' : key}#{suffix}")
flist = dir ? Dir.glob(File.expand_path("#{file}/**")) : Dir.glob(file)
flist.sort!
for f in flist
incfile = true
next if !File.exist?(f)
contents = File.readlines(f)
if inside
insidecontent = (contents,key)
next if insidecontent.size<1
end
if
contents = (contents,key,begin_p,end_p)
incfile = contents.size>0
if incfile && [f]
contents = [f]+contents
end
end
[f] = contents
list[option] << f if incfile
end
end
end
end
[list,]
end
|