Class: Motion::Project::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/motion/gem_ext.rb

Instance Method Summary collapse

Instance Method Details

#files_dependencies(deps_hash) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/motion/gem_ext.rb', line 5

def files_dependencies(deps_hash)
  res_path = lambda do |x|
    path = /^\.?\//.match(x) ? x : File.join(".", x)
    unless @files.flatten.include?(path)
      App.fail "Can't resolve dependency `#{x}'"
    end
    path
  end
  deps_hash.each do |path, deps|
    deps = [deps] unless deps.is_a?(Array)
    @dependencies[res_path.call(path)] = deps.map(&res_path)
  end
end