Module: Filament::SrcUtil

Defined in:
lib/filament/target.rb

Instance Method Summary collapse

Instance Method Details

#files(h) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/filament/target.rb', line 13

def files(h)
  tags = h[:tags]
  suffix = h[:suffix] || '.*'
  dir = h[:dir] || "#{h[:base_dir]}/#{h[:sub_dir]}"
  wildcard = h[:wildcard] || "**/*#{suffix}"
  
  list = []
  p = Pathname.new(dir)
  if p.exist?
    p.children.each do |child|
      if tags.include?(child.basename.to_s.to_sym)
        list += FileList[child + wildcard].to_a
      end
    end
  end

  return list
end

#res_files(h) ⇒ Object



38
39
40
41
# File 'lib/filament/target.rb', line 38

def res_files(h)
  h[:sub_dir] ||= 'res'
  return src_files(h)
end

#src_dir(dir) ⇒ Object



43
44
45
# File 'lib/filament/target.rb', line 43

def src_dir(dir)
  return src_files(:dir => dir)
end

#src_files(h) ⇒ Object



32
33
34
35
36
# File 'lib/filament/target.rb', line 32

def src_files(h)
  h[:base_dir] ||= 'src'
  h[:tags] ||= platform.tags + [:all]
  return files(h)
end