Class: MotionRequire::DependencyGraph

Inherits:
Object
  • Object
show all
Defined in:
lib/motion_require/dependency_graph.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, start_files, load_paths) ⇒ DependencyGraph

Returns a new instance of DependencyGraph.



25
26
27
28
29
30
31
32
33
34
# File 'lib/motion_require/dependency_graph.rb', line 25

def initialize(app, start_files, load_paths)
  @app = app
  @start_files = start_files
  @load_paths = load_paths.map { |path| File.join(@app.project_dir, path) }

  @dependencies = DependencyHash.new []
  @files = []

  @resolved = false
end

Class Method Details

.build(app) ⇒ Object



19
20
21
22
23
# File 'lib/motion_require/dependency_graph.rb', line 19

def self.build(app)
  builder = new(app, app.files + app.spec_files, ['app', 'lib', 'vendor'])
  app.files = [kernel_require_path] + builder.files - app.spec_files
  #app.files_dependencies(builder.dependencies)
end

Instance Method Details

#dependenciesObject



41
42
43
44
# File 'lib/motion_require/dependency_graph.rb', line 41

def dependencies
  rebuild
  @dependencies
end

#filesObject



36
37
38
39
# File 'lib/motion_require/dependency_graph.rb', line 36

def files
  rebuild
  @files
end