Top Level Namespace

Defined Under Namespace

Modules: LivingStyleGuide Classes: LivingStyleGuideRailtie

Instance Method Summary collapse

Instance Method Details

#map_files(glob) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/livingstyleguide/commands/import_and_use.rb', line 3

def map_files(glob)
  glob << ".lsg" unless glob =~ /\.(\w+|\*)$/
  glob.gsub!(/[^\/]+$/, "{_,}\\0")
  glob = File.join(document.path, glob)

  files = Dir.glob(glob)
  if glob.index("*")
    files.uniq!
    files.reject! { |f| document.files.include?(f) }
  elsif files.empty?
    raise Errno::ENOENT
  end

  files.map do |file|
    document.depend_on file
    yield(file)
  end.join
end