Method: Buildable#expand_sources

Defined in:
lib/makeconf/buildable.rb

#expand_sources(x) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/makeconf/buildable.rb', line 84

def expand_sources(x)
  log.info "expanding [#{x.to_s}] to source file list"
  raise ArgumentError('Wrong type') unless x.is_a? Array

  # Use glob(3) to expand the list of sources
  buf = []
  x.each do |src| 
    if src =~ /\*/
      buf << Dir.glob(src)
    else
      buf.push src
    end
  end
  buf.flatten

# TODO: elsewhere
  # Ensure that all source files exist
#@sources.each do |src|
#      throw ArgumentError("#{src} does not exist") unless File.exist? src
#    end

#XXX-lame
#    # Read all source code into a single array
#    @source_code = {}
#    @sources.each { |x| @source_code[x] = File.readlines(x) }

end